summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorDerrell Lipman <derrell@samba.org>2007-09-06 13:21:31 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:30:31 -0500
commit9044d034892ea7f21082bf915fa5dd531043b473 (patch)
treee4ce2cee1f9a46c79d171a7b1c2c98d9557bfac5 /source3/libsmb
parentabe7e04244e32278ae39c2156f00a2c678de603c (diff)
downloadsamba-9044d034892ea7f21082bf915fa5dd531043b473.tar.gz
samba-9044d034892ea7f21082bf915fa5dd531043b473.tar.bz2
samba-9044d034892ea7f21082bf915fa5dd531043b473.zip
r24981: - Use the formal syntax for calling functions through pointers. I've wanted
to make this change for ages, but now with the issue of "open" requiring it, this is the time to just do all of them. Derrell (This used to be commit e746aaaf4db7099252ef048da7857bd488cb681f)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/libsmb_compat.c84
-rw-r--r--source3/libsmb/libsmbclient.c108
2 files changed, 98 insertions, 94 deletions
diff --git a/source3/libsmb/libsmb_compat.c b/source3/libsmb/libsmb_compat.c
index d6c2fe2109..573d087d6e 100644
--- a/source3/libsmb/libsmb_compat.c
+++ b/source3/libsmb/libsmb_compat.c
@@ -162,7 +162,7 @@ int smbc_open(const char *furl, int flags, mode_t mode)
fd = add_fd(file);
if (fd == -1)
- statcont->close_fn(statcont, file);
+ (statcont->close_fn)(statcont, file);
return fd;
}
@@ -172,15 +172,15 @@ int smbc_creat(const char *furl, mode_t mode)
SMBCFILE * file;
int fd;
- file = statcont->creat(statcont, furl, mode);
+ file = (statcont->creat)(statcont, furl, mode);
if (!file)
return -1;
fd = add_fd(file);
if (fd == -1) {
/* Hmm... should we delete the file too ? I guess we could try */
- statcont->close_fn(statcont, file);
- statcont->unlink(statcont, furl);
+ (statcont->close_fn)(statcont, file);
+ (statcont->unlink)(statcont, furl);
}
return fd;
}
@@ -189,36 +189,36 @@ int smbc_creat(const char *furl, mode_t mode)
ssize_t smbc_read(int fd, void *buf, size_t bufsize)
{
SMBCFILE * file = find_fd(fd);
- return statcont->read(statcont, file, buf, bufsize);
+ return (statcont->read)(statcont, file, buf, bufsize);
}
ssize_t smbc_write(int fd, void *buf, size_t bufsize)
{
SMBCFILE * file = find_fd(fd);
- return statcont->write(statcont, file, buf, bufsize);
+ return (statcont->write)(statcont, file, buf, bufsize);
}
off_t smbc_lseek(int fd, off_t offset, int whence)
{
SMBCFILE * file = find_fd(fd);
- return statcont->lseek(statcont, file, offset, whence);
+ return (statcont->lseek)(statcont, file, offset, whence);
}
int smbc_close(int fd)
{
SMBCFILE * file = find_fd(fd);
del_fd(fd);
- return statcont->close_fn(statcont, file);
+ return (statcont->close_fn)(statcont, file);
}
int smbc_unlink(const char *fname)
{
- return statcont->unlink(statcont, fname);
+ return (statcont->unlink)(statcont, fname);
}
int smbc_rename(const char *ourl, const char *nurl)
{
- return statcont->rename(statcont, ourl, statcont, nurl);
+ return (statcont->rename)(statcont, ourl, statcont, nurl);
}
int smbc_opendir(const char *durl)
@@ -226,13 +226,13 @@ int smbc_opendir(const char *durl)
SMBCFILE * file;
int fd;
- file = statcont->opendir(statcont, durl);
+ file = (statcont->opendir)(statcont, durl);
if (!file)
return -1;
fd = add_fd(file);
if (fd == -1)
- statcont->closedir(statcont, file);
+ (statcont->closedir)(statcont, file);
return fd;
}
@@ -241,62 +241,62 @@ int smbc_closedir(int dh)
{
SMBCFILE * file = find_fd(dh);
del_fd(dh);
- return statcont->closedir(statcont, file);
+ return (statcont->closedir)(statcont, file);
}
int smbc_getdents(unsigned int dh, struct smbc_dirent *dirp, int count)
{
SMBCFILE * file = find_fd(dh);
- return statcont->getdents(statcont, file,dirp, count);
+ return (statcont->getdents)(statcont, file,dirp, count);
}
struct smbc_dirent* smbc_readdir(unsigned int dh)
{
SMBCFILE * file = find_fd(dh);
- return statcont->readdir(statcont, file);
+ return (statcont->readdir)(statcont, file);
}
off_t smbc_telldir(int dh)
{
SMBCFILE * file = find_fd(dh);
- return statcont->telldir(statcont, file);
+ return (statcont->telldir)(statcont, file);
}
int smbc_lseekdir(int fd, off_t offset)
{
SMBCFILE * file = find_fd(fd);
- return statcont->lseekdir(statcont, file, offset);
+ return (statcont->lseekdir)(statcont, file, offset);
}
int smbc_mkdir(const char *durl, mode_t mode)
{
- return statcont->mkdir(statcont, durl, mode);
+ return (statcont->mkdir)(statcont, durl, mode);
}
int smbc_rmdir(const char *durl)
{
- return statcont->rmdir(statcont, durl);
+ return (statcont->rmdir)(statcont, durl);
}
int smbc_stat(const char *url, struct stat *st)
{
- return statcont->stat(statcont, url, st);
+ return (statcont->stat)(statcont, url, st);
}
int smbc_fstat(int fd, struct stat *st)
{
SMBCFILE * file = find_fd(fd);
- return statcont->fstat(statcont, file, st);
+ return (statcont->fstat)(statcont, file, st);
}
int smbc_chmod(const char *url, mode_t mode)
{
- return statcont->chmod(statcont, url, mode);
+ return (statcont->chmod)(statcont, url, mode);
}
int smbc_utimes(const char *fname, struct timeval *tbuf)
{
- return statcont->utimes(statcont, fname, tbuf);
+ return (statcont->utimes)(statcont, fname, tbuf);
}
#ifdef HAVE_UTIME_H
@@ -305,13 +305,13 @@ int smbc_utime(const char *fname, struct utimbuf *utbuf)
struct timeval tv[2];
if (utbuf == NULL)
- return statcont->utimes(statcont, fname, NULL);
+ return (statcont->utimes)(statcont, fname, NULL);
tv[0].tv_sec = utbuf->actime;
tv[1].tv_sec = utbuf->modtime;
tv[0].tv_usec = tv[1].tv_usec = 0;
- return statcont->utimes(statcont, fname, tv);
+ return (statcont->utimes)(statcont, fname, tv);
}
#endif
@@ -321,7 +321,7 @@ int smbc_setxattr(const char *fname,
size_t size,
int flags)
{
- return statcont->setxattr(statcont, fname, name, value, size, flags);
+ return (statcont->setxattr)(statcont, fname, name, value, size, flags);
}
int smbc_lsetxattr(const char *fname,
@@ -330,7 +330,7 @@ int smbc_lsetxattr(const char *fname,
size_t size,
int flags)
{
- return statcont->setxattr(statcont, fname, name, value, size, flags);
+ return (statcont->setxattr)(statcont, fname, name, value, size, flags);
}
int smbc_fsetxattr(int fd,
@@ -344,8 +344,8 @@ int smbc_fsetxattr(int fd,
errno = EBADF;
return -1;
}
- return statcont->setxattr(statcont, file->fname,
- name, value, size, flags);
+ return (statcont->setxattr)(statcont, file->fname,
+ name, value, size, flags);
}
int smbc_getxattr(const char *fname,
@@ -353,7 +353,7 @@ int smbc_getxattr(const char *fname,
const void *value,
size_t size)
{
- return statcont->getxattr(statcont, fname, name, value, size);
+ return (statcont->getxattr)(statcont, fname, name, value, size);
}
int smbc_lgetxattr(const char *fname,
@@ -361,7 +361,7 @@ int smbc_lgetxattr(const char *fname,
const void *value,
size_t size)
{
- return statcont->getxattr(statcont, fname, name, value, size);
+ return (statcont->getxattr)(statcont, fname, name, value, size);
}
int smbc_fgetxattr(int fd,
@@ -374,19 +374,19 @@ int smbc_fgetxattr(int fd,
errno = EBADF;
return -1;
}
- return statcont->getxattr(statcont, file->fname, name, value, size);
+ return (statcont->getxattr)(statcont, file->fname, name, value, size);
}
int smbc_removexattr(const char *fname,
const char *name)
{
- return statcont->removexattr(statcont, fname, name);
+ return (statcont->removexattr)(statcont, fname, name);
}
int smbc_lremovexattr(const char *fname,
const char *name)
{
- return statcont->removexattr(statcont, fname, name);
+ return (statcont->removexattr)(statcont, fname, name);
}
int smbc_fremovexattr(int fd,
@@ -397,21 +397,21 @@ int smbc_fremovexattr(int fd,
errno = EBADF;
return -1;
}
- return statcont->removexattr(statcont, file->fname, name);
+ return (statcont->removexattr)(statcont, file->fname, name);
}
int smbc_listxattr(const char *fname,
char *list,
size_t size)
{
- return statcont->listxattr(statcont, fname, list, size);
+ return (statcont->listxattr)(statcont, fname, list, size);
}
int smbc_llistxattr(const char *fname,
char *list,
size_t size)
{
- return statcont->listxattr(statcont, fname, list, size);
+ return (statcont->listxattr)(statcont, fname, list, size);
}
int smbc_flistxattr(int fd,
@@ -423,29 +423,29 @@ int smbc_flistxattr(int fd,
errno = EBADF;
return -1;
}
- return statcont->listxattr(statcont, file->fname, list, size);
+ return (statcont->listxattr)(statcont, file->fname, list, size);
}
int smbc_print_file(const char *fname, const char *printq)
{
- return statcont->print_file(statcont, fname, statcont, printq);
+ return (statcont->print_file)(statcont, fname, statcont, printq);
}
int smbc_open_print_job(const char *fname)
{
- SMBCFILE * file = statcont->open_print_job(statcont, fname);
+ SMBCFILE * file = (statcont->open_print_job)(statcont, fname);
if (!file) return -1;
return file->cli_fd;
}
int smbc_list_print_jobs(const char *purl, smbc_list_print_job_fn fn)
{
- return statcont->list_print_jobs(statcont, purl, fn);
+ return (statcont->list_print_jobs)(statcont, purl, fn);
}
int smbc_unlink_print_job(const char *purl, int id)
{
- return statcont->unlink_print_job(statcont, purl, id);
+ return (statcont->unlink_print_job)(statcont, purl, id);
}
diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c
index b6b4119ff4..7394008786 100644
--- a/source3/libsmb/libsmbclient.c
+++ b/source3/libsmb/libsmbclient.c
@@ -541,7 +541,7 @@ smbc_remove_unused_server(SMBCCTX * context,
DEBUG(3, ("smbc_remove_usused_server: %p removed.\n", srv));
- context->callbacks.remove_cached_srv_fn(context, srv);
+ (context->callbacks.remove_cached_srv_fn)(context, srv);
SAFE_FREE(srv);
@@ -561,19 +561,19 @@ find_server(SMBCCTX *context,
check_server_cache:
- srv = context->callbacks.get_cached_srv_fn(context, server, share,
- workgroup, username);
+ srv = (context->callbacks.get_cached_srv_fn)(context, server, share,
+ workgroup, username);
if (!auth_called && !srv && (!username[0] || !password[0])) {
if (context->internal->_auth_fn_with_context != NULL) {
- context->internal->_auth_fn_with_context(
+ (context->internal->_auth_fn_with_context)(
context,
server, share,
workgroup, sizeof(fstring),
username, sizeof(fstring),
password, sizeof(fstring));
} else {
- context->callbacks.auth_fn(
+ (context->callbacks.auth_fn)(
server, share,
workgroup, sizeof(fstring),
username, sizeof(fstring),
@@ -591,22 +591,22 @@ find_server(SMBCCTX *context,
}
if (srv) {
- if (context->callbacks.check_server_fn(context, srv)) {
+ if ((context->callbacks.check_server_fn)(context, srv)) {
/*
* This server is no good anymore
* Try to remove it and check for more possible
* servers in the cache
*/
- if (context->callbacks.remove_unused_server_fn(context,
- srv)) {
+ if ((context->callbacks.remove_unused_server_fn)(context,
+ srv)) {
/*
* We could not remove the server completely,
* remove it from the cache so we will not get
* it again. It will be removed when the last
* file/dir is closed.
*/
- context->callbacks.remove_cached_srv_fn(context,
- srv);
+ (context->callbacks.remove_cached_srv_fn)(context,
+ srv);
}
/*
@@ -683,14 +683,14 @@ smbc_server(SMBCCTX *context,
if (srv->cli->cnum == (uint16) -1) {
/* Ensure we have accurate auth info */
if (context->internal->_auth_fn_with_context != NULL) {
- context->internal->_auth_fn_with_context(
+ (context->internal->_auth_fn_with_context)(
context,
server, share,
workgroup, sizeof(fstring),
username, sizeof(fstring),
password, sizeof(fstring));
} else {
- context->callbacks.auth_fn(
+ (context->callbacks.auth_fn)(
server, share,
workgroup, sizeof(fstring),
username, sizeof(fstring),
@@ -703,8 +703,8 @@ smbc_server(SMBCCTX *context,
errno = smbc_errno(context, srv->cli);
cli_shutdown(srv->cli);
srv->cli = NULL;
- context->callbacks.remove_cached_srv_fn(context,
- srv);
+ (context->callbacks.remove_cached_srv_fn)(context,
+ srv);
srv = NULL;
}
@@ -881,7 +881,9 @@ smbc_server(SMBCCTX *context,
/* now add it to the cache (internal or external) */
/* Let the cache function set errno if it wants to */
errno = 0;
- if (context->callbacks.add_cached_srv_fn(context, srv, server, share, workgroup, username)) {
+ if ((context->callbacks.add_cached_srv_fn)(context, srv,
+ server, share,
+ workgroup, username)) {
int saved_errno = errno;
DEBUG(3, (" Failed to add server to cache\n"));
errno = saved_errno;
@@ -940,14 +942,14 @@ smbc_attr_server(SMBCCTX *context,
if (*password == '\0') {
/* ... then retrieve it now. */
if (context->internal->_auth_fn_with_context != NULL) {
- context->internal->_auth_fn_with_context(
+ (context->internal->_auth_fn_with_context)(
context,
server, share,
workgroup, sizeof(fstring),
username, sizeof(fstring),
password, sizeof(fstring));
} else {
- context->callbacks.auth_fn(
+ (context->callbacks.auth_fn)(
server, share,
workgroup, sizeof(fstring),
username, sizeof(fstring),
@@ -1019,11 +1021,11 @@ smbc_attr_server(SMBCCTX *context,
/* now add it to the cache (internal or external) */
errno = 0; /* let cache function set errno if it likes */
- if (context->callbacks.add_cached_srv_fn(context, ipc_srv,
- server,
- "*IPC$",
- workgroup,
- username)) {
+ if ((context->callbacks.add_cached_srv_fn)(context, ipc_srv,
+ server,
+ "*IPC$",
+ workgroup,
+ username)) {
DEBUG(3, (" Failed to add server to cache\n"));
if (errno == 0) {
errno = ENOMEM;
@@ -1186,7 +1188,7 @@ smbc_open_ctx(SMBCCTX *context,
int eno = 0;
eno = smbc_errno(context, srv->cli);
- file = context->opendir(context, fname);
+ file = (context->opendir)(context, fname);
if (!file) errno = eno;
return file;
@@ -1425,7 +1427,7 @@ smbc_close_ctx(SMBCCTX *context,
/* IS a dir ... */
if (!file->file) {
- return context->closedir(context, file);
+ return (context->closedir)(context, file);
}
@@ -1462,7 +1464,7 @@ smbc_close_ctx(SMBCCTX *context,
DLIST_REMOVE(context->internal->_files, file);
SAFE_FREE(file->fname);
SAFE_FREE(file);
- context->callbacks.remove_unused_server_fn(context, srv);
+ (context->callbacks.remove_unused_server_fn)(context, srv);
return -1;
@@ -2175,7 +2177,7 @@ smbc_fstat_ctx(SMBCCTX *context,
if (!file->file) {
- return context->fstatdir(context, file, st);
+ return (context->fstatdir)(context, file, st);
}
@@ -2936,20 +2938,22 @@ smbc_opendir_ctx(SMBCCTX *context,
*/
cb = &context->callbacks;
if (cli_is_error(targetcli) &&
- cb->check_server_fn(context, srv)) {
-
- /* ... then remove it. */
- if (cb->remove_unused_server_fn(context,
- srv)) {
- /*
- * We could not remove the server
- * completely, remove it from the
- * cache so we will not get it
- * again. It will be removed when the
- * last file/dir is closed.
- */
- cb->remove_cached_srv_fn(context, srv);
- }
+ (cb->check_server_fn)(context, srv)) {
+
+ /* ... then remove it. */
+ if ((cb->remove_unused_server_fn)(context,
+ srv)) {
+ /*
+ * We could not remove the
+ * server completely, remove
+ * it from the cache so we
+ * will not get it again. It
+ * will be removed when the
+ * last file/dir is closed.
+ */
+ (cb->remove_cached_srv_fn)(context,
+ srv);
+ }
}
errno = saved_errno;
@@ -6021,24 +6025,24 @@ smbc_print_file_ctx(SMBCCTX *c_file,
/* Now, try to open the printer file for writing */
- if ((long)(fid2 = c_print->open_print_job(c_print, printq)) < 0) {
+ if ((long)(fid2 = (c_print->open_print_job)(c_print, printq)) < 0) {
saverr = errno; /* Save errno */
- c_file->close_fn(c_file, fid1);
+ (c_file->close_fn)(c_file, fid1);
errno = saverr;
return -1;
}
- while ((bytes = c_file->read(c_file, fid1, buf, sizeof(buf))) > 0) {
+ while ((bytes = (c_file->read)(c_file, fid1, buf, sizeof(buf))) > 0) {
tot_bytes += bytes;
- if ((c_print->write(c_print, fid2, buf, bytes)) < 0) {
+ if (((c_print->write)(c_print, fid2, buf, bytes)) < 0) {
saverr = errno;
- c_file->close_fn(c_file, fid1);
- c_print->close_fn(c_print, fid2);
+ (c_file->close_fn)(c_file, fid1);
+ (c_print->close_fn)(c_print, fid2);
errno = saverr;
}
@@ -6047,8 +6051,8 @@ smbc_print_file_ctx(SMBCCTX *c_file,
saverr = errno;
- c_file->close_fn(c_file, fid1); /* We have to close these anyway */
- c_print->close_fn(c_print, fid2);
+ (c_file->close_fn)(c_file, fid1); /* We have to close these anyway */
+ (c_print->close_fn)(c_print, fid2);
if (bytes < 0) {
@@ -6298,7 +6302,7 @@ smbc_free_context(SMBCCTX *context,
f = context->internal->_files;
while (f) {
- context->close_fn(context, f);
+ (context->close_fn)(context, f);
f = f->next;
}
context->internal->_files = NULL;
@@ -6314,8 +6318,8 @@ smbc_free_context(SMBCCTX *context,
DEBUG(1, ("Forced shutdown: %p (fd=%d)\n",
s, s->cli->fd));
cli_shutdown(s->cli);
- context->callbacks.remove_cached_srv_fn(context,
- s);
+ (context->callbacks.remove_cached_srv_fn)(context,
+ s);
next = s->next;
DLIST_REMOVE(context->internal->_servers, s);
SAFE_FREE(s);
@@ -6326,7 +6330,7 @@ smbc_free_context(SMBCCTX *context,
}
else {
/* This is the polite way */
- if (context->callbacks.purge_cached_fn(context)) {
+ if ((context->callbacks.purge_cached_fn)(context)) {
DEBUG(1, ("Could not purge all servers, "
"free_context failed.\n"));
errno = EBUSY;