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 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 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.
+ */
+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 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 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 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 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 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.
+ */
+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 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 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.
+ */
+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_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
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)
{
} 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 ();
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 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;