Add MKNOD command support
[deb_libnfs.git] / include / libnfs.h
index c72b7cf537622ed29ea9a2b981d1d4d44fae6c3f..4f56c876f326d1c2b67e3ebb1e222dd29cdc3c39 100644 (file)
@@ -18,6 +18,8 @@
  * This is the highlevel interface to access NFS resources using a posix-like interface
  */
 #include <stdint.h>
+#include <rpc/rpc.h>
+#include <rpc/auth.h>
 
 struct nfs_context;
 struct rpc_context;
@@ -57,12 +59,12 @@ struct utimbuf {
 EXTERN int nfs_get_fd(struct nfs_context *nfs);
 EXTERN int nfs_which_events(struct nfs_context *nfs);
 EXTERN int nfs_service(struct nfs_context *nfs, int revents);
+EXTERN int nfs_queue_length(struct nfs_context *nfs);
 
 /*
  * Used if you need different credentials than the default for the current user.
  */
-struct AUTH;
-EXTERN void nfs_set_auth(struct nfs_context *nfs, struct AUTH *auth);
+EXTERN void nfs_set_auth(struct nfs_context *nfs, AUTH *auth);
 
 
 /*
@@ -543,6 +545,29 @@ EXTERN int nfs_creat_async(struct nfs_context *nfs, const char *path, int mode,
 EXTERN int nfs_creat(struct nfs_context *nfs, const char *path, int mode, struct nfsfh **nfsfh);
 
 
+/*
+ * MKNOD()
+ */
+/*
+ * Async mknod()
+ *
+ * Function returns
+ *  0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
+ * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ *      0 : Success.
+ * -errno : An error occured.
+ *          data is the error string.
+ */
+EXTERN int nfs_mknod_async(struct nfs_context *nfs, const char *path, int mode, int dev, nfs_cb cb, void *private_data);
+/*
+ * Sync mknod()
+ * Function returns
+ *      0 : Success
+ * -errno : An error occured.
+ */
+EXTERN int nfs_mknod(struct nfs_context *nfs, const char *path, int mode, int dev);
 
 
 
@@ -611,6 +636,14 @@ struct nfsdirent  {
        struct nfsdirent *next;
        char *name;
        uint64_t inode;
+
+       /* some extra fields we get for free through the READDIRPLUS3 call. You need libnfs-raw-nfs.h for these */
+       uint32_t type; /* NF3REG, NF3DIR, NF3BLK, ... */
+       uint32_t mode;
+       uint64_t size;
+       struct timeval atime;
+       struct timeval mtime;
+       struct timeval ctime;
 };
 /*
  * nfs_readdir() never blocks, so no special sync/async versions are available