off += count;
}
- printf("copied %d bytes\n", (int)count);
+ printf("copied %d bytes\n", (int)off);
free_file_context(src);
free_file_context(dst);
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_pmap_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+EXTERN int rpc_pmap_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
/*
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_pmap_getport_async(struct rpc_context *rpc, int program, int version, int protocol, rpc_cb cb, void *private_data);
+EXTERN int rpc_pmap_getport_async(struct rpc_context *rpc, int program, int version, int protocol, rpc_cb cb, void *private_data);
/*
* Call PORTMAPPER/SET
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_pmap_set_async(struct rpc_context *rpc, int program, int version, int protocol, int port, rpc_cb cb, void *private_data);
+EXTERN int rpc_pmap_set_async(struct rpc_context *rpc, int program, int version, int protocol, int port, rpc_cb cb, void *private_data);
/*
* Call PORTMAPPER/UNSET
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_pmap_unset_async(struct rpc_context *rpc, int program, int version, int protocol, int port, rpc_cb cb, void *private_data);
+EXTERN int rpc_pmap_unset_async(struct rpc_context *rpc, int program, int version, int protocol, int port, rpc_cb cb, void *private_data);
/*
* Call PORTMAPPER/CALLIT.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_pmap_callit_async(struct rpc_context *rpc, int program, int version, int procedure, char *data, int datalen, rpc_cb cb, void *private_data);
+EXTERN int rpc_pmap_callit_async(struct rpc_context *rpc, int program, int version, int procedure, char *data, int datalen, rpc_cb cb, void *private_data);
/*
- * MOUNT FUNCTIONS
+ * MOUNT v3 FUNCTIONS
*/
char *mountstat3_to_str(int stat);
int mountstat3_to_errno(int error);
/*
- * Call MOUNT/NULL
+ * Call MOUNT3/NULL
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_mount_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+EXTERN int rpc_mount3_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+EXTERN int rpc_mount_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
/*
- * Call MOUNT/MNT
+ * Call MOUNT3/MNT
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_mount_mnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data);
+EXTERN int rpc_mount3_mnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data);
+EXTERN int rpc_mount_mnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data);
/*
- * Call MOUNT/DUMP
+ * Call MOUNT3/DUMP
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_mount_dump_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+EXTERN int rpc_mount3_dump_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+EXTERN int rpc_mount_dump_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
/*
- * Call MOUNT/UMNT
+ * Call MOUNT3/UMNT
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_mount_umnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data);
+EXTERN int rpc_mount3_umnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data);
+EXTERN int rpc_mount_umnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data);
/*
- * Call MOUNT/UMNTALL
+ * Call MOUNT3/UMNTALL
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_mount_umntall_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+EXTERN int rpc_mount3_umntall_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+EXTERN int rpc_mount_umntall_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
/*
- * Call MOUNT/EXPORT
+ * Call MOUNT3/EXPORT
* NOTE: You must include 'libnfs-raw-mount.h' to get the definitions of the
* returned structures.
*
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_mount_export_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+EXTERN int rpc_mount3_export_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+EXTERN int rpc_mount_export_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+/*
+ * MOUNT v1 FUNCTIONS (Used with NFSv2)
+ */
+/*
+ * Call MOUNT1/NULL
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon.
+ * data is NULL.
+ * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+EXTERN int rpc_mount1_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+
+/*
+ * Call MOUNT1/MNT
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon.
+ * data is union mountres1.
+ * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+EXTERN int rpc_mount1_mnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data);
+/*
+ * Call MOUNT1/DUMP
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon.
+ * data is a mountlist.
+ * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+EXTERN int rpc_mount1_dump_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+
+/*
+ * Call MOUNT1/UMNT
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon.
+ * data NULL.
+ * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+EXTERN int rpc_mount1_umnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data);
+
+/*
+ * Call MOUNT1/UMNTALL
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon.
+ * data NULL.
+ * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+EXTERN int rpc_mount1_umntall_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+
+/*
+ * Call MOUNT1/EXPORT
+ * NOTE: You must include 'libnfs-raw-mount.h' to get the definitions of the
+ * returned structures.
+ *
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon.
+ * data is a pointer to an exports pointer:
+ * exports export = *(exports *)data;
+ * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+EXTERN int rpc_mount1_export_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
/*
- * NFS FUNCTIONS
+ * NFS v3 FUNCTIONS
*/
struct nfs_fh3;
char *nfsstat3_to_str(int error);
int nfsstat3_to_errno(int error);
/*
- * Call NFS/NULL
+ * Call NFS3/NULL
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nfs_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+EXTERN int rpc_nfs3_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+EXTERN int rpc_nfs_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
/*
- * Call NFS/GETATTR
+ * Call NFS3/GETATTR
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nfs_getattr_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data);
+struct GETATTR3args;
+EXTERN int rpc_nfs3_getattr_async(struct rpc_context *rpc, rpc_cb cb, struct GETATTR3args *args, void *private_data);
+EXTERN int rpc_nfs_getattr_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data);
/*
- * Call NFS/PATHCONF
+ * Call NFS3/PATHCONF
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nfs_pathconf_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data);
+struct PATHCONF3args;
+EXTERN int rpc_nfs3_pathconf_async(struct rpc_context *rpc, rpc_cb cb, struct PATHCONF3args *args, void *private_data);
+EXTERN int rpc_nfs_pathconf_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data);
/*
- * Call NFS/LOOKUP
+ * Call NFS3/LOOKUP
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nfs_lookup_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *name, void *private_data);
+struct LOOKUP3args;
+EXTERN int rpc_nfs3_lookup_async(struct rpc_context *rpc, rpc_cb cb, struct LOOKUP3args *args, void *private_data);
+EXTERN int rpc_nfs_lookup_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *name, void *private_data);
/*
- * Call NFS/ACCESS
+ * Call NFS3/ACCESS
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nfs_access_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, int access, void *private_data);
+struct ACCESS3args;
+EXTERN int rpc_nfs3_access_async(struct rpc_context *rpc, rpc_cb cb, struct ACCESS3args *args, void *private_data);
+EXTERN int rpc_nfs_access_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, int access, void *private_data);
/*
- * Call NFS/READ
+ * Call NFS3/READ
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nfs_read_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t offset, uint64_t count, void *private_data);
+struct READ3args;
+EXTERN int rpc_nfs3_read_async(struct rpc_context *rpc, rpc_cb cb, struct READ3args *args, void *private_data);
+EXTERN int rpc_nfs_read_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t offset, uint64_t count, void *private_data);
/*
- * Call NFS/WRITE
+ * Call NFS3/WRITE
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nfs_write_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *buf, uint64_t offset, uint64_t count, int stable_how, void *private_data);
+struct WRITE3args;
+EXTERN int rpc_nfs3_write_async(struct rpc_context *rpc, rpc_cb cb, struct WRITE3args *args, void *private_data);
+EXTERN int rpc_nfs_write_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *buf, uint64_t offset, uint64_t count, int stable_how, void *private_data);
/*
- * Call NFS/COMMIT
+ * Call NFS3/COMMIT
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nfs_commit_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data);
-
+struct COMMIT3args;
+EXTERN int rpc_nfs3_commit_async(struct rpc_context *rpc, rpc_cb cb, struct COMMIT3args *args, void *private_data);
+EXTERN int rpc_nfs_commit_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data);
/*
- * Call NFS/SETATTR
+ * Call NFS3/SETATTR
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
* data is NULL.
*/
struct SETATTR3args;
-int rpc_nfs_setattr_async(struct rpc_context *rpc, rpc_cb cb, struct SETATTR3args *args, void *private_data);
-
-
+EXTERN int rpc_nfs3_setattr_async(struct rpc_context *rpc, rpc_cb cb, struct SETATTR3args *args, void *private_data);
+EXTERN int rpc_nfs_setattr_async(struct rpc_context *rpc, rpc_cb cb, struct SETATTR3args *args, void *private_data);
/*
- * Call NFS/MKDIR
+ * Call NFS3/MKDIR
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
* data is NULL.
*/
struct MKDIR3args;
-int rpc_nfs_mkdir_async(struct rpc_context *rpc, rpc_cb cb, struct MKDIR3args *args, void *private_data);
-
-
-
-
+EXTERN int rpc_nfs3_mkdir_async(struct rpc_context *rpc, rpc_cb cb, struct MKDIR3args *args, void *private_data);
+EXTERN int rpc_nfs_mkdir_async(struct rpc_context *rpc, rpc_cb cb, struct MKDIR3args *args, void *private_data);
/*
- * Call NFS/RMDIR
+ * Call NFS3/RMDIR
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nfs_rmdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *dir, void *private_data);
-
-
-
+struct RMDIR3args;
+EXTERN int rpc_nfs3_rmdir_async(struct rpc_context *rpc, rpc_cb cb, struct RMDIR3args *args, void *private_data);
+EXTERN int rpc_nfs_rmdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *dir, void *private_data);
/*
- * Call NFS/CREATE
+ * Call NFS3/CREATE
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
* data is NULL.
*/
struct CREATE3args;
-int rpc_nfs_create_async(struct rpc_context *rpc, rpc_cb cb, struct CREATE3args *args, void *private_data);
-
+EXTERN int rpc_nfs3_create_async(struct rpc_context *rpc, rpc_cb cb, struct CREATE3args *args, void *private_data);
+EXTERN int rpc_nfs_create_async(struct rpc_context *rpc, rpc_cb cb, struct CREATE3args *args, void *private_data);
/*
- * Call NFS/MKNOD
+ * Call NFS3/MKNOD
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nfs_mknod_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *file, int mode, int major, int minor, void *private_data);
-
+struct MKNOD3args;
+EXTERN int rpc_nfs3_mknod_async(struct rpc_context *rpc, rpc_cb cb, struct MKNOD3args *args, void *private_data);
+EXTERN int rpc_nfs_mknod_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *file, int mode, int major, int minor, void *private_data);
/*
- * Call NFS/REMOVE
+ * Call NFS3/REMOVE
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nfs_remove_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *name, void *private_data);
-
-
+struct REMOVE3args;
+EXTERN int rpc_nfs3_remove_async(struct rpc_context *rpc, rpc_cb cb, struct REMOVE3args *args, void *private_data);
+EXTERN int rpc_nfs_remove_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *name, void *private_data);
/*
- * Call NFS/READDIR
+ * Call NFS3/READDIR
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nfs_readdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t cookie, char *cookieverf, int count, void *private_data);
+struct READDIR3args;
+EXTERN int rpc_nfs3_readdir_async(struct rpc_context *rpc, rpc_cb cb, struct READDIR3args *args, void *private_data);
+EXTERN int rpc_nfs_readdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t cookie, char *cookieverf, int count, void *private_data);
/*
- * Call NFS/READDIRPLUS
+ * Call NFS3/READDIRPLUS
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nfs_readdirplus_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t cookie, char *cookieverf, int count, void *private_data);
+struct READDIRPLUS3args;
+EXTERN int rpc_nfs3_readdirplus_async(struct rpc_context *rpc, rpc_cb cb, struct READDIRPLUS3args *args, void *private_data);
+EXTERN int rpc_nfs_readdirplus_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t cookie, char *cookieverf, int count, void *private_data);
/*
- * Call NFS/FSSTAT
+ * Call NFS3/FSSTAT
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nfs_fsstat_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data);
+struct FSSTAT3args;
+EXTERN int rpc_nfs3_fsstat_async(struct rpc_context *rpc, rpc_cb cb, struct FSSTAT3args *args, void *private_data);
+EXTERN int rpc_nfs_fsstat_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data);
+/*
+ * Call NFS3/FSINFO
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
+ * data is FSINFO3res
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+struct FSINFO3args;
+EXTERN int rpc_nfs3_fsinfo_async(struct rpc_context *rpc, rpc_cb cb, struct FSINFO3args *args, void *private_data);
+EXTERN int rpc_nfs_fsinfo_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data);
+/*
+ * Call NFS3/READLINK
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
+ * data is READLINK3res *
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+struct READLINK3args;
+EXTERN int rpc_nfs3_readlink_async(struct rpc_context *rpc, rpc_cb cb, struct READLINK3args *args, void *private_data);
+EXTERN int rpc_nfs_readlink_async(struct rpc_context *rpc, rpc_cb cb, struct READLINK3args *args, void *private_data);
/*
- * Call NFS/FSINFO
+ * Call NFS3/SYMLINK
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
*
* When the callback is invoked, status indicates the result:
* RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
- * data is FSINFO3res
+ * data is SYMLINK3res *
* RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
* data is the error string.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nfs_fsinfo_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data);
+struct SYMLINK3args;
+EXTERN int rpc_nfs3_symlink_async(struct rpc_context *rpc, rpc_cb cb, struct SYMLINK3args *args, void *private_data);
+EXTERN int rpc_nfs_symlink_async(struct rpc_context *rpc, rpc_cb cb, struct SYMLINK3args *args, void *private_data);
+/*
+ * Call NFS3/RENAME
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
+ * data is RENAME3res *
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+struct RENAME3args;
+EXTERN int rpc_nfs3_rename_async(struct rpc_context *rpc, rpc_cb cb, struct RENAME3args *args, void *private_data);
+EXTERN int rpc_nfs_rename_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *olddir, char *oldname, struct nfs_fh3 *newdir, char *newname, void *private_data);
+/*
+ * Call NFS3/LINK
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
+ * data is LINK3res *
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+struct LINK3args;
+EXTERN int rpc_nfs3_link_async(struct rpc_context *rpc, rpc_cb cb, struct LINK3args *args, void *private_data);
+EXTERN int rpc_nfs_link_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *file, struct nfs_fh3 *newdir, char *newname, void *private_data);
+
+/*
+ * NFS v2 FUNCTIONS
+ */
/*
- * Call NFS/READLINK
+ * Call NFS2/NULL
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
*
* When the callback is invoked, status indicates the result:
* RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
- * data is READLINK3res *
+ * data is NULL.
* RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
* data is the error string.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-struct READLINK3args;
-int rpc_nfs_readlink_async(struct rpc_context *rpc, rpc_cb cb, struct READLINK3args *args, void *private_data);
+EXTERN int rpc_nfs2_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+/*
+ * Call NFS2/GETATTR
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
+ * data is GETATTR2res
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+struct GETATTR2args;
+EXTERN int rpc_nfs2_getattr_async(struct rpc_context *rpc, rpc_cb cb, struct GETATTR2args *args, void *private_data);
+/*
+ * Call NFS2/SETATTR
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
+ * data is SETATTR2res *
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+struct SETATTR2args;
+EXTERN int rpc_nfs2_setattr_async(struct rpc_context *rpc, rpc_cb cb, struct SETATTR2args *args, void *private_data);
/*
- * Call NFS/SYMLINK
+ * Call NFS2/LOOKUP
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
*
* When the callback is invoked, status indicates the result:
* RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
- * data is SYMLINK3res *
+ * data is LOOKUP2res
* RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
* data is the error string.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-struct SYMLINK3args;
-int rpc_nfs_symlink_async(struct rpc_context *rpc, rpc_cb cb, struct SYMLINK3args *args, void *private_data);
+struct LOOKUP2args;
+EXTERN int rpc_nfs2_lookup_async(struct rpc_context *rpc, rpc_cb cb, struct LOOKUP2args *args, void *private_data);
+/*
+ * Call NFS2/READLINK
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
+ * data is READLINK2res *
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+struct READLINK2args;
+EXTERN int rpc_nfs32_readlink_async(struct rpc_context *rpc, rpc_cb cb, struct READLINK2args *args, void *private_data);
/*
- * Call NFS/RENAME
+ * Call NFS2/READ
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
*
* When the callback is invoked, status indicates the result:
* RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
- * data is RENAME3res *
+ * data is READ2res
* RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
* data is the error string.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nfs_rename_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *olddir, char *oldname, struct nfs_fh3 *newdir, char *newname, void *private_data);
+struct READ2args;
+EXTERN int rpc_nfs2_read_async(struct rpc_context *rpc, rpc_cb cb, struct READ2args *args, void *private_data);
+/*
+ * Call NFS2/WRITE
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
+ * data is WRITE2res *
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+struct WRITE2args;
+EXTERN int rpc_nfs2_write_async(struct rpc_context *rpc, rpc_cb cb, struct WRITE2args *args, void *private_data);
+/*
+ * Call NFS2/CREATE
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
+ * data is CREATE2res *
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+struct CREATE2args;
+EXTERN int rpc_nfs2_create_async(struct rpc_context *rpc, rpc_cb cb, struct CREATE2args *args, void *private_data);
/*
- * Call NFS/LINK
+ * Call NFS2/REMOVE
* Function returns
* 0 : The call was initiated. The callback will be invoked when the call completes.
* <0 : An error occured when trying to set up the call. The callback will not be invoked.
*
* When the callback is invoked, status indicates the result:
* RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
- * data is LINK3res *
+ * data is REMOVE2res *
* RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
* data is the error string.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nfs_link_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *file, struct nfs_fh3 *newdir, char *newname, void *private_data);
+struct REMOVE2args;
+EXTERN int rpc_nfs2_remove_async(struct rpc_context *rpc, rpc_cb cb, struct REMOVE2args *args, void *private_data);
+/*
+ * Call NFS2/RENAME
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
+ * data is RENAME2res *
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+struct RENAME2args;
+EXTERN int rpc_nfs2_rename_async(struct rpc_context *rpc, rpc_cb cb, struct RENAME2args *args, void *private_data);
+
+/*
+ * Call NFS2/LINK
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
+ * data is LINK2res *
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+struct LINK2args;
+EXTERN int rpc_nfs2_link_async(struct rpc_context *rpc, rpc_cb cb, struct LINK2args *args, void *private_data);
+
+/*
+ * Call NFS2/SYMLINK
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
+ * data is SYMLINK2res *
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+struct SYMLINK2args;
+EXTERN int rpc_nfs2_symlink_async(struct rpc_context *rpc, rpc_cb cb, struct SYMLINK2args *args, void *private_data);
+
+/*
+ * Call NFS2/MKDIR
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
+ * data is MKDIR2res *
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+struct MKDIR2args;
+EXTERN int rpc_nfs2_mkdir_async(struct rpc_context *rpc, rpc_cb cb, struct MKDIR2args *args, void *private_data);
+/*
+ * Call NFS2/RMDIR
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
+ * data is RMDIR2res *
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+struct RMDIR2args;
+EXTERN int rpc_nfs2_rmdir_async(struct rpc_context *rpc, rpc_cb cb, struct RMDIR2args *args, void *private_data);
+/*
+ * Call NFS2/READDIR
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
+ * data is READDIR2res *
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+struct READDIR2args;
+EXTERN int rpc_nfs2_readdir_async(struct rpc_context *rpc, rpc_cb cb, struct READDIR2args *args, void *private_data);
+
+/*
+ * Call NFS2/STATFS
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon.
+ * data is STATFS2res *
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+struct STATFS2args;
+EXTERN int rpc_nfs2_statfs_async(struct rpc_context *rpc, rpc_cb cb, struct STATFS2args *args, void *private_data);
/*
* RQUOTA FUNCTIONS
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_rquota1_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+EXTERN int rpc_rquota1_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
/*
* Call RQUOTA1/GETQUOTA
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_rquota1_getquota_async(struct rpc_context *rpc, rpc_cb cb, char *export, int uid, void *private_data);
+EXTERN int rpc_rquota1_getquota_async(struct rpc_context *rpc, rpc_cb cb, char *export, int uid, void *private_data);
/*
* Call RQUOTA1/GETACTIVEQUOTA
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_rquota1_getactivequota_async(struct rpc_context *rpc, rpc_cb cb, char *export, int uid, void *private_data);
+EXTERN int rpc_rquota1_getactivequota_async(struct rpc_context *rpc, rpc_cb cb, char *export, int uid, void *private_data);
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nfsacl_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+EXTERN int rpc_nfsacl_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
/*
* Call NFSACL/GETACL
* data is NULL.
*/
struct GETACL3args;
-int rpc_nfsacl_getacl_async(struct rpc_context *rpc, rpc_cb cb, struct GETACL3args *args, void *private_data);
+EXTERN int rpc_nfsacl_getacl_async(struct rpc_context *rpc, rpc_cb cb, struct GETACL3args *args, void *private_data);
* data is NULL.
*/
struct SETACL3args;
-int rpc_nfsacl_setacl_async(struct rpc_context *rpc, rpc_cb cb, struct SETACL3args *args, void *private_data);
+EXTERN int rpc_nfsacl_setacl_async(struct rpc_context *rpc, rpc_cb cb, struct SETACL3args *args, void *private_data);
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nlm4_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+EXTERN int rpc_nlm4_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
/*
* Call NLM/TEST
* data is NULL.
*/
struct NLM4_TESTargs;
-int rpc_nlm4_test_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_TESTargs *args, void *private_data);
+EXTERN int rpc_nlm4_test_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_TESTargs *args, void *private_data);
/*
* Call NLM/LOCK
* data is NULL.
*/
struct NLM4_LOCKargs;
-int rpc_nlm4_lock_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_LOCKargs *args, void *private_data);
+EXTERN int rpc_nlm4_lock_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_LOCKargs *args, void *private_data);
/*
* Call NLM/CANCEL
* data is NULL.
*/
struct NLM4_CANCargs;
-int rpc_nlm4_cancel_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_CANCargs *args, void *private_data);
+EXTERN int rpc_nlm4_cancel_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_CANCargs *args, void *private_data);
/*
* Call NLM/UNLOCK
* data is NULL.
*/
struct NLM4_UNLOCKargs;
-int rpc_nlm4_unlock_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_UNLOCKargs *args, void *private_data);
+EXTERN int rpc_nlm4_unlock_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_UNLOCKargs *args, void *private_data);
/*
* NSM functions
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nsm1_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+EXTERN int rpc_nsm1_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
/*
* Call NSM/STAT
* data is NULL.
*/
struct NSM1_STATargs;
-int rpc_nsm1_stat_async(struct rpc_context *rpc, rpc_cb cb, struct NSM1_STATargs *args, void *private_data);
+EXTERN int rpc_nsm1_stat_async(struct rpc_context *rpc, rpc_cb cb, struct NSM1_STATargs *args, void *private_data);
/*
* Call NSM/MON
* data is NULL.
*/
struct NSM1_MONargs;
-int rpc_nsm1_mon_async(struct rpc_context *rpc, rpc_cb cb, struct NSM1_MONargs *args, void *private_data);
+EXTERN int rpc_nsm1_mon_async(struct rpc_context *rpc, rpc_cb cb, struct NSM1_MONargs *args, void *private_data);
/*
* Call NSM/UNMON
* data is NULL.
*/
struct NSM1_UNMONargs;
-int rpc_nsm1_unmon_async(struct rpc_context *rpc, rpc_cb cb, struct NSM1_UNMONargs *args, void *private_data);
+EXTERN int rpc_nsm1_unmon_async(struct rpc_context *rpc, rpc_cb cb, struct NSM1_UNMONargs *args, void *private_data);
/*
* Call NSM/UNMONALL
* data is NULL.
*/
struct NSM1_UNMONALLargs;
-int rpc_nsm1_unmonall_async(struct rpc_context *rpc, rpc_cb cb, struct NSM1_UNMONALLargs *args, void *private_data);
+EXTERN int rpc_nsm1_unmonall_async(struct rpc_context *rpc, rpc_cb cb, struct NSM1_UNMONALLargs *args, void *private_data);
/*
* Call NSM/SIMUCRASH
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-int rpc_nsm1_simucrash_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+EXTERN int rpc_nsm1_simucrash_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
/*
* Call NSM/NOTIFY
* data is NULL.
*/
struct NSM1_NOTIFYargs;
-int rpc_nsm1_notify_async(struct rpc_context *rpc, rpc_cb cb, struct NSM1_NOTIFYargs *args, void *private_data);
+EXTERN int rpc_nsm1_notify_async(struct rpc_context *rpc, rpc_cb cb, struct NSM1_NOTIFYargs *args, void *private_data);
#endif
memset(rpc, 0, sizeof(struct rpc_context));
rpc->magic = RPC_CONTEXT_MAGIC;
- rpc->encodebuflen = 65536;
+
+ /* Allow 1M of data (for writes) and some */
+ rpc->encodebuflen = 1024 * 1024 + 4096;
rpc->encodebuf = malloc(rpc->encodebuflen);
if (rpc->encodebuf == NULL) {
free(rpc);
nfs_write
nfs_write_async
win32_poll
-rpc_which_events
-rpc_service
-rpc_init_context
-rpc_get_fd
-rpc_get_error
+rpc_connect_async
rpc_destroy_context
-rpc_rquota1_getquota_async
+rpc_disconnect
+rpc_get_error
+rpc_get_fd
+rpc_init_context
rpc_pmap_null_async
rpc_pmap_getport_async
-rpc_nfsacl_null_async
-rpc_nfsacl_getacl_async
+rpc_pmap_set_async
+rpc_pmap_unset_async
+rpc_pmap_callit_async
rpc_mount_null_async
rpc_mount_mnt_async
+rpc_mount_dump_async
+rpc_mount_umnt_async
+rpc_mount_umntall_async
rpc_mount_export_async
-rpc_disconnect
-rpc_connect_async
+rpc_mount1_null_async
+rpc_mount1_mnt_async
+rpc_mount1_dump_async
+rpc_mount1_umnt_async
+rpc_mount1_umntall_async
+rpc_mount1_export_async
+rpc_mount3_null_async
+rpc_mount3_mnt_async
+rpc_mount3_dump_async
+rpc_mount3_umnt_async
+rpc_mount3_umntall_async
+rpc_mount3_export_async
+rpc_nfsacl_null_async
+rpc_nfsacl_getacl_async
+rpc_nfsacl_setacl_async
+rpc_nfs_null_async
+rpc_nfs_getattr_async
+rpc_nfs_pathconf_async
+rpc_nfs_lookup_async
+rpc_nfs_access_async
+rpc_nfs_read_async
+rpc_nfs_write_async
+rpc_nfs_commit_async
+rpc_nfs_setattr_async
+rpc_nfs_mkdir_async
+rpc_nfs_rmdir_async
+rpc_nfs_create_async
+rpc_nfs_mknod_async
+rpc_nfs_remove_async
+rpc_nfs_readdir_async
+rpc_nfs_readdirplus_async
+rpc_nfs_fsstat_async
rpc_nfs_fsinfo_async
+rpc_nfs_readlink_async
+rpc_nfs_symlink_async
+rpc_nfs_rename_async
+rpc_nfs_link_async
+rpc_nfs2_null_async
+rpc_nfs2_getattr_async
+rpc_nfs2_setattr_async
+rpc_nfs2_lookup_async
+rpc_nfs2_readlink_async
+rpc_nfs2_read_async
+rpc_nfs2_write_async
+rpc_nfs2_create_async
+rpc_nfs2_remove_async
+rpc_nfs2_rename_async
+rpc_nfs2_link_async
+rpc_nfs2_symlink_async
+rpc_nfs2_mkdir_async
+rpc_nfs2_rmdir_async
+rpc_nfs2_readdir_async
+rpc_nfs2_statfs_async
+rpc_nfs3_null_async
+rpc_nfs3_getattr_async
+rpc_nfs3_pathconf_async
+rpc_nfs3_lookup_async
+rpc_nfs3_access_async
+rpc_nfs3_read_async
+rpc_nfs3_write_async
+rpc_nfs3_commit_async
+rpc_nfs3_setattr_async
+rpc_nfs3_mkdir_async
+rpc_nfs3_rmdir_async
+rpc_nfs3_create_async
+rpc_nfs3_mknod_async
+rpc_nfs3_remove_async
+rpc_nfs3_readdir_async
+rpc_nfs3_readdirplus_async
+rpc_nfs3_fsstat_async
+rpc_nfs3_fsinfo_async
+rpc_nfs3_readlink_async
+rpc_nfs3_symlink_async
+rpc_nfs3_rename_async
+rpc_nfs3_link_async
+rpc_nlm4_null_async
+rpc_nlm4_test_async
+rpc_nlm4_lock_async
+rpc_nlm4_cancel_async
+rpc_nlm4_unlock_async
+rpc_nsm1_null_async
+rpc_nsm1_stat_async
+rpc_nsm1_mon_async
+rpc_nsm1_unmon_async
+rpc_nsm1_unmonall_async
+rpc_nsm1_simucrash_async
+rpc_nsm1_notify_async
+rpc_rquota1_null_async
+rpc_rquota1_getquota_async
+rpc_rquota1_getactivequota_async
+rpc_service
+rpc_which_events
struct nfs_cb_data *data = private_data;
struct nfs_context *nfs = data->nfs;
FSINFO3res *res = command_data;
+ struct GETATTR3args args;
assert(rpc->magic == RPC_CONTEXT_MAGIC);
nfs->readmax = res->FSINFO3res_u.resok.rtmax;
nfs->writemax = res->FSINFO3res_u.resok.wtmax;
- if (rpc_nfs_getattr_async(rpc, nfs_mount_10_cb, &nfs->rootfh, data) != 0) {
+ memset(&args, 0, sizeof(GETATTR3args));
+ args.object.data.data_len = nfs->rootfh.data.data_len;
+ args.object.data.data_val = nfs->rootfh.data.data_val;
+
+ if (rpc_nfs3_getattr_async(rpc, nfs_mount_10_cb, &args, data) != 0) {
data->cb(-ENOMEM, nfs, command_data, data->private_data);
free_nfs_cb_data(data);
return;
static int nfs_lookup_path_async_internal(struct nfs_context *nfs, struct nfs_cb_data *data, struct nfs_fh3 *fh)
{
char *path, *str;
+ LOOKUP3args args;
while (*data->path == '/') {
data->path++;
return 0;
}
- if (rpc_nfs_lookup_async(nfs->rpc, nfs_lookup_path_1_cb, fh, path, data) != 0) {
+
+ memset(&args, 0, sizeof(LOOKUP3args));
+ args.what.dir.data.data_len = fh->data.data_len;
+ args.what.dir.data.data_val = fh->data.data_val;
+ args.what.name = path;
+
+ if (rpc_nfs3_lookup_async(nfs->rpc, nfs_lookup_path_1_cb, &args, data) != 0) {
rpc_set_error(nfs->rpc, "RPC error: Failed to send lookup call for %s", data->path);
data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
free_nfs_cb_data(data);
static int nfs_stat_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data)
{
- if (rpc_nfs_getattr_async(nfs->rpc, nfs_stat_1_cb, &data->fh, data) != 0) {
+ struct GETATTR3args args;
+
+ memset(&args, 0, sizeof(GETATTR3args));
+ args.object.data.data_len = data->fh.data.data_len;
+ args.object.data.data_val = data->fh.data.data_val;
+
+ if (rpc_nfs3_getattr_async(nfs->rpc, nfs_stat_1_cb, &args, data) != 0) {
rpc_set_error(nfs->rpc, "RPC error: Failed to send STAT GETATTR call for %s", data->path);
data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
free_nfs_cb_data(data);
static int nfs_open_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data)
{
int nfsmode = 0;
+ ACCESS3args args;
if (data->continue_int & O_WRONLY) {
nfsmode |= ACCESS3_MODIFY;
nfsmode |= ACCESS3_READ;
}
- if (rpc_nfs_access_async(nfs->rpc, nfs_open_cb, &data->fh, nfsmode, data) != 0) {
+ memset(&args, 0, sizeof(ACCESS3args));
+ args.object.data.data_len = data->fh.data.data_len;
+ args.object.data.data_val = data->fh.data.data_val;
+ args.access = nfsmode;
+
+ if (rpc_nfs3_access_async(nfs->rpc, nfs_open_cb, &args, data) != 0) {
rpc_set_error(nfs->rpc, "RPC error: Failed to send OPEN ACCESS call for %s", data->path);
data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
free_nfs_cb_data(data);
nfsfh->offset = offset;
if (count <= nfs_get_readmax(nfs)) {
- if (rpc_nfs_read_async(nfs->rpc, nfs_pread_cb, &nfsfh->fh, offset, count, data) != 0) {
+ READ3args args;
+
+ memset(&args, 0, sizeof(READ3args));
+ args.file.data.data_len = nfsfh->fh.data.data_len;
+ args.file.data.data_val = nfsfh->fh.data.data_val;
+ args.offset = offset;
+ args.count = count;
+
+ if (rpc_nfs3_read_async(nfs->rpc, nfs_pread_cb, &args, data) != 0) {
rpc_set_error(nfs->rpc, "RPC error: Failed to send READ call for %s", data->path);
data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
free_nfs_cb_data(data);
while (count > 0) {
uint64_t readcount = count;
struct nfs_mcb_data *mdata;
+ READ3args args;
if (readcount > nfs_get_readmax(nfs)) {
readcount = nfs_get_readmax(nfs);
mdata->data = data;
mdata->offset = offset;
mdata->count = readcount;
- if (rpc_nfs_read_async(nfs->rpc, nfs_pread_mcb, &nfsfh->fh, offset, readcount, mdata) != 0) {
+
+ memset(&args, 0, sizeof(READ3args));
+ args.file.data.data_len = nfsfh->fh.data.data_len;
+ args.file.data.data_val = nfsfh->fh.data.data_val;
+ args.offset = offset;
+ args.count = readcount;
+
+ if (rpc_nfs3_read_async(nfs->rpc, nfs_pread_mcb, &args, mdata) != 0) {
rpc_set_error(nfs->rpc, "RPC error: Failed to send READ call for %s", data->path);
data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
free(mdata);
nfsfh->offset = offset;
if (count <= nfs_get_writemax(nfs)) {
- if (rpc_nfs_write_async(nfs->rpc, nfs_pwrite_cb, &nfsfh->fh, buf, offset, count, nfsfh->is_sync?FILE_SYNC:UNSTABLE, data) != 0) {
+ WRITE3args args;
+
+ memset(&args, 0, sizeof(WRITE3args));
+ args.file.data.data_len = nfsfh->fh.data.data_len;
+ args.file.data.data_val = nfsfh->fh.data.data_val;
+ args.offset = offset;
+ args.count = count;
+ args.stable = nfsfh->is_sync?FILE_SYNC:UNSTABLE;
+ args.data.data_len = count;
+ args.data.data_val = buf;
+
+ if (rpc_nfs3_write_async(nfs->rpc, nfs_pwrite_cb, &args, data) != 0) {
rpc_set_error(nfs->rpc, "RPC error: Failed to send WRITE call for %s", data->path);
data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
free_nfs_cb_data(data);
while (count > 0) {
uint64_t writecount = count;
struct nfs_mcb_data *mdata;
+ WRITE3args args;
if (writecount > nfs_get_writemax(nfs)) {
writecount = nfs_get_writemax(nfs);
mdata->offset = offset;
mdata->count = writecount;
- if (rpc_nfs_write_async(nfs->rpc, nfs_pwrite_mcb, &nfsfh->fh, &buf[offset - data->start_offset], offset, writecount, nfsfh->is_sync?FILE_SYNC:UNSTABLE, mdata) != 0) {
+ memset(&args, 0, sizeof(WRITE3args));
+ args.file.data.data_len = nfsfh->fh.data.data_len;
+ args.file.data.data_val = nfsfh->fh.data.data_val;
+ args.offset = offset;
+ args.count = writecount;
+ args.stable = nfsfh->is_sync?FILE_SYNC:UNSTABLE;
+ args.data.data_len = writecount;
+ args.data.data_val = &buf[offset - data->start_offset];
+
+ if (rpc_nfs3_write_async(nfs->rpc, nfs_pwrite_mcb, &args, mdata) != 0) {
rpc_set_error(nfs->rpc, "RPC error: Failed to send WRITE call for %s", data->path);
data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
free(mdata);
int nfs_fstat_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb, void *private_data)
{
struct nfs_cb_data *data;
+ struct GETATTR3args args;
data = malloc(sizeof(struct nfs_cb_data));
if (data == NULL) {
data->cb = cb;
data->private_data = private_data;
- if (rpc_nfs_getattr_async(nfs->rpc, nfs_stat_1_cb, &nfsfh->fh, data) != 0) {
+ memset(&args, 0, sizeof(GETATTR3args));
+ args.object.data.data_len = nfsfh->fh.data.data_len;
+ args.object.data.data_val = nfsfh->fh.data.data_val;
+
+ if (rpc_nfs3_getattr_async(nfs->rpc, nfs_stat_1_cb, &args, data) != 0) {
rpc_set_error(nfs->rpc, "RPC error: Failed to send STAT GETATTR call for %s", data->path);
data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
free_nfs_cb_data(data);
struct nfs_cb_data *data = private_data;
struct nfs_context *nfs = data->nfs;
char *str = data->continue_data;
+ LOOKUP3args args;
assert(rpc->magic == RPC_CONTEXT_MAGIC);
return;
}
- if (rpc_nfs_lookup_async(nfs->rpc, nfs_create_2_cb, &data->fh, str, data) != 0) {
+ memset(&args, 0, sizeof(LOOKUP3args));
+ args.what.dir.data.data_len = data->fh.data.data_len;
+ args.what.dir.data.data_val = data->fh.data.data_val;
+ args.what.name = str;
+
+ if (rpc_nfs3_lookup_async(nfs->rpc, nfs_create_2_cb, &args, data) != 0) {
rpc_set_error(nfs->rpc, "RPC error: Failed to send lookup call for %s/%s", data->saved_path, str);
data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
free_nfs_cb_data(data);
rdpe_cb_data->data = data;
for (nfsdirent = nfsdir->entries; nfsdirent; nfsdirent = nfsdirent->next) {
struct rdpe_lookup_cb_data *rdpe_lookup_cb_data;
+ LOOKUP3args args;
rdpe_lookup_cb_data = malloc(sizeof(struct rdpe_lookup_cb_data));
rdpe_lookup_cb_data->rdpe_cb_data = rdpe_cb_data;
rdpe_lookup_cb_data->nfsdirent = nfsdirent;
- if (rpc_nfs_lookup_async(nfs->rpc, nfs_opendir3_cb, &data->fh, nfsdirent->name, rdpe_lookup_cb_data) != 0) {
+ memset(&args, 0, sizeof(LOOKUP3args));
+ args.what.dir.data.data_len = data->fh.data.data_len;
+ args.what.dir.data.data_val = data->fh.data.data_val;
+ args.what.name = nfsdirent->name;
+
+ if (rpc_nfs3_lookup_async(nfs->rpc, nfs_opendir3_cb, &args, rdpe_lookup_cb_data) != 0) {
rpc_set_error(nfs->rpc, "RPC error: Failed to send READDIR LOOKUP call");
/* if we have already commands in flight, we cant just stop, we have to wait for the
int nfs_lseek_async(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, int whence, nfs_cb cb, void *private_data)
{
struct lseek_cb_data *data;
+ struct GETATTR3args args;
if (whence == SEEK_SET) {
nfsfh->offset = offset;
data->cb = cb;
data->private_data = private_data;
- if (rpc_nfs_getattr_async(nfs->rpc, nfs_lseek_1_cb, &nfsfh->fh, data) != 0) {
+ memset(&args, 0, sizeof(GETATTR3args));
+ args.object.data.data_len = nfsfh->fh.data.data_len;
+ args.object.data.data_val = nfsfh->fh.data.data_val;
+
+ if (rpc_nfs3_getattr_async(nfs->rpc, nfs_lseek_1_cb, &args, data) != 0) {
rpc_set_error(nfs->rpc, "RPC error: Failed to send LSEEK GETATTR call");
free(data);
return -1;
static int nfs_access_continue_internal(struct nfs_context *nfs, struct nfs_cb_data *data)
{
int nfsmode = 0;
+ ACCESS3args args;
if (data->continue_int & R_OK) {
nfsmode |= ACCESS3_READ;
nfsmode |= ACCESS3_EXECUTE;
}
- if (rpc_nfs_access_async(nfs->rpc, nfs_access_cb, &data->fh, nfsmode, data) != 0) {
+ memset(&args, 0, sizeof(ACCESS3args));
+ args.object.data.data_len = data->fh.data.data_len;
+ args.object.data.data_val = data->fh.data.data_val;
+ args.access = nfsmode;
+
+ if (rpc_nfs3_access_async(nfs->rpc, nfs_access_cb, &args, data) != 0) {
rpc_set_error(nfs->rpc, "RPC error: Failed to send OPEN ACCESS call for %s", data->path);
data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
free_nfs_cb_data(data);
#include "libnfs-private.h"
#include "libnfs-raw-mount.h"
-int rpc_mount_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
+int rpc_mount3_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
{
struct rpc_pdu *pdu;
return 0;
}
-int rpc_mount_mnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data)
+int rpc_mount_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
+{
+ return rpc_mount3_null_async(rpc, cb, private_data);
+}
+
+int rpc_mount3_mnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data)
{
struct rpc_pdu *pdu;
return 0;
}
-int rpc_mount_dump_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
+int rpc_mount_mnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data)
+{
+ return rpc_mount3_mnt_async(rpc, cb, export, private_data);
+}
+
+int rpc_mount3_dump_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
{
struct rpc_pdu *pdu;
return 0;
}
-int rpc_mount_umnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data)
+int rpc_mount_dump_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
+{
+ return rpc_mount_dump_async(rpc, cb, private_data);
+}
+
+int rpc_mount3_umnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data)
{
struct rpc_pdu *pdu;
return 0;
}
-int rpc_mount_umntall_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
+int rpc_mount_umnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data)
+{
+ return rpc_mount3_umnt_async(rpc, cb, export, private_data);
+}
+
+int rpc_mount3_umntall_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
{
struct rpc_pdu *pdu;
return 0;
}
-int rpc_mount_export_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
+int rpc_mount_umntall_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
+{
+ return rpc_mount_umntall_async(rpc, cb, private_data);
+}
+
+int rpc_mount3_export_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
{
struct rpc_pdu *pdu;
return 0;
}
+int rpc_mount_export_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
+{
+ return rpc_mount_export_async(rpc, cb, private_data);
+}
+
char *mountstat3_to_str(int st)
{
enum mountstat3 stat = st;
return -ERANGE;
}
+int rpc_mount1_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, MOUNT_PROGRAM, MOUNT_V1, MOUNT1_NULL, cb, private_data, (zdrproc_t)zdr_void, 0);
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for MOUNT1/NULL call");
+ return -1;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for MOUNT1/NULL call");
+ rpc_free_pdu(rpc, pdu);
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_mount1_mnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, MOUNT_PROGRAM, MOUNT_V1, MOUNT1_MNT, cb, private_data, (zdrproc_t)zdr_mountres1, sizeof(mountres1));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for MOUNT1/MNT call");
+ return -1;
+ }
+
+ if (zdr_dirpath(&pdu->zdr, &export) == 0) {
+ rpc_set_error(rpc, "ZDR error. Failed to encode MOUNT1/MNT call");
+ rpc_free_pdu(rpc, pdu);
+ return -1;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for MOUNT1/MNT call");
+ rpc_free_pdu(rpc, pdu);
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_mount1_dump_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, MOUNT_PROGRAM, MOUNT_V1, MOUNT1_DUMP, cb, private_data, (zdrproc_t)zdr_mountlist, sizeof(mountlist));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Failed to allocate pdu for MOUNT1/DUMP");
+ return -1;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Failed to queue MOUNT1/DUMP pdu");
+ rpc_free_pdu(rpc, pdu);
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_mount1_umnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, MOUNT_PROGRAM, MOUNT_V1, MOUNT1_UMNT, cb, private_data, (zdrproc_t)zdr_void, 0);
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Failed to allocate pdu for MOUNT1/UMNT");
+ return -1;
+ }
+
+ if (zdr_dirpath(&pdu->zdr, &export) == 0) {
+ rpc_set_error(rpc, "failed to encode dirpath for MOUNT1/UMNT");
+ rpc_free_pdu(rpc, pdu);
+ return -1;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Failed to queue MOUNT1/UMNT pdu");
+ rpc_free_pdu(rpc, pdu);
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_mount1_umntall_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, MOUNT_PROGRAM, MOUNT_V1, MOUNT1_UMNTALL, cb, private_data, (zdrproc_t)zdr_void, 0);
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Failed to allocate pdu for MOUNT1/UMNTALL");
+ return -1;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Failed to queue MOUNT1/UMNTALL pdu");
+ rpc_free_pdu(rpc, pdu);
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_mount1_export_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, MOUNT_PROGRAM, MOUNT_V1, MOUNT1_EXPORT, cb, private_data, (zdrproc_t)zdr_exports, sizeof(exports));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Failed to allocate pdu for MOUNT1/EXPORT");
+ return -1;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Failed to queue MOUNT1/EXPORT pdu");
+ rpc_free_pdu(rpc, pdu);
+ return -1;
+ }
+ return 0;
+}
touch nfs-stamp
compile_rpc:
- rpcgen -h nfs.x | sed -e "s/#include <rpc\/rpc.h>//" | sed -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" > libnfs-raw-nfs.h
+ rpcgen -h nfs.x | sed -e "s/#include <rpc\/rpc.h>//" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" -e "s/#define _NFS_H_RPCGEN/#define _NFS_H_RPCGEN\n#include <nfsc\/libnfs-zdr.h>/g" -e "s/#define NFS3_COOKIEVERFSIZE 8/#define NFS3_COOKIEVERFSIZE 8\n\n#if defined(ANDROID)\ntypedef long long int quad_t;\ntypedef long long unsigned u_quad_t;\n#endif\n#if defined(WIN32)\ntypedef long long int quad_t;\ntypedef long long unsigned u_quad_t;\n#endif/g" > libnfs-raw-nfs.h
rpcgen -c nfs.x | sed -e "s/#include \".*nfs.h\"/#include \"libnfs-xdr.h\"\n#include \"libnfs-raw-nfs.h\"/" -e "s/xdr/zdr/g" -e "s/XDR/ZDR/g" -e "s/register int32_t \*buf;/register int32_t *buf;\n buf = NULL;/" > libnfs-raw-nfs.c
register int32_t *buf;
buf = NULL;
- if (!zdr_bool (zdrs, &objp->set_it))
+ if (!zdr_bool (zdrs, &objp->set_it))
return FALSE;
switch (objp->set_it) {
case TRUE:
return TRUE;
}
+bool_t
+zdr_fhandle2 (ZDR *zdrs, fhandle2 objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_opaque (zdrs, objp, FHSIZE2))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_ftype2 (ZDR *zdrs, ftype2 *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_enum (zdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_fattr2 (ZDR *zdrs, fattr2 *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+
+ if (zdrs->x_op == ZDR_ENCODE) {
+ if (!zdr_ftype2 (zdrs, &objp->type))
+ return FALSE;
+ buf = ZDR_INLINE (zdrs, 10 * BYTES_PER_ZDR_UNIT);
+ if (buf == NULL) {
+ if (!zdr_u_int (zdrs, &objp->mode))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->nlink))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->uid))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->gid))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->size))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->blocksize))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->rdev))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->blocks))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->fsid))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->fileid))
+ return FALSE;
+
+ } else {
+ IZDR_PUT_U_LONG(buf, objp->mode);
+ IZDR_PUT_U_LONG(buf, objp->nlink);
+ IZDR_PUT_U_LONG(buf, objp->uid);
+ IZDR_PUT_U_LONG(buf, objp->gid);
+ IZDR_PUT_U_LONG(buf, objp->size);
+ IZDR_PUT_U_LONG(buf, objp->blocksize);
+ IZDR_PUT_U_LONG(buf, objp->rdev);
+ IZDR_PUT_U_LONG(buf, objp->blocks);
+ IZDR_PUT_U_LONG(buf, objp->fsid);
+ IZDR_PUT_U_LONG(buf, objp->fileid);
+ }
+ if (!zdr_nfstime3 (zdrs, &objp->atime))
+ return FALSE;
+ if (!zdr_nfstime3 (zdrs, &objp->mtime))
+ return FALSE;
+ if (!zdr_nfstime3 (zdrs, &objp->ctime))
+ return FALSE;
+ return TRUE;
+ } else if (zdrs->x_op == ZDR_DECODE) {
+ if (!zdr_ftype2 (zdrs, &objp->type))
+ return FALSE;
+ buf = ZDR_INLINE (zdrs, 10 * BYTES_PER_ZDR_UNIT);
+ if (buf == NULL) {
+ if (!zdr_u_int (zdrs, &objp->mode))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->nlink))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->uid))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->gid))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->size))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->blocksize))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->rdev))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->blocks))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->fsid))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->fileid))
+ return FALSE;
+
+ } else {
+ objp->mode = IZDR_GET_U_LONG(buf);
+ objp->nlink = IZDR_GET_U_LONG(buf);
+ objp->uid = IZDR_GET_U_LONG(buf);
+ objp->gid = IZDR_GET_U_LONG(buf);
+ objp->size = IZDR_GET_U_LONG(buf);
+ objp->blocksize = IZDR_GET_U_LONG(buf);
+ objp->rdev = IZDR_GET_U_LONG(buf);
+ objp->blocks = IZDR_GET_U_LONG(buf);
+ objp->fsid = IZDR_GET_U_LONG(buf);
+ objp->fileid = IZDR_GET_U_LONG(buf);
+ }
+ if (!zdr_nfstime3 (zdrs, &objp->atime))
+ return FALSE;
+ if (!zdr_nfstime3 (zdrs, &objp->mtime))
+ return FALSE;
+ if (!zdr_nfstime3 (zdrs, &objp->ctime))
+ return FALSE;
+ return TRUE;
+ }
+
+ if (!zdr_ftype2 (zdrs, &objp->type))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->mode))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->nlink))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->uid))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->gid))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->size))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->blocksize))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->rdev))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->blocks))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->fsid))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->fileid))
+ return FALSE;
+ if (!zdr_nfstime3 (zdrs, &objp->atime))
+ return FALSE;
+ if (!zdr_nfstime3 (zdrs, &objp->mtime))
+ return FALSE;
+ if (!zdr_nfstime3 (zdrs, &objp->ctime))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_sattr2 (ZDR *zdrs, sattr2 *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+
+ if (zdrs->x_op == ZDR_ENCODE) {
+ buf = ZDR_INLINE (zdrs, 4 * BYTES_PER_ZDR_UNIT);
+ if (buf == NULL) {
+ if (!zdr_u_int (zdrs, &objp->mode))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->uid))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->gid))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->size))
+ return FALSE;
+
+ } else {
+ IZDR_PUT_U_LONG(buf, objp->mode);
+ IZDR_PUT_U_LONG(buf, objp->uid);
+ IZDR_PUT_U_LONG(buf, objp->gid);
+ IZDR_PUT_U_LONG(buf, objp->size);
+ }
+ if (!zdr_nfstime3 (zdrs, &objp->atime))
+ return FALSE;
+ if (!zdr_nfstime3 (zdrs, &objp->mtime))
+ return FALSE;
+ return TRUE;
+ } else if (zdrs->x_op == ZDR_DECODE) {
+ buf = ZDR_INLINE (zdrs, 4 * BYTES_PER_ZDR_UNIT);
+ if (buf == NULL) {
+ if (!zdr_u_int (zdrs, &objp->mode))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->uid))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->gid))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->size))
+ return FALSE;
+
+ } else {
+ objp->mode = IZDR_GET_U_LONG(buf);
+ objp->uid = IZDR_GET_U_LONG(buf);
+ objp->gid = IZDR_GET_U_LONG(buf);
+ objp->size = IZDR_GET_U_LONG(buf);
+ }
+ if (!zdr_nfstime3 (zdrs, &objp->atime))
+ return FALSE;
+ if (!zdr_nfstime3 (zdrs, &objp->mtime))
+ return FALSE;
+ return TRUE;
+ }
+
+ if (!zdr_u_int (zdrs, &objp->mode))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->uid))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->gid))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->size))
+ return FALSE;
+ if (!zdr_nfstime3 (zdrs, &objp->atime))
+ return FALSE;
+ if (!zdr_nfstime3 (zdrs, &objp->mtime))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_filename2 (ZDR *zdrs, filename2 *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_string (zdrs, objp, MAXNAMLEN2))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_path2 (ZDR *zdrs, path2 *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_string (zdrs, objp, MAXPATHLEN2))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_nfsdata2 (ZDR *zdrs, nfsdata2 *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_bytes (zdrs, (char **)&objp->nfsdata2_val, (u_int *) &objp->nfsdata2_len, NFSMAXDATA2))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_nfscookie2 (ZDR *zdrs, nfscookie2 objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_opaque (zdrs, objp, NFSCOOKIESIZE2))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_entry2 (ZDR *zdrs, entry2 *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_u_int (zdrs, &objp->fileid))
+ return FALSE;
+ if (!zdr_filename2 (zdrs, &objp->name))
+ return FALSE;
+ if (!zdr_nfscookie2 (zdrs, objp->cookie))
+ return FALSE;
+ if (!zdr_pointer (zdrs, (char **)&objp->nextentry, sizeof (entry2), (zdrproc_t) zdr_entry2))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_diropargs2 (ZDR *zdrs, diropargs2 *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_fhandle2 (zdrs, objp->dir))
+ return FALSE;
+ if (!zdr_filename2 (zdrs, &objp->name))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_GETATTR2args (ZDR *zdrs, GETATTR2args *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_fhandle2 (zdrs, objp->fhandle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_GETATTR2resok (ZDR *zdrs, GETATTR2resok *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_fattr2 (zdrs, &objp->attributes))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_GETATTR2res (ZDR *zdrs, GETATTR2res *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_nfsstat3 (zdrs, &objp->status))
+ return FALSE;
+ switch (objp->status) {
+ case NFS3_OK:
+ if (!zdr_GETATTR2resok (zdrs, &objp->GETATTR2res_u.resok))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+zdr_SETATTR2args (ZDR *zdrs, SETATTR2args *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_fhandle2 (zdrs, objp->fhandle))
+ return FALSE;
+ if (!zdr_sattr2 (zdrs, &objp->attributes))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_SETATTR2resok (ZDR *zdrs, SETATTR2resok *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_fattr2 (zdrs, &objp->attributes))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_SETATTR2res (ZDR *zdrs, SETATTR2res *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_nfsstat3 (zdrs, &objp->status))
+ return FALSE;
+ switch (objp->status) {
+ case NFS3_OK:
+ if (!zdr_SETATTR2resok (zdrs, &objp->SETATTR2res_u.resok))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+zdr_LOOKUP2args (ZDR *zdrs, LOOKUP2args *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_diropargs2 (zdrs, &objp->what))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_LOOKUP2resok (ZDR *zdrs, LOOKUP2resok *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_fhandle2 (zdrs, objp->file))
+ return FALSE;
+ if (!zdr_fattr2 (zdrs, &objp->attributes))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_LOOKUP2res (ZDR *zdrs, LOOKUP2res *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_nfsstat3 (zdrs, &objp->status))
+ return FALSE;
+ switch (objp->status) {
+ case NFS3_OK:
+ if (!zdr_LOOKUP2resok (zdrs, &objp->LOOKUP2res_u.resok))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+zdr_READLINK2args (ZDR *zdrs, READLINK2args *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_fhandle2 (zdrs, objp->file))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_READLINK2resok (ZDR *zdrs, READLINK2resok *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_path2 (zdrs, &objp->data))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_READLINK2res (ZDR *zdrs, READLINK2res *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_nfsstat3 (zdrs, &objp->status))
+ return FALSE;
+ switch (objp->status) {
+ case NFS3_OK:
+ if (!zdr_READLINK2resok (zdrs, &objp->READLINK2res_u.resok))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+zdr_READ2args (ZDR *zdrs, READ2args *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_fhandle2 (zdrs, objp->file))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->offset))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->count))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->totalcount))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_READ2resok (ZDR *zdrs, READ2resok *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_fattr2 (zdrs, &objp->attributes))
+ return FALSE;
+ if (!zdr_nfsdata2 (zdrs, &objp->data))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_READ2res (ZDR *zdrs, READ2res *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_nfsstat3 (zdrs, &objp->status))
+ return FALSE;
+ switch (objp->status) {
+ case NFS3_OK:
+ if (!zdr_READ2resok (zdrs, &objp->READ2res_u.resok))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+zdr_WRITE2args (ZDR *zdrs, WRITE2args *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+
+ if (zdrs->x_op == ZDR_ENCODE) {
+ if (!zdr_fhandle2 (zdrs, objp->file))
+ return FALSE;
+ buf = ZDR_INLINE (zdrs, 3 * BYTES_PER_ZDR_UNIT);
+ if (buf == NULL) {
+ if (!zdr_u_int (zdrs, &objp->beginoffset))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->offset))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->totalcount))
+ return FALSE;
+
+ } else {
+ IZDR_PUT_U_LONG(buf, objp->beginoffset);
+ IZDR_PUT_U_LONG(buf, objp->offset);
+ IZDR_PUT_U_LONG(buf, objp->totalcount);
+ }
+ if (!zdr_nfsdata2 (zdrs, &objp->data))
+ return FALSE;
+ return TRUE;
+ } else if (zdrs->x_op == ZDR_DECODE) {
+ if (!zdr_fhandle2 (zdrs, objp->file))
+ return FALSE;
+ buf = ZDR_INLINE (zdrs, 3 * BYTES_PER_ZDR_UNIT);
+ if (buf == NULL) {
+ if (!zdr_u_int (zdrs, &objp->beginoffset))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->offset))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->totalcount))
+ return FALSE;
+
+ } else {
+ objp->beginoffset = IZDR_GET_U_LONG(buf);
+ objp->offset = IZDR_GET_U_LONG(buf);
+ objp->totalcount = IZDR_GET_U_LONG(buf);
+ }
+ if (!zdr_nfsdata2 (zdrs, &objp->data))
+ return FALSE;
+ return TRUE;
+ }
+
+ if (!zdr_fhandle2 (zdrs, objp->file))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->beginoffset))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->offset))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->totalcount))
+ return FALSE;
+ if (!zdr_nfsdata2 (zdrs, &objp->data))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_WRITE2resok (ZDR *zdrs, WRITE2resok *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_fattr2 (zdrs, &objp->attributes))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_WRITE2res (ZDR *zdrs, WRITE2res *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_nfsstat3 (zdrs, &objp->status))
+ return FALSE;
+ switch (objp->status) {
+ case NFS3_OK:
+ if (!zdr_WRITE2resok (zdrs, &objp->WRITE2res_u.resok))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+zdr_CREATE2args (ZDR *zdrs, CREATE2args *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_diropargs2 (zdrs, &objp->where))
+ return FALSE;
+ if (!zdr_sattr2 (zdrs, &objp->attributes))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_CREATE2resok (ZDR *zdrs, CREATE2resok *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_fhandle2 (zdrs, objp->file))
+ return FALSE;
+ if (!zdr_fattr2 (zdrs, &objp->attributes))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_CREATE2res (ZDR *zdrs, CREATE2res *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_nfsstat3 (zdrs, &objp->status))
+ return FALSE;
+ switch (objp->status) {
+ case NFS3_OK:
+ if (!zdr_CREATE2resok (zdrs, &objp->CREATE2res_u.resok))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+zdr_REMOVE2args (ZDR *zdrs, REMOVE2args *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_diropargs2 (zdrs, &objp->what))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_REMOVE2res (ZDR *zdrs, REMOVE2res *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_nfsstat3 (zdrs, &objp->status))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_RENAME2args (ZDR *zdrs, RENAME2args *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_diropargs2 (zdrs, &objp->from))
+ return FALSE;
+ if (!zdr_diropargs2 (zdrs, &objp->to))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_RENAME2res (ZDR *zdrs, RENAME2res *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_nfsstat3 (zdrs, &objp->status))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_LINK2args (ZDR *zdrs, LINK2args *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_fhandle2 (zdrs, objp->from))
+ return FALSE;
+ if (!zdr_diropargs2 (zdrs, &objp->to))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_LINK2res (ZDR *zdrs, LINK2res *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_nfsstat3 (zdrs, &objp->status))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_SYMLINK2args (ZDR *zdrs, SYMLINK2args *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_diropargs2 (zdrs, &objp->from))
+ return FALSE;
+ if (!zdr_path2 (zdrs, &objp->to))
+ return FALSE;
+ if (!zdr_sattr2 (zdrs, &objp->attributes))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_SYMLINK2res (ZDR *zdrs, SYMLINK2res *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_nfsstat3 (zdrs, &objp->status))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_MKDIR2args (ZDR *zdrs, MKDIR2args *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_diropargs2 (zdrs, &objp->where))
+ return FALSE;
+ if (!zdr_sattr2 (zdrs, &objp->attributes))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_MKDIR2resok (ZDR *zdrs, MKDIR2resok *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_fhandle2 (zdrs, objp->file))
+ return FALSE;
+ if (!zdr_fattr2 (zdrs, &objp->attributes))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_MKDIR2res (ZDR *zdrs, MKDIR2res *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_nfsstat3 (zdrs, &objp->status))
+ return FALSE;
+ switch (objp->status) {
+ case NFS3_OK:
+ if (!zdr_MKDIR2resok (zdrs, &objp->MKDIR2res_u.resok))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+zdr_RMDIR2args (ZDR *zdrs, RMDIR2args *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_diropargs2 (zdrs, &objp->what))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_RMDIR2res (ZDR *zdrs, RMDIR2res *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_nfsstat3 (zdrs, &objp->status))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_READDIR2args (ZDR *zdrs, READDIR2args *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_fhandle2 (zdrs, objp->dir))
+ return FALSE;
+ if (!zdr_nfscookie2 (zdrs, objp->cookie))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->count))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_READDIR2resok (ZDR *zdrs, READDIR2resok *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_pointer (zdrs, (char **)&objp->entries, sizeof (entry2), (zdrproc_t) zdr_entry2))
+ return FALSE;
+ if (!zdr_bool (zdrs, &objp->eof))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_READDIR2res (ZDR *zdrs, READDIR2res *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_nfsstat3 (zdrs, &objp->status))
+ return FALSE;
+ switch (objp->status) {
+ case NFS3_OK:
+ if (!zdr_READDIR2resok (zdrs, &objp->READDIR2res_u.resok))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+zdr_STATFS2args (ZDR *zdrs, STATFS2args *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_fhandle2 (zdrs, objp->dir))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_STATFS2resok (ZDR *zdrs, STATFS2resok *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+
+ if (zdrs->x_op == ZDR_ENCODE) {
+ buf = ZDR_INLINE (zdrs, 5 * BYTES_PER_ZDR_UNIT);
+ if (buf == NULL) {
+ if (!zdr_u_int (zdrs, &objp->tsize))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->bsize))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->blocks))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->bfree))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->bavail))
+ return FALSE;
+ } else {
+ IZDR_PUT_U_LONG(buf, objp->tsize);
+ IZDR_PUT_U_LONG(buf, objp->bsize);
+ IZDR_PUT_U_LONG(buf, objp->blocks);
+ IZDR_PUT_U_LONG(buf, objp->bfree);
+ IZDR_PUT_U_LONG(buf, objp->bavail);
+ }
+ return TRUE;
+ } else if (zdrs->x_op == ZDR_DECODE) {
+ buf = ZDR_INLINE (zdrs, 5 * BYTES_PER_ZDR_UNIT);
+ if (buf == NULL) {
+ if (!zdr_u_int (zdrs, &objp->tsize))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->bsize))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->blocks))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->bfree))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->bavail))
+ return FALSE;
+ } else {
+ objp->tsize = IZDR_GET_U_LONG(buf);
+ objp->bsize = IZDR_GET_U_LONG(buf);
+ objp->blocks = IZDR_GET_U_LONG(buf);
+ objp->bfree = IZDR_GET_U_LONG(buf);
+ objp->bavail = IZDR_GET_U_LONG(buf);
+ }
+ return TRUE;
+ }
+
+ if (!zdr_u_int (zdrs, &objp->tsize))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->bsize))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->blocks))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->bfree))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->bavail))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_STATFS2res (ZDR *zdrs, STATFS2res *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_nfsstat3 (zdrs, &objp->status))
+ return FALSE;
+ switch (objp->status) {
+ case NFS3_OK:
+ if (!zdr_STATFS2resok (zdrs, &objp->STATFS2res_u.resok))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
bool_t
zdr_nfsacl_type (ZDR *zdrs, nfsacl_type *objp)
{
#ifndef _NFS_H_RPCGEN
#define _NFS_H_RPCGEN
-
#include <nfsc/libnfs-zdr.h>
+
+
+
#ifdef __cplusplus
extern "C" {
#endif
} SETATTR3res_u;
};
typedef struct SETATTR3res SETATTR3res;
+#define FHSIZE2 32
+
+typedef char fhandle2[FHSIZE2];
+
+enum ftype2 {
+ NF2NON = 0,
+ NF2REG = 1,
+ NF2DIR = 2,
+ NF2BLK = 3,
+ NF2CHR = 4,
+ NF2LNK = 5,
+};
+typedef enum ftype2 ftype2;
+
+struct fattr2 {
+ ftype2 type;
+ u_int mode;
+ u_int nlink;
+ u_int uid;
+ u_int gid;
+ u_int size;
+ u_int blocksize;
+ u_int rdev;
+ u_int blocks;
+ u_int fsid;
+ u_int fileid;
+ nfstime3 atime;
+ nfstime3 mtime;
+ nfstime3 ctime;
+};
+typedef struct fattr2 fattr2;
+
+struct sattr2 {
+ u_int mode;
+ u_int uid;
+ u_int gid;
+ u_int size;
+ nfstime3 atime;
+ nfstime3 mtime;
+};
+typedef struct sattr2 sattr2;
+#define MAXNAMLEN2 255
+
+typedef char *filename2;
+#define MAXPATHLEN2 1024
+
+typedef char *path2;
+#define NFSMAXDATA2 8192
+
+typedef struct {
+ u_int nfsdata2_len;
+ char *nfsdata2_val;
+} nfsdata2;
+#define NFSCOOKIESIZE2 4
+
+typedef char nfscookie2[NFSCOOKIESIZE2];
+
+struct entry2 {
+ u_int fileid;
+ filename2 name;
+ nfscookie2 cookie;
+ struct entry2 *nextentry;
+};
+typedef struct entry2 entry2;
+
+struct diropargs2 {
+ fhandle2 dir;
+ filename2 name;
+};
+typedef struct diropargs2 diropargs2;
+
+struct GETATTR2args {
+ fhandle2 fhandle;
+};
+typedef struct GETATTR2args GETATTR2args;
+
+struct GETATTR2resok {
+ fattr2 attributes;
+};
+typedef struct GETATTR2resok GETATTR2resok;
+
+struct GETATTR2res {
+ nfsstat3 status;
+ union {
+ GETATTR2resok resok;
+ } GETATTR2res_u;
+};
+typedef struct GETATTR2res GETATTR2res;
+
+struct SETATTR2args {
+ fhandle2 fhandle;
+ sattr2 attributes;
+};
+typedef struct SETATTR2args SETATTR2args;
+
+struct SETATTR2resok {
+ fattr2 attributes;
+};
+typedef struct SETATTR2resok SETATTR2resok;
+
+struct SETATTR2res {
+ nfsstat3 status;
+ union {
+ SETATTR2resok resok;
+ } SETATTR2res_u;
+};
+typedef struct SETATTR2res SETATTR2res;
+
+struct LOOKUP2args {
+ diropargs2 what;
+};
+typedef struct LOOKUP2args LOOKUP2args;
+
+struct LOOKUP2resok {
+ fhandle2 file;
+ fattr2 attributes;
+};
+typedef struct LOOKUP2resok LOOKUP2resok;
+
+struct LOOKUP2res {
+ nfsstat3 status;
+ union {
+ LOOKUP2resok resok;
+ } LOOKUP2res_u;
+};
+typedef struct LOOKUP2res LOOKUP2res;
+
+struct READLINK2args {
+ fhandle2 file;
+};
+typedef struct READLINK2args READLINK2args;
+
+struct READLINK2resok {
+ path2 data;
+};
+typedef struct READLINK2resok READLINK2resok;
+
+struct READLINK2res {
+ nfsstat3 status;
+ union {
+ READLINK2resok resok;
+ } READLINK2res_u;
+};
+typedef struct READLINK2res READLINK2res;
+
+struct READ2args {
+ fhandle2 file;
+ u_int offset;
+ u_int count;
+ u_int totalcount;
+};
+typedef struct READ2args READ2args;
+
+struct READ2resok {
+ fattr2 attributes;
+ nfsdata2 data;
+};
+typedef struct READ2resok READ2resok;
+
+struct READ2res {
+ nfsstat3 status;
+ union {
+ READ2resok resok;
+ } READ2res_u;
+};
+typedef struct READ2res READ2res;
+
+struct WRITE2args {
+ fhandle2 file;
+ u_int beginoffset;
+ u_int offset;
+ u_int totalcount;
+ nfsdata2 data;
+};
+typedef struct WRITE2args WRITE2args;
+
+struct WRITE2resok {
+ fattr2 attributes;
+};
+typedef struct WRITE2resok WRITE2resok;
+
+struct WRITE2res {
+ nfsstat3 status;
+ union {
+ WRITE2resok resok;
+ } WRITE2res_u;
+};
+typedef struct WRITE2res WRITE2res;
+
+struct CREATE2args {
+ diropargs2 where;
+ sattr2 attributes;
+};
+typedef struct CREATE2args CREATE2args;
+
+struct CREATE2resok {
+ fhandle2 file;
+ fattr2 attributes;
+};
+typedef struct CREATE2resok CREATE2resok;
+
+struct CREATE2res {
+ nfsstat3 status;
+ union {
+ CREATE2resok resok;
+ } CREATE2res_u;
+};
+typedef struct CREATE2res CREATE2res;
+
+struct REMOVE2args {
+ diropargs2 what;
+};
+typedef struct REMOVE2args REMOVE2args;
+
+struct REMOVE2res {
+ nfsstat3 status;
+};
+typedef struct REMOVE2res REMOVE2res;
+
+struct RENAME2args {
+ diropargs2 from;
+ diropargs2 to;
+};
+typedef struct RENAME2args RENAME2args;
+
+struct RENAME2res {
+ nfsstat3 status;
+};
+typedef struct RENAME2res RENAME2res;
+
+struct LINK2args {
+ fhandle2 from;
+ diropargs2 to;
+};
+typedef struct LINK2args LINK2args;
+
+struct LINK2res {
+ nfsstat3 status;
+};
+typedef struct LINK2res LINK2res;
+
+struct SYMLINK2args {
+ diropargs2 from;
+ path2 to;
+ sattr2 attributes;
+};
+typedef struct SYMLINK2args SYMLINK2args;
+
+struct SYMLINK2res {
+ nfsstat3 status;
+};
+typedef struct SYMLINK2res SYMLINK2res;
+
+struct MKDIR2args {
+ diropargs2 where;
+ sattr2 attributes;
+};
+typedef struct MKDIR2args MKDIR2args;
+
+struct MKDIR2resok {
+ fhandle2 file;
+ fattr2 attributes;
+};
+typedef struct MKDIR2resok MKDIR2resok;
+
+struct MKDIR2res {
+ nfsstat3 status;
+ union {
+ MKDIR2resok resok;
+ } MKDIR2res_u;
+};
+typedef struct MKDIR2res MKDIR2res;
+
+struct RMDIR2args {
+ diropargs2 what;
+};
+typedef struct RMDIR2args RMDIR2args;
+
+struct RMDIR2res {
+ nfsstat3 status;
+};
+typedef struct RMDIR2res RMDIR2res;
+
+struct READDIR2args {
+ fhandle2 dir;
+ nfscookie2 cookie;
+ u_int count;
+};
+typedef struct READDIR2args READDIR2args;
+
+struct READDIR2resok {
+ entry2 *entries;
+ bool_t eof;
+};
+typedef struct READDIR2resok READDIR2resok;
+
+struct READDIR2res {
+ nfsstat3 status;
+ union {
+ READDIR2resok resok;
+ } READDIR2res_u;
+};
+typedef struct READDIR2res READDIR2res;
+
+struct STATFS2args {
+ fhandle2 dir;
+};
+typedef struct STATFS2args STATFS2args;
+
+struct STATFS2resok {
+ u_int tsize;
+ u_int bsize;
+ u_int blocks;
+ u_int bfree;
+ u_int bavail;
+};
+typedef struct STATFS2resok STATFS2resok;
+
+struct STATFS2res {
+ nfsstat3 status;
+ union {
+ STATFS2resok resok;
+ } STATFS2res_u;
+};
+typedef struct STATFS2res STATFS2res;
enum nfsacl_type {
NFSACL_TYPE_USER_OBJ = 0x0001,
typedef struct SETACL3res SETACL3res;
#define NFS_PROGRAM 100003
+#define NFS_V2 2
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define NFS2_NULL 0
+extern void * nfs2_null_2(void *, CLIENT *);
+extern void * nfs2_null_2_svc(void *, struct svc_req *);
+#define NFS2_GETATTR 1
+extern GETATTR2res * nfs2_getattr_2(GETATTR2args *, CLIENT *);
+extern GETATTR2res * nfs2_getattr_2_svc(GETATTR2args *, struct svc_req *);
+#define NFS2_SETATTR 2
+extern SETATTR2res * nfs2_setattr_2(SETATTR2args *, CLIENT *);
+extern SETATTR2res * nfs2_setattr_2_svc(SETATTR2args *, struct svc_req *);
+#define NFS2_LOOKUP 4
+extern LOOKUP2res * nfs2_lookup_2(LOOKUP2args *, CLIENT *);
+extern LOOKUP2res * nfs2_lookup_2_svc(LOOKUP2args *, struct svc_req *);
+#define NFS2_READLINK 5
+extern READLINK2res * nfs2_readlink_2(READLINK2args *, CLIENT *);
+extern READLINK2res * nfs2_readlink_2_svc(READLINK2args *, struct svc_req *);
+#define NFS2_READ 6
+extern READ2res * nfs2_read_2(READ2args *, CLIENT *);
+extern READ2res * nfs2_read_2_svc(READ2args *, struct svc_req *);
+#define NFS2_WRITE 8
+extern WRITE2res * nfs2_write_2(WRITE2args *, CLIENT *);
+extern WRITE2res * nfs2_write_2_svc(WRITE2args *, struct svc_req *);
+#define NFS2_CREATE 9
+extern CREATE2res * nfs2_create_2(CREATE2args *, CLIENT *);
+extern CREATE2res * nfs2_create_2_svc(CREATE2args *, struct svc_req *);
+#define NFS2_REMOVE 10
+extern REMOVE2res * nfs2_remove_2(REMOVE2args *, CLIENT *);
+extern REMOVE2res * nfs2_remove_2_svc(REMOVE2args *, struct svc_req *);
+#define NFS2_RENAME 11
+extern RENAME2res * nfs2_rename_2(RENAME2args *, CLIENT *);
+extern RENAME2res * nfs2_rename_2_svc(RENAME2args *, struct svc_req *);
+#define NFS2_LINK 12
+extern LINK2res * nfs2_link_2(LINK2args *, CLIENT *);
+extern LINK2res * nfs2_link_2_svc(LINK2args *, struct svc_req *);
+#define NFS2_SYMLINK 13
+extern SYMLINK2res * nfs2_symlink_2(SYMLINK2args *, CLIENT *);
+extern SYMLINK2res * nfs2_symlink_2_svc(SYMLINK2args *, struct svc_req *);
+#define NFS2_MKDIR 14
+extern MKDIR2res * nfs2_mkdir_2(MKDIR2args *, CLIENT *);
+extern MKDIR2res * nfs2_mkdir_2_svc(MKDIR2args *, struct svc_req *);
+#define NFS2_RMDIR 15
+extern RMDIR2res * nfs2_rmdir_2(RMDIR2args *, CLIENT *);
+extern RMDIR2res * nfs2_rmdir_2_svc(RMDIR2args *, struct svc_req *);
+#define NFS2_READDIR 16
+extern READDIR2res * nfs2_readdir_2(READDIR2args *, CLIENT *);
+extern READDIR2res * nfs2_readdir_2_svc(READDIR2args *, struct svc_req *);
+#define NFS2_STATFS 17
+extern STATFS2res * nfs2_statfs_2(STATFS2args *, CLIENT *);
+extern STATFS2res * nfs2_statfs_2_svc(STATFS2args *, struct svc_req *);
+extern int nfs_program_2_freeresult (SVCXPRT *, zdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define NFS2_NULL 0
+extern void * nfs2_null_2();
+extern void * nfs2_null_2_svc();
+#define NFS2_GETATTR 1
+extern GETATTR2res * nfs2_getattr_2();
+extern GETATTR2res * nfs2_getattr_2_svc();
+#define NFS2_SETATTR 2
+extern SETATTR2res * nfs2_setattr_2();
+extern SETATTR2res * nfs2_setattr_2_svc();
+#define NFS2_LOOKUP 4
+extern LOOKUP2res * nfs2_lookup_2();
+extern LOOKUP2res * nfs2_lookup_2_svc();
+#define NFS2_READLINK 5
+extern READLINK2res * nfs2_readlink_2();
+extern READLINK2res * nfs2_readlink_2_svc();
+#define NFS2_READ 6
+extern READ2res * nfs2_read_2();
+extern READ2res * nfs2_read_2_svc();
+#define NFS2_WRITE 8
+extern WRITE2res * nfs2_write_2();
+extern WRITE2res * nfs2_write_2_svc();
+#define NFS2_CREATE 9
+extern CREATE2res * nfs2_create_2();
+extern CREATE2res * nfs2_create_2_svc();
+#define NFS2_REMOVE 10
+extern REMOVE2res * nfs2_remove_2();
+extern REMOVE2res * nfs2_remove_2_svc();
+#define NFS2_RENAME 11
+extern RENAME2res * nfs2_rename_2();
+extern RENAME2res * nfs2_rename_2_svc();
+#define NFS2_LINK 12
+extern LINK2res * nfs2_link_2();
+extern LINK2res * nfs2_link_2_svc();
+#define NFS2_SYMLINK 13
+extern SYMLINK2res * nfs2_symlink_2();
+extern SYMLINK2res * nfs2_symlink_2_svc();
+#define NFS2_MKDIR 14
+extern MKDIR2res * nfs2_mkdir_2();
+extern MKDIR2res * nfs2_mkdir_2_svc();
+#define NFS2_RMDIR 15
+extern RMDIR2res * nfs2_rmdir_2();
+extern RMDIR2res * nfs2_rmdir_2_svc();
+#define NFS2_READDIR 16
+extern READDIR2res * nfs2_readdir_2();
+extern READDIR2res * nfs2_readdir_2_svc();
+#define NFS2_STATFS 17
+extern STATFS2res * nfs2_statfs_2();
+extern STATFS2res * nfs2_statfs_2_svc();
+extern int nfs_program_2_freeresult ();
+#endif /* K&R C */
#define NFS_V3 3
#if defined(__STDC__) || defined(__cplusplus)
extern bool_t zdr_SETATTR3resok (ZDR *, SETATTR3resok*);
extern bool_t zdr_SETATTR3resfail (ZDR *, SETATTR3resfail*);
extern bool_t zdr_SETATTR3res (ZDR *, SETATTR3res*);
+extern bool_t zdr_fhandle2 (ZDR *, fhandle2);
+extern bool_t zdr_ftype2 (ZDR *, ftype2*);
+extern bool_t zdr_fattr2 (ZDR *, fattr2*);
+extern bool_t zdr_sattr2 (ZDR *, sattr2*);
+extern bool_t zdr_filename2 (ZDR *, filename2*);
+extern bool_t zdr_path2 (ZDR *, path2*);
+extern bool_t zdr_nfsdata2 (ZDR *, nfsdata2*);
+extern bool_t zdr_nfscookie2 (ZDR *, nfscookie2);
+extern bool_t zdr_entry2 (ZDR *, entry2*);
+extern bool_t zdr_diropargs2 (ZDR *, diropargs2*);
+extern bool_t zdr_GETATTR2args (ZDR *, GETATTR2args*);
+extern bool_t zdr_GETATTR2resok (ZDR *, GETATTR2resok*);
+extern bool_t zdr_GETATTR2res (ZDR *, GETATTR2res*);
+extern bool_t zdr_SETATTR2args (ZDR *, SETATTR2args*);
+extern bool_t zdr_SETATTR2resok (ZDR *, SETATTR2resok*);
+extern bool_t zdr_SETATTR2res (ZDR *, SETATTR2res*);
+extern bool_t zdr_LOOKUP2args (ZDR *, LOOKUP2args*);
+extern bool_t zdr_LOOKUP2resok (ZDR *, LOOKUP2resok*);
+extern bool_t zdr_LOOKUP2res (ZDR *, LOOKUP2res*);
+extern bool_t zdr_READLINK2args (ZDR *, READLINK2args*);
+extern bool_t zdr_READLINK2resok (ZDR *, READLINK2resok*);
+extern bool_t zdr_READLINK2res (ZDR *, READLINK2res*);
+extern bool_t zdr_READ2args (ZDR *, READ2args*);
+extern bool_t zdr_READ2resok (ZDR *, READ2resok*);
+extern bool_t zdr_READ2res (ZDR *, READ2res*);
+extern bool_t zdr_WRITE2args (ZDR *, WRITE2args*);
+extern bool_t zdr_WRITE2resok (ZDR *, WRITE2resok*);
+extern bool_t zdr_WRITE2res (ZDR *, WRITE2res*);
+extern bool_t zdr_CREATE2args (ZDR *, CREATE2args*);
+extern bool_t zdr_CREATE2resok (ZDR *, CREATE2resok*);
+extern bool_t zdr_CREATE2res (ZDR *, CREATE2res*);
+extern bool_t zdr_REMOVE2args (ZDR *, REMOVE2args*);
+extern bool_t zdr_REMOVE2res (ZDR *, REMOVE2res*);
+extern bool_t zdr_RENAME2args (ZDR *, RENAME2args*);
+extern bool_t zdr_RENAME2res (ZDR *, RENAME2res*);
+extern bool_t zdr_LINK2args (ZDR *, LINK2args*);
+extern bool_t zdr_LINK2res (ZDR *, LINK2res*);
+extern bool_t zdr_SYMLINK2args (ZDR *, SYMLINK2args*);
+extern bool_t zdr_SYMLINK2res (ZDR *, SYMLINK2res*);
+extern bool_t zdr_MKDIR2args (ZDR *, MKDIR2args*);
+extern bool_t zdr_MKDIR2resok (ZDR *, MKDIR2resok*);
+extern bool_t zdr_MKDIR2res (ZDR *, MKDIR2res*);
+extern bool_t zdr_RMDIR2args (ZDR *, RMDIR2args*);
+extern bool_t zdr_RMDIR2res (ZDR *, RMDIR2res*);
+extern bool_t zdr_READDIR2args (ZDR *, READDIR2args*);
+extern bool_t zdr_READDIR2resok (ZDR *, READDIR2resok*);
+extern bool_t zdr_READDIR2res (ZDR *, READDIR2res*);
+extern bool_t zdr_STATFS2args (ZDR *, STATFS2args*);
+extern bool_t zdr_STATFS2resok (ZDR *, STATFS2resok*);
+extern bool_t zdr_STATFS2res (ZDR *, STATFS2res*);
extern bool_t zdr_nfsacl_type (ZDR *, nfsacl_type*);
extern bool_t zdr_nfsacl_ace (ZDR *, nfsacl_ace*);
extern bool_t zdr_GETACL3args (ZDR *, GETACL3args*);
extern bool_t zdr_SETATTR3resok ();
extern bool_t zdr_SETATTR3resfail ();
extern bool_t zdr_SETATTR3res ();
+extern bool_t zdr_fhandle2 ();
+extern bool_t zdr_ftype2 ();
+extern bool_t zdr_fattr2 ();
+extern bool_t zdr_sattr2 ();
+extern bool_t zdr_filename2 ();
+extern bool_t zdr_path2 ();
+extern bool_t zdr_nfsdata2 ();
+extern bool_t zdr_nfscookie2 ();
+extern bool_t zdr_entry2 ();
+extern bool_t zdr_diropargs2 ();
+extern bool_t zdr_GETATTR2args ();
+extern bool_t zdr_GETATTR2resok ();
+extern bool_t zdr_GETATTR2res ();
+extern bool_t zdr_SETATTR2args ();
+extern bool_t zdr_SETATTR2resok ();
+extern bool_t zdr_SETATTR2res ();
+extern bool_t zdr_LOOKUP2args ();
+extern bool_t zdr_LOOKUP2resok ();
+extern bool_t zdr_LOOKUP2res ();
+extern bool_t zdr_READLINK2args ();
+extern bool_t zdr_READLINK2resok ();
+extern bool_t zdr_READLINK2res ();
+extern bool_t zdr_READ2args ();
+extern bool_t zdr_READ2resok ();
+extern bool_t zdr_READ2res ();
+extern bool_t zdr_WRITE2args ();
+extern bool_t zdr_WRITE2resok ();
+extern bool_t zdr_WRITE2res ();
+extern bool_t zdr_CREATE2args ();
+extern bool_t zdr_CREATE2resok ();
+extern bool_t zdr_CREATE2res ();
+extern bool_t zdr_REMOVE2args ();
+extern bool_t zdr_REMOVE2res ();
+extern bool_t zdr_RENAME2args ();
+extern bool_t zdr_RENAME2res ();
+extern bool_t zdr_LINK2args ();
+extern bool_t zdr_LINK2res ();
+extern bool_t zdr_SYMLINK2args ();
+extern bool_t zdr_SYMLINK2res ();
+extern bool_t zdr_MKDIR2args ();
+extern bool_t zdr_MKDIR2resok ();
+extern bool_t zdr_MKDIR2res ();
+extern bool_t zdr_RMDIR2args ();
+extern bool_t zdr_RMDIR2res ();
+extern bool_t zdr_READDIR2args ();
+extern bool_t zdr_READDIR2resok ();
+extern bool_t zdr_READDIR2res ();
+extern bool_t zdr_STATFS2args ();
+extern bool_t zdr_STATFS2resok ();
+extern bool_t zdr_STATFS2res ();
extern bool_t zdr_nfsacl_type ();
extern bool_t zdr_nfsacl_ace ();
extern bool_t zdr_GETACL3args ();
}
-int rpc_nfs_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
+/*
+ * NFSv3
+ */
+int rpc_nfs3_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
{
struct rpc_pdu *pdu;
pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_NULL, cb, private_data, (zdrproc_t)zdr_void, 0);
if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/null call");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/NULL call");
return -1;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/null call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS3/NULL call");
rpc_free_pdu(rpc, pdu);
return -2;
}
return 0;
}
-int rpc_nfs_getattr_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data)
+int rpc_nfs_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
+{
+ return rpc_nfs3_null_async(rpc, cb, private_data);
+}
+
+int rpc_nfs3_getattr_async(struct rpc_context *rpc, rpc_cb cb, struct GETATTR3args *args, void *private_data)
{
struct rpc_pdu *pdu;
- GETATTR3args args;
pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_GETATTR, cb, private_data, (zdrproc_t)zdr_GETATTR3res, sizeof(GETATTR3res));
if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/null call");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/GETATTR call");
return -1;
}
- args.object.data.data_len = fh->data.data_len;
- args.object.data.data_val = fh->data.data_val;
-
- if (zdr_GETATTR3args(&pdu->zdr, &args) == 0) {
+ if (zdr_GETATTR3args(&pdu->zdr, args) == 0) {
rpc_set_error(rpc, "ZDR error: Failed to encode GETATTR3args");
rpc_free_pdu(rpc, pdu);
return -2;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/getattr call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS3/GETATTR call");
rpc_free_pdu(rpc, pdu);
return -3;
}
return 0;
}
-int rpc_nfs_pathconf_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data)
+int rpc_nfs_getattr_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data)
+{
+ GETATTR3args args;
+
+ memset(&args, 0, sizeof(GETATTR3args));
+ args.object.data.data_len = fh->data.data_len;
+ args.object.data.data_val = fh->data.data_val;
+
+ return rpc_nfs3_getattr_async(rpc, cb, &args, private_data);
+}
+
+int rpc_nfs3_pathconf_async(struct rpc_context *rpc, rpc_cb cb, struct PATHCONF3args *args, void *private_data)
{
struct rpc_pdu *pdu;
- PATHCONF3args args;
pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_PATHCONF, cb, private_data, (zdrproc_t)zdr_PATHCONF3res, sizeof(PATHCONF3res));
if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/pathconf call");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/PATHCONF call");
return -1;
}
- args.object.data.data_len = fh->data.data_len;
- args.object.data.data_val = fh->data.data_val;
-
- if (zdr_PATHCONF3args(&pdu->zdr, &args) == 0) {
+ if (zdr_PATHCONF3args(&pdu->zdr, args) == 0) {
rpc_set_error(rpc, "ZDR error: Failed to encode PATHCONF3args");
rpc_free_pdu(rpc, pdu);
return -2;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/pathconf call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS3/PATHCONF call");
rpc_free_pdu(rpc, pdu);
return -3;
}
return 0;
}
-int rpc_nfs_lookup_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *name, void *private_data)
+int rpc_nfs_pathconf_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data)
+{
+ PATHCONF3args args;
+
+ memset(&args, 0, sizeof(PATHCONF3args));
+ args.object.data.data_len = fh->data.data_len;
+ args.object.data.data_val = fh->data.data_val;
+
+ return rpc_nfs3_pathconf_async(rpc, cb, &args, private_data);
+}
+
+int rpc_nfs3_lookup_async(struct rpc_context *rpc, rpc_cb cb, struct LOOKUP3args *args, void *private_data)
{
struct rpc_pdu *pdu;
- LOOKUP3args args;
pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_LOOKUP, cb, private_data, (zdrproc_t)zdr_LOOKUP3res, sizeof(LOOKUP3res));
if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/lookup call");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/LOOKUP call");
return -1;
}
- args.what.dir.data.data_len = fh->data.data_len;
- args.what.dir.data.data_val = fh->data.data_val;
- args.what.name = name;
-
- if (zdr_LOOKUP3args(&pdu->zdr, &args) == 0) {
+ if (zdr_LOOKUP3args(&pdu->zdr, args) == 0) {
rpc_set_error(rpc, "ZDR error: Failed to encode LOOKUP3args");
rpc_free_pdu(rpc, pdu);
return -2;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/lookup call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS3/LOOKUP call");
rpc_free_pdu(rpc, pdu);
return -3;
}
return 0;
}
+int rpc_nfs_lookup_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *name, void *private_data)
+{
+ LOOKUP3args args;
-int rpc_nfs_access_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, int access, void *private_data)
+ memset(&args, 0, sizeof(LOOKUP3args));
+ args.what.dir.data.data_len = fh->data.data_len;
+ args.what.dir.data.data_val = fh->data.data_val;
+ args.what.name = name;
+
+ return rpc_nfs3_lookup_async(rpc, cb, &args, private_data);
+}
+
+int rpc_nfs3_access_async(struct rpc_context *rpc, rpc_cb cb, struct ACCESS3args *args, void *private_data)
{
struct rpc_pdu *pdu;
- ACCESS3args args;
pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_ACCESS, cb, private_data, (zdrproc_t)zdr_ACCESS3res, sizeof(ACCESS3res));
if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/access call");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/ACCESS call");
return -1;
}
- args.object.data.data_len = fh->data.data_len;
- args.object.data.data_val = fh->data.data_val;
- args.access = access;
-
- if (zdr_ACCESS3args(&pdu->zdr, &args) == 0) {
+ if (zdr_ACCESS3args(&pdu->zdr, args) == 0) {
rpc_set_error(rpc, "ZDR error: Failed to encode ACCESS3args");
rpc_free_pdu(rpc, pdu);
return -2;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/access call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS3/ACCESS call");
rpc_free_pdu(rpc, pdu);
return -3;
}
return 0;
}
+int rpc_nfs_access_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, int access, void *private_data)
+{
+ ACCESS3args args;
+
+ memset(&args, 0, sizeof(ACCESS3args));
+ args.object.data.data_len = fh->data.data_len;
+ args.object.data.data_val = fh->data.data_val;
+ args.access = access;
+ return rpc_nfs3_access_async(rpc, cb, &args, private_data);
+}
-int rpc_nfs_read_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t offset, uint64_t count, void *private_data)
+int rpc_nfs3_read_async(struct rpc_context *rpc, rpc_cb cb, struct READ3args *args, void *private_data)
{
struct rpc_pdu *pdu;
- READ3args args;
pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_READ, cb, private_data, (zdrproc_t)zdr_READ3res, sizeof(READ3res));
if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/read call");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/READ call");
return -1;
}
- args.file.data.data_len = fh->data.data_len;
- args.file.data.data_val = fh->data.data_val;
- args.offset = offset;
- args.count = count;
-
- if (zdr_READ3args(&pdu->zdr, &args) == 0) {
+ if (zdr_READ3args(&pdu->zdr, args) == 0) {
rpc_set_error(rpc, "ZDR error: Failed to encode READ3args");
rpc_free_pdu(rpc, pdu);
return -2;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/read call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS3/READ call");
rpc_free_pdu(rpc, pdu);
return -3;
}
return 0;
}
+int rpc_nfs_read_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t offset, uint64_t count, void *private_data)
+{
+ READ3args args;
+
+ memset(&args, 0, sizeof(READ3args));
+ args.file.data.data_len = fh->data.data_len;
+ args.file.data.data_val = fh->data.data_val;
+ args.offset = offset;
+ args.count = count;
-int rpc_nfs_write_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *buf, uint64_t offset, uint64_t count, int stable_how, void *private_data)
+ return rpc_nfs3_read_async(rpc, cb, &args, private_data);
+}
+
+int rpc_nfs3_write_async(struct rpc_context *rpc, rpc_cb cb, struct WRITE3args *args, void *private_data)
{
struct rpc_pdu *pdu;
- WRITE3args args;
pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_WRITE, cb, private_data, (zdrproc_t)zdr_WRITE3res, sizeof(WRITE3res));
if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/write call");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/WRITE call");
return -1;
}
- args.file.data.data_len = fh->data.data_len;
- args.file.data.data_val = fh->data.data_val;
- args.offset = offset;
- args.count = count;
- args.stable = stable_how;
- args.data.data_len = count;
- args.data.data_val = buf;
-
- if (zdr_WRITE3args(&pdu->zdr, &args) == 0) {
+ if (zdr_WRITE3args(&pdu->zdr, args) == 0) {
rpc_set_error(rpc, "ZDR error: Failed to encode WRITE3args");
rpc_free_pdu(rpc, pdu);
return -2;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/write call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS3/WRITE call");
rpc_free_pdu(rpc, pdu);
return -3;
}
return 0;
}
+int rpc_nfs_write_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *buf, uint64_t offset, uint64_t count, int stable_how, void *private_data)
+{
+ WRITE3args args;
+
+ memset(&args, 0, sizeof(WRITE3args));
+ args.file.data.data_len = fh->data.data_len;
+ args.file.data.data_val = fh->data.data_val;
+ args.offset = offset;
+ args.count = count;
+ args.stable = stable_how;
+ args.data.data_len = count;
+ args.data.data_val = buf;
+ return rpc_nfs3_write_async(rpc, cb, &args, private_data);
+}
-int rpc_nfs_commit_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data)
+int rpc_nfs3_commit_async(struct rpc_context *rpc, rpc_cb cb, struct COMMIT3args *args, void *private_data)
{
struct rpc_pdu *pdu;
- COMMIT3args args;
pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_COMMIT, cb, private_data, (zdrproc_t)zdr_COMMIT3res, sizeof(COMMIT3res));
if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/commit call");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/COMMIT call");
return -1;
}
- args.file.data.data_len = fh->data.data_len;
- args.file.data.data_val = fh->data.data_val;
- args.offset = 0;
- args.count = 0;
-
- if (zdr_COMMIT3args(&pdu->zdr, &args) == 0) {
- rpc_set_error(rpc, "ZDR error: Failed to encode WRITE3args");
+ if (zdr_COMMIT3args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode COMMIT3args");
rpc_free_pdu(rpc, pdu);
return -2;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/commit call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS3/COMMIT call");
rpc_free_pdu(rpc, pdu);
return -3;
}
return 0;
}
+int rpc_nfs_commit_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data)
+{
+ COMMIT3args args;
+
+ memset(&args, 0, sizeof(COMMIT3args));
+ args.file.data.data_len = fh->data.data_len;
+ args.file.data.data_val = fh->data.data_val;
+ args.offset = 0;
+ args.count = 0;
-int rpc_nfs_setattr_async(struct rpc_context *rpc, rpc_cb cb, SETATTR3args *args, void *private_data)
+ return rpc_nfs3_commit_async(rpc, cb, &args, private_data);
+}
+
+int rpc_nfs3_setattr_async(struct rpc_context *rpc, rpc_cb cb, SETATTR3args *args, void *private_data)
{
struct rpc_pdu *pdu;
pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_SETATTR, cb, private_data, (zdrproc_t)zdr_SETATTR3res, sizeof(SETATTR3res));
if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/setattr call");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/SETATTR call");
return -1;
}
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/setattr call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS3/SETATTR call");
rpc_free_pdu(rpc, pdu);
return -3;
}
return 0;
}
+int rpc_nfs_setattr_async(struct rpc_context *rpc, rpc_cb cb, SETATTR3args *args, void *private_data)
+{
+ return rpc_nfs3_setattr_async(rpc, cb, args, private_data);
+}
-
-int rpc_nfs_mkdir_async(struct rpc_context *rpc, rpc_cb cb, MKDIR3args *args, void *private_data)
+int rpc_nfs3_mkdir_async(struct rpc_context *rpc, rpc_cb cb, MKDIR3args *args, void *private_data)
{
struct rpc_pdu *pdu;
pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_MKDIR, cb, private_data, (zdrproc_t)zdr_MKDIR3res, sizeof(MKDIR3res));
if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/setattr call");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/MKDIR call");
return -1;
}
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/mkdir call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS3/MKDIR call");
rpc_free_pdu(rpc, pdu);
return -3;
}
return 0;
}
+int rpc_nfs_mkdir_async(struct rpc_context *rpc, rpc_cb cb, MKDIR3args *args, void *private_data)
+{
+ return rpc_nfs3_mkdir_async(rpc, cb, args, private_data);
+}
-
-
-int rpc_nfs_rmdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *dir, void *private_data)
+int rpc_nfs3_rmdir_async(struct rpc_context *rpc, rpc_cb cb, struct RMDIR3args *args, void *private_data)
{
struct rpc_pdu *pdu;
- RMDIR3args args;
pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_RMDIR, cb, private_data, (zdrproc_t)zdr_RMDIR3res, sizeof(RMDIR3res));
if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/rmdir call");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/RMDIR call");
return -1;
}
- memset(&args, 0, sizeof(RMDIR3args));
- args.object.dir.data.data_len = fh->data.data_len;
- args.object.dir.data.data_val = fh->data.data_val;
- args.object.name = dir;
-
- if (zdr_RMDIR3args(&pdu->zdr, &args) == 0) {
+ if (zdr_RMDIR3args(&pdu->zdr, args) == 0) {
rpc_set_error(rpc, "ZDR error: Failed to encode RMDIR3args");
rpc_free_pdu(rpc, pdu);
return -2;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/rmdir call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS3/RMDIR call");
rpc_free_pdu(rpc, pdu);
return -3;
}
return 0;
}
+int rpc_nfs_rmdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *dir, void *private_data)
+{
+ RMDIR3args args;
+
+ memset(&args, 0, sizeof(RMDIR3args));
+ args.object.dir.data.data_len = fh->data.data_len;
+ args.object.dir.data.data_val = fh->data.data_val;
+ args.object.name = dir;
+ return rpc_nfs3_rmdir_async(rpc, cb, &args, private_data);
+}
-int rpc_nfs_create_async(struct rpc_context *rpc, rpc_cb cb, CREATE3args *args, void *private_data)
+int rpc_nfs3_create_async(struct rpc_context *rpc, rpc_cb cb, CREATE3args *args, void *private_data)
{
struct rpc_pdu *pdu;
pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_CREATE, cb, private_data, (zdrproc_t)zdr_CREATE3res, sizeof(CREATE3res));
if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/create call");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/CREATE call");
return -1;
}
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/create call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS3/CREATE call");
rpc_free_pdu(rpc, pdu);
return -3;
}
return 0;
}
+int rpc_nfs_create_async(struct rpc_context *rpc, rpc_cb cb, CREATE3args *args, void *private_data)
+{
+ return rpc_nfs3_create_async(rpc, cb, args, private_data);
+}
-
-int rpc_nfs_mknod_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *file, int mode, int major, int minor, void *private_data)
+int rpc_nfs3_mknod_async(struct rpc_context *rpc, rpc_cb cb, struct MKNOD3args *args, void *private_data)
{
struct rpc_pdu *pdu;
- MKNOD3args args;
pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_MKNOD, cb, private_data, (zdrproc_t)zdr_MKNOD3res, sizeof(MKNOD3res));
if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/mknod call");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/MKNOD call");
return -1;
}
+ if (zdr_MKNOD3args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode MKNOD3args");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS3/MKNOD call");
+ rpc_free_pdu(rpc, pdu);
+ return -3;
+ }
+
+ return 0;
+}
+
+int rpc_nfs_mknod_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *file, int mode, int major, int minor, void *private_data)
+{
+ MKNOD3args args;
+
memset(&args, 0, sizeof(MKNOD3args));
args.where.dir.data.data_len = fh->data.data_len;
args.where.dir.data.data_val = fh->data.data_val;
args.where.name = file;
+
switch (mode & S_IFMT) {
case S_IFCHR:
args.what.type = NF3CHR;
args.what.mknoddata3_u.pipe_attributes.mode.set_mode3_u.mode = mode & (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH);
break;
default:
- rpc_set_error(rpc, "Invalid file type for nfs/mknod call");
- rpc_free_pdu(rpc, pdu);
+ rpc_set_error(rpc, "Invalid file type for NFS3/MKNOD call");
return -1;
}
- if (zdr_MKNOD3args(&pdu->zdr, &args) == 0) {
- rpc_set_error(rpc, "ZDR error: Failed to encode MKNOD3args");
+ return rpc_nfs3_mknod_async(rpc, cb, &args, private_data);
+}
+
+int rpc_nfs3_remove_async(struct rpc_context *rpc, rpc_cb cb, struct REMOVE3args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_REMOVE, cb, private_data, (zdrproc_t)zdr_REMOVE3res, sizeof(REMOVE3res));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/REMOVE call");
+ return -1;
+ }
+
+ if (zdr_REMOVE3args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode REMOVE3args");
rpc_free_pdu(rpc, pdu);
return -2;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/mknod call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS3/REMOVE call");
rpc_free_pdu(rpc, pdu);
return -3;
}
return 0;
}
-
int rpc_nfs_remove_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *file, void *private_data)
{
- struct rpc_pdu *pdu;
REMOVE3args args;
- pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_REMOVE, cb, private_data, (zdrproc_t)zdr_REMOVE3res, sizeof(REMOVE3res));
- if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/remove call");
- return -1;
- }
-
memset(&args, 0, sizeof(REMOVE3args));
args.object.dir.data.data_len = fh->data.data_len;
args.object.dir.data.data_val = fh->data.data_val;
args.object.name = file;
- if (zdr_REMOVE3args(&pdu->zdr, &args) == 0) {
- rpc_set_error(rpc, "ZDR error: Failed to encode REMOVE3args");
+ return rpc_nfs3_remove_async(rpc, cb, &args, private_data);
+}
+
+int rpc_nfs3_readdir_async(struct rpc_context *rpc, rpc_cb cb, struct READDIR3args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_READDIR, cb, private_data, (zdrproc_t)zdr_READDIR3res, sizeof(READDIR3res));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/READDIR call");
+ return -1;
+ }
+
+ if (zdr_READDIR3args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode READDIR3args");
rpc_free_pdu(rpc, pdu);
return -2;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/remove call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS3/READDIR call");
rpc_free_pdu(rpc, pdu);
return -3;
}
int rpc_nfs_readdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t cookie, char *cookieverf, int count, void *private_data)
{
- struct rpc_pdu *pdu;
READDIR3args args;
- pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_READDIR, cb, private_data, (zdrproc_t)zdr_READDIR3res, sizeof(READDIR3res));
- if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/readdir call");
- return -1;
- }
-
memset(&args, 0, sizeof(READDIR3args));
args.dir.data.data_len = fh->data.data_len;
args.dir.data.data_val = fh->data.data_val;
memcpy(&args.cookieverf, cookieverf, sizeof(cookieverf3));
args.count = count;
- if (zdr_READDIR3args(&pdu->zdr, &args) == 0) {
- rpc_set_error(rpc, "ZDR error: Failed to encode READDIR3args");
+ return rpc_nfs3_readdir_async(rpc, cb, &args, private_data);
+}
+
+int rpc_nfs3_readdirplus_async(struct rpc_context *rpc, rpc_cb cb, struct READDIRPLUS3args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_READDIRPLUS, cb, private_data, (zdrproc_t)zdr_READDIRPLUS3res, sizeof(READDIRPLUS3res));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/READDIRPLUS call");
+ return -1;
+ }
+
+ if (zdr_READDIRPLUS3args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode READDIRPLUS3args");
rpc_free_pdu(rpc, pdu);
return -2;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/readdir call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS3/READDIRPLUS call");
rpc_free_pdu(rpc, pdu);
return -3;
}
int rpc_nfs_readdirplus_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t cookie, char *cookieverf, int count, void *private_data)
{
- struct rpc_pdu *pdu;
READDIRPLUS3args args;
- pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_READDIRPLUS, cb, private_data, (zdrproc_t)zdr_READDIRPLUS3res, sizeof(READDIRPLUS3res));
- if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/readdirplus call");
- return -1;
- }
-
memset(&args, 0, sizeof(READDIRPLUS3args));
args.dir.data.data_len = fh->data.data_len;
args.dir.data.data_val = fh->data.data_val;
args.dircount = count;
args.maxcount = count;
- if (zdr_READDIRPLUS3args(&pdu->zdr, &args) == 0) {
- rpc_set_error(rpc, "ZDR error: Failed to encode READDIRPLUS3args");
+ return rpc_nfs3_readdirplus_async(rpc, cb, &args, private_data);
+}
+
+int rpc_nfs3_fsstat_async(struct rpc_context *rpc, rpc_cb cb, struct FSSTAT3args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_FSSTAT, cb, private_data, (zdrproc_t)zdr_FSSTAT3res, sizeof(FSSTAT3res));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/FSSTAT call");
+ return -1;
+ }
+
+ if (zdr_FSSTAT3args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode FSSTAT3args");
rpc_free_pdu(rpc, pdu);
return -2;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/readdirplus call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS3/FSSTAT call");
rpc_free_pdu(rpc, pdu);
return -3;
}
int rpc_nfs_fsstat_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data)
{
- struct rpc_pdu *pdu;
FSSTAT3args args;
- pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_FSSTAT, cb, private_data, (zdrproc_t)zdr_FSSTAT3res, sizeof(FSSTAT3res));
+ memset(&args, 0, sizeof(FSSTAT3args));
+ args.fsroot.data.data_len = fh->data.data_len;
+ args.fsroot.data.data_val = fh->data.data_val;
+
+ return rpc_nfs3_fsstat_async(rpc, cb, &args, private_data);
+}
+
+int rpc_nfs3_fsinfo_async(struct rpc_context *rpc, rpc_cb cb, struct FSINFO3args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_FSINFO, cb, private_data, (zdrproc_t)zdr_FSINFO3res, sizeof(FSINFO3res));
if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/fsstat call");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/FSINFO call");
return -1;
}
- args.fsroot.data.data_len = fh->data.data_len;
- args.fsroot.data.data_val = fh->data.data_val;
-
- if (zdr_FSSTAT3args(&pdu->zdr, &args) == 0) {
- rpc_set_error(rpc, "ZDR error: Failed to encode FSSTAT3args");
+ if (zdr_FSINFO3args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode FSINFO3args");
rpc_free_pdu(rpc, pdu);
return -2;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/fsstat call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS3/FSINFO call");
rpc_free_pdu(rpc, pdu);
return -3;
}
int rpc_nfs_fsinfo_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data)
{
- struct rpc_pdu *pdu;
FSINFO3args args;
- pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_FSINFO, cb, private_data, (zdrproc_t)zdr_FSINFO3res, sizeof(FSINFO3res));
+ memset(&args, 0, sizeof(FSINFO3args));
+ args.fsroot.data.data_len = fh->data.data_len;
+ args.fsroot.data.data_val = fh->data.data_val;
+
+ return rpc_nfs3_fsinfo_async(rpc, cb, fh, private_data);
+}
+
+int rpc_nfs3_readlink_async(struct rpc_context *rpc, rpc_cb cb, READLINK3args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_READLINK, cb, private_data, (zdrproc_t)zdr_READLINK3res, sizeof(READLINK3res));
if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/fsinfo call");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/READLINK call");
return -1;
}
- args.fsroot.data.data_len = fh->data.data_len;
- args.fsroot.data.data_val = fh->data.data_val;
-
- if (zdr_FSINFO3args(&pdu->zdr, &args) == 0) {
- rpc_set_error(rpc, "ZDR error: Failed to encode FSINFO3args");
+ if (zdr_READLINK3args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode READLINK3args");
rpc_free_pdu(rpc, pdu);
return -2;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/fsinfo call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS3/READLINK call");
rpc_free_pdu(rpc, pdu);
return -3;
}
}
int rpc_nfs_readlink_async(struct rpc_context *rpc, rpc_cb cb, READLINK3args *args, void *private_data)
+{
+ return rpc_nfs3_readlink_async(rpc, cb, args, private_data);
+}
+
+int rpc_nfs3_symlink_async(struct rpc_context *rpc, rpc_cb cb, SYMLINK3args *args, void *private_data)
{
struct rpc_pdu *pdu;
- pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_READLINK, cb, private_data, (zdrproc_t)zdr_READLINK3res, sizeof(READLINK3res));
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_SYMLINK, cb, private_data, (zdrproc_t)zdr_SYMLINK3res, sizeof(SYMLINK3res));
if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/readlink call");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/SYMLINK call");
return -1;
}
- if (zdr_READLINK3args(&pdu->zdr, args) == 0) {
- rpc_set_error(rpc, "ZDR error: Failed to encode READLINK3args");
+ if (zdr_SYMLINK3args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode SYMLINK3args");
rpc_free_pdu(rpc, pdu);
return -2;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/readlink call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS3/SYMLINK call");
rpc_free_pdu(rpc, pdu);
return -3;
}
return 0;
}
-
int rpc_nfs_symlink_async(struct rpc_context *rpc, rpc_cb cb, SYMLINK3args *args, void *private_data)
+{
+ return rpc_nfs3_symlink_async(rpc, cb, args, private_data);
+}
+
+int rpc_nfs3_rename_async(struct rpc_context *rpc, rpc_cb cb, struct RENAME3args *args, void *private_data)
{
struct rpc_pdu *pdu;
- pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_SYMLINK, cb, private_data, (zdrproc_t)zdr_SYMLINK3res, sizeof(SYMLINK3res));
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_RENAME, cb, private_data, (zdrproc_t)zdr_RENAME3res, sizeof(RENAME3res));
if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/symlink call");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/RENAME call");
return -1;
}
- if (zdr_SYMLINK3args(&pdu->zdr, args) == 0) {
- rpc_set_error(rpc, "ZDR error: Failed to encode SYMLINK3args");
+ if (zdr_RENAME3args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode RENAME3args");
rpc_free_pdu(rpc, pdu);
return -2;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/symlink call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS3/RENAME call");
rpc_free_pdu(rpc, pdu);
return -3;
}
return 0;
}
-
-
-
int rpc_nfs_rename_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *olddir, char *oldname, struct nfs_fh3 *newdir, char *newname, void *private_data)
{
- struct rpc_pdu *pdu;
RENAME3args args;
- pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_RENAME, cb, private_data, (zdrproc_t)zdr_RENAME3res, sizeof(RENAME3res));
- if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/rename call");
- return -1;
- }
-
memset(&args, 0, sizeof(RENAME3args));
args.from.dir.data.data_len = olddir->data.data_len;
args.from.dir.data.data_val = olddir->data.data_val;
args.to.dir.data.data_val = newdir->data.data_val;
args.to.name = newname;
- if (zdr_RENAME3args(&pdu->zdr, &args) == 0) {
- rpc_set_error(rpc, "ZDR error: Failed to encode RENAME3args");
+ return rpc_nfs3_rename_async(rpc, cb, &args, private_data);
+}
+
+int rpc_nfs3_link_async(struct rpc_context *rpc, rpc_cb cb, struct LINK3args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_LINK, cb, private_data, (zdrproc_t)zdr_LINK3res, sizeof(LINK3res));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/LINK call");
+ return -1;
+ }
+
+ if (zdr_LINK3args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode LINK3args");
rpc_free_pdu(rpc, pdu);
return -2;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/rename call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS3/LINK call");
rpc_free_pdu(rpc, pdu);
return -3;
}
return 0;
}
-
-
-
int rpc_nfs_link_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *file, struct nfs_fh3 *newdir, char *newname, void *private_data)
{
- struct rpc_pdu *pdu;
LINK3args args;
- pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V3, NFS3_LINK, cb, private_data, (zdrproc_t)zdr_LINK3res, sizeof(LINK3res));
- if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfs/link call");
- return -1;
- }
-
memset(&args, 0, sizeof(LINK3args));
args.file.data.data_len = file->data.data_len;
args.file.data.data_val = file->data.data_val;
args.link.dir.data.data_val = newdir->data.data_val;
args.link.name = newname;
- if (zdr_LINK3args(&pdu->zdr, &args) == 0) {
- rpc_set_error(rpc, "ZDR error: Failed to encode LINK3args");
+ return rpc_nfs3_link_async(rpc, cb, &args, private_data);
+}
+
+/*
+ * NFSv2
+ */
+int rpc_nfs2_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V2, NFS2_NULL, cb, private_data, (zdrproc_t)zdr_void, 0);
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS2/NULL call");
+ return -1;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS2/NULL call");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+
+ return 0;
+}
+
+int rpc_nfs2_getattr_async(struct rpc_context *rpc, rpc_cb cb, struct GETATTR2args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V2, NFS2_GETATTR, cb, private_data, (zdrproc_t)zdr_GETATTR2res, sizeof(GETATTR2res));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS2/GETATTR call");
+ return -1;
+ }
+
+ if (zdr_GETATTR2args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode GETATTR2args");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS2/GETATTR call");
+ rpc_free_pdu(rpc, pdu);
+ return -3;
+ }
+
+ return 0;
+}
+
+int rpc_nfs2_setattr_async(struct rpc_context *rpc, rpc_cb cb, SETATTR2args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V2, NFS2_SETATTR, cb, private_data, (zdrproc_t)zdr_SETATTR2res, sizeof(SETATTR2res));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS2/SETATTR call");
+ return -1;
+ }
+
+ if (zdr_SETATTR2args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode SETATTR2args");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS2/SETATTR call");
+ rpc_free_pdu(rpc, pdu);
+ return -3;
+ }
+
+ return 0;
+}
+
+int rpc_nfs2_lookup_async(struct rpc_context *rpc, rpc_cb cb, struct LOOKUP2args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V2, NFS2_LOOKUP, cb, private_data, (zdrproc_t)zdr_LOOKUP2res, sizeof(LOOKUP2res));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS2/LOOKUP call");
+ return -1;
+ }
+
+ if (zdr_LOOKUP2args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode LOOKUP2args");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS2/LOOKUP call");
+ rpc_free_pdu(rpc, pdu);
+ return -3;
+ }
+
+ return 0;
+}
+
+int rpc_nfs2_readlink_async(struct rpc_context *rpc, rpc_cb cb, READLINK2args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V2, NFS2_READLINK, cb, private_data, (zdrproc_t)zdr_READLINK2res, sizeof(READLINK2res));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS2/READLINK call");
+ return -1;
+ }
+
+ if (zdr_READLINK2args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode READLINK2args");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS2/READLINK call");
+ rpc_free_pdu(rpc, pdu);
+ return -3;
+ }
+
+ return 0;
+}
+
+int rpc_nfs2_read_async(struct rpc_context *rpc, rpc_cb cb, struct READ2args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V2, NFS2_READ, cb, private_data, (zdrproc_t)zdr_READ2res, sizeof(READ2res));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS2/READ call");
+ return -1;
+ }
+
+ if (zdr_READ2args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode READ2args");
rpc_free_pdu(rpc, pdu);
return -2;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfs/link call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS2/READ call");
rpc_free_pdu(rpc, pdu);
return -3;
}
return 0;
}
+int rpc_nfs2_write_async(struct rpc_context *rpc, rpc_cb cb, struct WRITE2args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V2, NFS2_WRITE, cb, private_data, (zdrproc_t)zdr_WRITE2res, sizeof(WRITE2res));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS2/WRITE call");
+ return -1;
+ }
+ if (zdr_WRITE2args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode WRITE2args");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS2/WRITE call");
+ rpc_free_pdu(rpc, pdu);
+ return -3;
+ }
+
+ return 0;
+}
+
+int rpc_nfs2_create_async(struct rpc_context *rpc, rpc_cb cb, CREATE2args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V2, NFS2_CREATE, cb, private_data, (zdrproc_t)zdr_CREATE2res, sizeof(CREATE2res));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS2/CREATE call");
+ return -1;
+ }
+
+ if (zdr_CREATE2args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode CREATE2args");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS2/CREATE call");
+ rpc_free_pdu(rpc, pdu);
+ return -3;
+ }
+
+ return 0;
+}
+
+int rpc_nfs2_remove_async(struct rpc_context *rpc, rpc_cb cb, struct REMOVE2args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V2, NFS2_REMOVE, cb, private_data, (zdrproc_t)zdr_REMOVE2res, sizeof(REMOVE2res));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/REMOVE call");
+ return -1;
+ }
+
+ if (zdr_REMOVE2args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode REMOVE2args");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS2/REMOVE call");
+ rpc_free_pdu(rpc, pdu);
+ return -3;
+ }
+
+ return 0;
+}
+
+int rpc_nfs2_rename_async(struct rpc_context *rpc, rpc_cb cb, struct RENAME2args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V2, NFS2_RENAME, cb, private_data, (zdrproc_t)zdr_RENAME2res, sizeof(RENAME2res));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS2/RENAME call");
+ return -1;
+ }
+
+ if (zdr_RENAME2args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode RENAME2args");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS2/RENAME call");
+ rpc_free_pdu(rpc, pdu);
+ return -3;
+ }
+
+ return 0;
+}
+
+int rpc_nfs2_link_async(struct rpc_context *rpc, rpc_cb cb, LINK2args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V2, NFS2_LINK, cb, private_data, (zdrproc_t)zdr_LINK2res, sizeof(LINK2res));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS2/LINK call");
+ return -1;
+ }
+
+ if (zdr_LINK2args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode LINK2args");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS2/LINK call");
+ rpc_free_pdu(rpc, pdu);
+ return -3;
+ }
+
+ return 0;
+}
+
+int rpc_nfs2_symlink_async(struct rpc_context *rpc, rpc_cb cb, SYMLINK2args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V2, NFS2_SYMLINK, cb, private_data, (zdrproc_t)zdr_SYMLINK2res, sizeof(SYMLINK2res));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS2/SYMLINK call");
+ return -1;
+ }
+
+ if (zdr_SYMLINK2args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode SYMLINK2args");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS2/SYMLINK call");
+ rpc_free_pdu(rpc, pdu);
+ return -3;
+ }
+
+ return 0;
+}
+
+int rpc_nfs2_mkdir_async(struct rpc_context *rpc, rpc_cb cb, MKDIR2args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V2, NFS2_MKDIR, cb, private_data, (zdrproc_t)zdr_MKDIR2res, sizeof(MKDIR2res));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS2/MKDIR call");
+ return -1;
+ }
+
+ if (zdr_MKDIR2args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode MKDIR2args");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS2/MKDIR call");
+ rpc_free_pdu(rpc, pdu);
+ return -3;
+ }
+
+ return 0;
+}
+
+int rpc_nfs2_rmdir_async(struct rpc_context *rpc, rpc_cb cb, struct RMDIR2args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V2, NFS2_RMDIR, cb, private_data, (zdrproc_t)zdr_RMDIR2res, sizeof(RMDIR2res));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS2/RMDIR call");
+ return -1;
+ }
+
+ if (zdr_RMDIR2args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode RMDIR2args");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS2/RMDIR call");
+ rpc_free_pdu(rpc, pdu);
+ return -3;
+ }
+
+ return 0;
+}
+
+int rpc_nfs2_readdir_async(struct rpc_context *rpc, rpc_cb cb, struct READDIR2args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V2, NFS2_READDIR, cb, private_data, (zdrproc_t)zdr_READDIR2res, sizeof(READDIR2res));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS2/READDIR call");
+ return -1;
+ }
+
+ if (zdr_READDIR2args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode READDIR2args");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS2/READDIR call");
+ rpc_free_pdu(rpc, pdu);
+ return -3;
+ }
+
+ return 0;
+}
+
+int rpc_nfs2_statfs_async(struct rpc_context *rpc, rpc_cb cb, struct STATFS2args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NFS_PROGRAM, NFS_V2, NFS2_STATFS, cb, private_data, (zdrproc_t)zdr_STATFS2res, sizeof(STATFS2res));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS2/STATFS call");
+ return -1;
+ }
+
+ if (zdr_STATFS2args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode STATFS2args");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for NFS2/STATFS call");
+ rpc_free_pdu(rpc, pdu);
+ return -3;
+ }
+
+ return 0;
+}
/* NFS part from rfc 1813, NFSACL part is from wireshark sources */
+/*
+ * NFS v3 Definitions
+ */
const NFS3_FHSIZE = 64; /* Maximum bytes in a V3 file handle */
const NFS3_WRITEVERFSIZE = 8;
const NFS3_CREATEVERFSIZE = 8;
SETATTR3resfail resfail;
};
+/*
+ * NFS v2 Definitions
+ * We share many definitions from v3
+ */
+const FHSIZE2 = 32;
+typedef opaque fhandle2[FHSIZE2];
+
+enum ftype2 {
+ NF2NON = 0,
+ NF2REG = 1,
+ NF2DIR = 2,
+ NF2BLK = 3,
+ NF2CHR = 4,
+ NF2LNK = 5
+};
+
+struct fattr2 {
+ ftype2 type;
+ unsigned int mode;
+ unsigned int nlink;
+ unsigned int uid;
+ unsigned int gid;
+ unsigned int size;
+ unsigned int blocksize;
+ unsigned int rdev;
+ unsigned int blocks;
+ unsigned int fsid;
+ unsigned int fileid;
+ nfstime3 atime;
+ nfstime3 mtime;
+ nfstime3 ctime;
+};
+
+struct sattr2 {
+ unsigned int mode;
+ unsigned int uid;
+ unsigned int gid;
+ unsigned int size;
+ nfstime3 atime;
+ nfstime3 mtime;
+};
+
+const MAXNAMLEN2 = 255;
+typedef string filename2<MAXNAMLEN2>;
+
+const MAXPATHLEN2 = 1024;
+typedef string path2<MAXPATHLEN2>;
+
+const NFSMAXDATA2 = 8192;
+typedef opaque nfsdata2<NFSMAXDATA2>;
+
+const NFSCOOKIESIZE2 = 4;
+typedef opaque nfscookie2[NFSCOOKIESIZE2];
+
+struct entry2 {
+ unsigned int fileid;
+ filename2 name;
+ nfscookie2 cookie;
+ entry2 *nextentry;
+};
+
+struct diropargs2 {
+ fhandle2 dir;
+ filename2 name;
+};
+
+struct GETATTR2args {
+ fhandle2 fhandle;
+};
+
+struct GETATTR2resok {
+ fattr2 attributes;
+};
+
+union GETATTR2res switch (nfsstat3 status) {
+ case NFS3_OK:
+ GETATTR2resok resok;
+ default:
+ void;
+};
+
+struct SETATTR2args {
+ fhandle2 fhandle;
+ sattr2 attributes;
+};
+
+struct SETATTR2resok {
+ fattr2 attributes;
+};
+
+union SETATTR2res switch (nfsstat3 status) {
+ case NFS3_OK:
+ SETATTR2resok resok;
+ default:
+ void;
+};
+
+struct LOOKUP2args {
+ diropargs2 what;
+};
+
+struct LOOKUP2resok {
+ fhandle2 file;
+ fattr2 attributes;
+};
+
+union LOOKUP2res switch (nfsstat3 status) {
+ case NFS3_OK:
+ LOOKUP2resok resok;
+ default:
+ void;
+};
+
+struct READLINK2args {
+ fhandle2 file;
+};
+
+struct READLINK2resok {
+ path2 data;
+};
+
+union READLINK2res switch (nfsstat3 status) {
+ case NFS3_OK:
+ READLINK2resok resok;
+ default:
+ void;
+};
+
+struct READ2args {
+ fhandle2 file;
+ unsigned int offset;
+ unsigned int count;
+ unsigned int totalcount;
+};
+
+struct READ2resok {
+ fattr2 attributes;
+ nfsdata2 data;
+};
+
+union READ2res switch (nfsstat3 status) {
+ case NFS3_OK:
+ READ2resok resok;
+ default:
+ void;
+};
+
+struct WRITE2args {
+ fhandle2 file;
+ unsigned int beginoffset;
+ unsigned int offset;
+ unsigned int totalcount;
+ nfsdata2 data;
+};
+
+struct WRITE2resok {
+ fattr2 attributes;
+};
+
+union WRITE2res switch (nfsstat3 status) {
+ case NFS3_OK:
+ WRITE2resok resok;
+ default:
+ void;
+};
+
+struct CREATE2args {
+ diropargs2 where;
+ sattr2 attributes;
+};
+
+struct CREATE2resok {
+ fhandle2 file;
+ fattr2 attributes;
+};
+
+union CREATE2res switch (nfsstat3 status) {
+ case NFS3_OK:
+ CREATE2resok resok;
+ default:
+ void;
+};
+
+struct REMOVE2args {
+ diropargs2 what;
+};
+
+struct REMOVE2res {
+ nfsstat3 status;
+};
+
+struct RENAME2args {
+ diropargs2 from;
+ diropargs2 to;
+};
+
+struct RENAME2res {
+ nfsstat3 status;
+};
+
+struct LINK2args {
+ fhandle2 from;
+ diropargs2 to;
+};
+
+struct LINK2res {
+ nfsstat3 status;
+};
+
+struct SYMLINK2args {
+ diropargs2 from;
+ path2 to;
+ sattr2 attributes;
+};
+
+struct SYMLINK2res {
+ nfsstat3 status;
+};
+
+struct MKDIR2args {
+ diropargs2 where;
+ sattr2 attributes;
+};
+
+struct MKDIR2resok {
+ fhandle2 file;
+ fattr2 attributes;
+};
+
+union MKDIR2res switch (nfsstat3 status) {
+ case NFS3_OK:
+ MKDIR2resok resok;
+ default:
+ void;
+};
+
+struct RMDIR2args {
+ diropargs2 what;
+};
+
+struct RMDIR2res {
+ nfsstat3 status;
+};
+
+struct READDIR2args {
+ fhandle2 dir;
+ nfscookie2 cookie;
+ unsigned int count;
+};
+
+struct READDIR2resok {
+ entry2 *entries;
+ bool eof;
+};
+
+union READDIR2res switch (nfsstat3 status) {
+ case NFS3_OK:
+ READDIR2resok resok;
+ default:
+ void;
+};
+
+struct STATFS2args {
+ fhandle2 dir;
+};
+
+struct STATFS2resok {
+ unsigned int tsize;
+ unsigned int bsize;
+ unsigned int blocks;
+ unsigned int bfree;
+ unsigned int bavail;
+};
+
+union STATFS2res switch (nfsstat3 status) {
+ case NFS3_OK:
+ STATFS2resok resok;
+ default:
+ void;
+};
+
program NFS_PROGRAM {
+ version NFS_V2 {
+ void
+ NFS2_NULL(void) = 0;
+
+ GETATTR2res
+ NFS2_GETATTR(GETATTR2args) = 1;
+
+ SETATTR2res
+ NFS2_SETATTR(SETATTR2args) = 2;
+
+ LOOKUP2res
+ NFS2_LOOKUP(LOOKUP2args) = 4;
+
+ READLINK2res
+ NFS2_READLINK(READLINK2args) = 5;
+
+ READ2res
+ NFS2_READ(READ2args) = 6;
+
+ WRITE2res
+ NFS2_WRITE(WRITE2args) = 8;
+
+ CREATE2res
+ NFS2_CREATE(CREATE2args) = 9;
+
+ REMOVE2res
+ NFS2_REMOVE(REMOVE2args) = 10;
+
+ RENAME2res
+ NFS2_RENAME(RENAME2args) = 11;
+
+ LINK2res
+ NFS2_LINK(LINK2args) = 12;
+
+ SYMLINK2res
+ NFS2_SYMLINK(SYMLINK2args) = 13;
+
+ MKDIR2res
+ NFS2_MKDIR(MKDIR2args) = 14;
+
+ RMDIR2res
+ NFS2_RMDIR(RMDIR2args) = 15;
+
+ READDIR2res
+ NFS2_READDIR(READDIR2args) = 16;
+
+ STATFS2res
+ NFS2_STATFS(STATFS2args) = 17;
+ } = 2;
+
version NFS_V3 {
void
NFS3_NULL(void) = 0;