fix implicit decl warnings
[deb_libnfs.git] / lib / libnfs.c
index 2acd17213f12820d76e7be0294d49620e9faded5..f87752cdd2766d378f2992ec85b203e1a9871e53 100644 (file)
@@ -73,6 +73,7 @@
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
+#include <time.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -1548,9 +1549,9 @@ static int nfs_stat64_continue_internal(struct nfs_context *nfs, fattr3 *attr _U
        return 0;
 }
 
-int nfs_stat64_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data)
+int nfs_stat64_async_internal(struct nfs_context *nfs, const char *path, int no_follow, nfs_cb cb, void *private_data)
 {
-       if (nfs_lookuppath_async(nfs, path, 0, cb, private_data, nfs_stat64_continue_internal, NULL, NULL, 0) != 0) {
+       if (nfs_lookuppath_async(nfs, path, no_follow, cb, private_data, nfs_stat64_continue_internal, NULL, NULL, 0) != 0) {
                rpc_set_error(nfs->rpc, "Out of memory: failed to start parsing the path components");
                return -1;
        }
@@ -1558,6 +1559,16 @@ int nfs_stat64_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void
        return 0;
 }
 
+int nfs_stat64_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data)
+{
+       return nfs_stat64_async_internal(nfs, path, 0, cb, private_data);
+}
+
+int nfs_lstat64_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data)
+{
+       return nfs_stat64_async_internal(nfs, path, 1, cb, private_data);
+}
+
 /*
  * Async open()
  */
@@ -2761,7 +2772,7 @@ static void nfs_create_trunc_cb(struct rpc_context *rpc, int status, void *comma
 {
        struct nfs_cb_data *data = private_data;
        struct nfs_context *nfs = data->nfs;
-       struct nfsfh *nfsfh;
+       struct nfsfh *nfsfh = data->nfsfh;
        SETATTR3res *res;
 
        assert(rpc->magic == RPC_CONTEXT_MAGIC);
@@ -2788,7 +2799,7 @@ static void nfs_create_trunc_cb(struct rpc_context *rpc, int status, void *comma
                return;
        }
 
-       data->cb(0, nfs, data->nfsfh, data->private_data);
+       data->cb(0, nfs, nfsfh, data->private_data);
        free_nfs_cb_data(data);
 }
 
@@ -3966,9 +3977,9 @@ static int nfs_chmod_continue_internal(struct nfs_context *nfs, fattr3 *attr _U_
 }
 
 
-int nfs_chmod_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data)
+int nfs_chmod_async_internal(struct nfs_context *nfs, const char *path, int no_follow, int mode, nfs_cb cb, void *private_data)
 {
-       if (nfs_lookuppath_async(nfs, path, 0, cb, private_data, nfs_chmod_continue_internal, NULL, NULL, mode) != 0) {
+       if (nfs_lookuppath_async(nfs, path, no_follow, cb, private_data, nfs_chmod_continue_internal, NULL, NULL, mode) != 0) {
                rpc_set_error(nfs->rpc, "Out of memory: failed to start parsing the path components");
                return -1;
        }
@@ -3976,6 +3987,16 @@ int nfs_chmod_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb
        return 0;
 }
 
+int nfs_chmod_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data)
+{
+       return nfs_chown_async_internal(nfs, path, 0, mode, cb, private_data);
+}
+
+int nfs_lchmod_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data)
+{
+       return nfs_chown_async_internal(nfs, path, 1, mode, cb, private_data);
+}
+
 /*
  * Async fchmod()
  */
@@ -4076,7 +4097,7 @@ static int nfs_chown_continue_internal(struct nfs_context *nfs, fattr3 *attr _U_
 }
 
 
-int nfs_chown_async(struct nfs_context *nfs, const char *path, int uid, int gid, nfs_cb cb, void *private_data)
+int nfs_chown_async_internal(struct nfs_context *nfs, const char *path, int no_follow, int uid, int gid, nfs_cb cb, void *private_data)
 {
        struct nfs_chown_data *chown_data;
 
@@ -4089,7 +4110,7 @@ int nfs_chown_async(struct nfs_context *nfs, const char *path, int uid, int gid,
        chown_data->uid = uid;
        chown_data->gid = gid;
 
-       if (nfs_lookuppath_async(nfs, path, 0, cb, private_data, nfs_chown_continue_internal, chown_data, free, 0) != 0) {
+       if (nfs_lookuppath_async(nfs, path, no_follow, cb, private_data, nfs_chown_continue_internal, chown_data, free, 0) != 0) {
                rpc_set_error(nfs->rpc, "Out of memory: failed to start parsing the path components");
                return -1;
        }
@@ -4097,6 +4118,15 @@ int nfs_chown_async(struct nfs_context *nfs, const char *path, int uid, int gid,
        return 0;
 }
 
+int nfs_chown_async(struct nfs_context *nfs, const char *path, int uid, int gid, nfs_cb cb, void *private_data)
+{
+       return nfs_chown_async_internal(nfs, path, 0, uid, gid, cb, private_data);
+}
+
+int nfs_lchown_async(struct nfs_context *nfs, const char *path, int uid, int gid, nfs_cb cb, void *private_data)
+{
+       return nfs_chown_async_internal(nfs, path, 1, uid, gid, cb, private_data);
+}
 
 /*
  * Async fchown()
@@ -4209,8 +4239,7 @@ static int nfs_utimes_continue_internal(struct nfs_context *nfs, fattr3 *attr _U
        return 0;
 }
 
-
-int nfs_utimes_async(struct nfs_context *nfs, const char *path, struct timeval *times, nfs_cb cb, void *private_data)
+int nfs_utimes_async_internal(struct nfs_context *nfs, const char *path, int no_follow, struct timeval *times, nfs_cb cb, void *private_data)
 {
        struct timeval *new_times = NULL;
 
@@ -4224,7 +4253,7 @@ int nfs_utimes_async(struct nfs_context *nfs, const char *path, struct timeval *
                memcpy(new_times, times, sizeof(struct timeval)*2);
        }
 
-       if (nfs_lookuppath_async(nfs, path, 0, cb, private_data, nfs_utimes_continue_internal, new_times, free, 0) != 0) {
+       if (nfs_lookuppath_async(nfs, path, no_follow, cb, private_data, nfs_utimes_continue_internal, new_times, free, 0) != 0) {
                rpc_set_error(nfs->rpc, "Out of memory: failed to start parsing the path components");
                return -1;
        }
@@ -4232,6 +4261,16 @@ int nfs_utimes_async(struct nfs_context *nfs, const char *path, struct timeval *
        return 0;
 }
 
+int nfs_utimes_async(struct nfs_context *nfs, const char *path, struct timeval *times, nfs_cb cb, void *private_data)
+{
+       return nfs_utimes_async_internal(nfs, path, 0, times, cb, private_data);
+}
+
+int nfs_lutimes_async(struct nfs_context *nfs, const char *path, struct timeval *times, nfs_cb cb, void *private_data)
+{
+       return nfs_utimes_async_internal(nfs, path, 1, times, cb, private_data);
+}
+
 /*
  * Async utime()
  */