summaryrefslogtreecommitdiff
path: root/source3/libsmb/libsmb_file.c
diff options
context:
space:
mode:
authorDerrell Lipman <derrell.lipman@unwireduniverse.com>2008-02-29 13:34:35 -0500
committerDerrell Lipman <derrell.lipman@unwireduniverse.com>2008-03-01 20:47:22 -0500
commit4ba42cbe0f6bbd25848786e1a87c06aca79b98ea (patch)
treefa2417599eca2565d0a3f8ace8ef005909fcd6ab /source3/libsmb/libsmb_file.c
parent257b7b09298f7cb983b2f31b87fc5e46e0f62f0c (diff)
downloadsamba-4ba42cbe0f6bbd25848786e1a87c06aca79b98ea.tar.gz
samba-4ba42cbe0f6bbd25848786e1a87c06aca79b98ea.tar.bz2
samba-4ba42cbe0f6bbd25848786e1a87c06aca79b98ea.zip
Modified revamp of the libsmbclient interface.
Given the tacit (if that) approval by some people, and clear disapproval by others for my proposed clean-up and reorganization of libsmbclient, I've come up with a slightly different approach. This commit changes back to the original libsmbclient.h SMBCCTX structure which will maintain ABI compatibility. I retain, here, the setter and getter functions which all new code should use. Older programs already compiled should continue to work fine. Older programs being recompiled will encounter compile-time errors (intentionally!) so that the code can be corrected to use the setter/getter interfaces. Although this doesn't clean up the interface in the way I had wanted, the code reorganization and requirement for new programs to use the setters and getters allows future progress to be made on libsmbclient without further muddying up the interface, while retaining the ABI compatibility that was the big issue causing disapproval. I hope that this compromise is adequate. Derrell (This used to be commit 56429a3d60b2a48963342f6340b3c01469a892c6)
Diffstat (limited to 'source3/libsmb/libsmb_file.c')
-rw-r--r--source3/libsmb/libsmb_file.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/source3/libsmb/libsmb_file.c b/source3/libsmb/libsmb_file.c
index 619176697b..62b990ed00 100644
--- a/source3/libsmb/libsmb_file.c
+++ b/source3/libsmb/libsmb_file.c
@@ -46,7 +46,7 @@ SMBC_open_ctx(SMBCCTX *context,
int fd;
TALLOC_CTX *frame = talloc_stackframe();
- if (!context || !context->initialized) {
+ if (!context || !context->internal->initialized) {
errno = EINVAL; /* Best I can think of ... */
TALLOC_FREE(frame);
@@ -78,7 +78,7 @@ SMBC_open_ctx(SMBCCTX *context,
}
if (!user || user[0] == (char)0) {
- user = talloc_strdup(frame, context->user);
+ user = talloc_strdup(frame, context->config.user);
if (!user) {
errno = ENOMEM;
TALLOC_FREE(frame);
@@ -120,7 +120,7 @@ SMBC_open_ctx(SMBCCTX *context,
/*d_printf(">>>open: resolved %s as %s\n", path, targetpath);*/
if ((fd = cli_open(targetcli, targetpath, flags,
- context->share_mode)) < 0) {
+ context->internal->share_mode)) < 0) {
/* Handle the error ... */
@@ -139,7 +139,7 @@ SMBC_open_ctx(SMBCCTX *context,
file->offset = 0;
file->file = True;
- DLIST_ADD(context->files, file);
+ DLIST_ADD(context->internal->files, file);
/*
* If the file was opened in O_APPEND mode, all write
@@ -208,7 +208,7 @@ SMBC_creat_ctx(SMBCCTX *context,
mode_t mode)
{
- if (!context || !context->initialized) {
+ if (!context || !context->internal->initialized) {
errno = EINVAL;
return NULL;
@@ -246,7 +246,7 @@ SMBC_read_ctx(SMBCCTX *context,
*/
off_t offset;
- if (!context || !context->initialized) {
+ if (!context || !context->internal->initialized) {
errno = EINVAL;
TALLOC_FREE(frame);
@@ -256,7 +256,7 @@ SMBC_read_ctx(SMBCCTX *context,
DEBUG(4, ("smbc_read(%p, %d)\n", file, (int)count));
- if (!file || !SMBC_dlist_contains(context->files, file)) {
+ if (!file || !SMBC_dlist_contains(context->internal->files, file)) {
errno = EBADF;
TALLOC_FREE(frame);
return -1;
@@ -338,7 +338,7 @@ SMBC_write_ctx(SMBCCTX *context,
/* First check all pointers before dereferencing them */
- if (!context || !context->initialized) {
+ if (!context || !context->internal->initialized) {
errno = EINVAL;
TALLOC_FREE(frame);
@@ -346,7 +346,7 @@ SMBC_write_ctx(SMBCCTX *context,
}
- if (!file || !SMBC_dlist_contains(context->files, file)) {
+ if (!file || !SMBC_dlist_contains(context->internal->files, file)) {
errno = EBADF;
TALLOC_FREE(frame);
return -1;
@@ -418,14 +418,14 @@ SMBC_close_ctx(SMBCCTX *context,
struct cli_state *targetcli = NULL;
TALLOC_CTX *frame = talloc_stackframe();
- if (!context || !context->initialized) {
+ if (!context || !context->internal->initialized) {
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
}
- if (!file || !SMBC_dlist_contains(context->files, file)) {
+ if (!file || !SMBC_dlist_contains(context->internal->files, file)) {
errno = EBADF;
TALLOC_FREE(frame);
return -1;
@@ -470,7 +470,7 @@ SMBC_close_ctx(SMBCCTX *context,
* from the server cache if unused */
errno = SMBC_errno(context, targetcli);
srv = file->srv;
- DLIST_REMOVE(context->files, file);
+ DLIST_REMOVE(context->internal->files, file);
SAFE_FREE(file->fname);
SAFE_FREE(file);
(context->server.remove_unused_server_fn)(context, srv);
@@ -479,7 +479,7 @@ SMBC_close_ctx(SMBCCTX *context,
}
- DLIST_REMOVE(context->files, file);
+ DLIST_REMOVE(context->internal->files, file);
SAFE_FREE(file->fname);
SAFE_FREE(file);
TALLOC_FREE(frame);
@@ -509,7 +509,7 @@ SMBC_getatr(SMBCCTX * context,
time_t write_time;
TALLOC_CTX *frame = talloc_stackframe();
- if (!context || !context->initialized) {
+ if (!context || !context->internal->initialized) {
errno = EINVAL;
TALLOC_FREE(frame);
@@ -698,14 +698,14 @@ SMBC_lseek_ctx(SMBCCTX *context,
struct cli_state *targetcli = NULL;
TALLOC_CTX *frame = talloc_stackframe();
- if (!context || !context->initialized) {
+ if (!context || !context->internal->initialized) {
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
}
- if (!file || !SMBC_dlist_contains(context->files, file)) {
+ if (!file || !SMBC_dlist_contains(context->internal->files, file)) {
errno = EBADF;
TALLOC_FREE(frame);
@@ -803,14 +803,14 @@ SMBC_ftruncate_ctx(SMBCCTX *context,
struct cli_state *targetcli = NULL;
TALLOC_CTX *frame = talloc_stackframe();
- if (!context || !context->initialized) {
+ if (!context || !context->internal->initialized) {
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
}
- if (!file || !SMBC_dlist_contains(context->files, file)) {
+ if (!file || !SMBC_dlist_contains(context->internal->files, file)) {
errno = EBADF;
TALLOC_FREE(frame);
return -1;