+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for NFS3/GETATTR call");
+ return -1;
+ }
+
+ 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 NFS3/GETATTR call");
+ rpc_free_pdu(rpc, pdu);
+ return -3;
+ }
+
+ return 0;
+}
+
+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;
+
+ 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 NFS3/PATHCONF call");
+ return -1;
+ }
+
+ 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 NFS3/PATHCONF 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)
+{
+ 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;
+
+ 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 NFS3/LOOKUP call");
+ return -1;
+ }
+
+ 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 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;
+
+ 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;
+
+ 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 NFS3/ACCESS call");
+ return -1;
+ }
+
+ 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 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_nfs3_read_async(struct rpc_context *rpc, rpc_cb cb, struct READ3args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ 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 NFS3/READ call");
+ return -1;
+ }
+
+ 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 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;
+
+ 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;
+
+ 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 NFS3/WRITE call");
+ return -1;
+ }
+
+ 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 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_nfs3_commit_async(struct rpc_context *rpc, rpc_cb cb, struct COMMIT3args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ 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 NFS3/COMMIT call");
+ return -1;
+ }
+
+ 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 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;
+
+ 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 NFS3/SETATTR call");
+ return -1;
+ }
+
+ if (zdr_SETATTR3args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode SETATTR3args");
+ 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/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_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 NFS3/MKDIR call");
+ return -1;
+ }
+
+ if (zdr_MKDIR3args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode MKDIR3args");
+ 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/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_nfs3_rmdir_async(struct rpc_context *rpc, rpc_cb cb, struct RMDIR3args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ 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 NFS3/RMDIR call");
+ return -1;
+ }
+
+ 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 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_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 NFS3/CREATE call");
+ return -1;
+ }
+
+ if (zdr_CREATE3args(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode CREATE3args");
+ 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/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_nfs3_mknod_async(struct rpc_context *rpc, rpc_cb cb, struct MKNOD3args *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ 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 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.chr_device.dev_attributes.mode.set_it = 1;
+ args.what.mknoddata3_u.chr_device.dev_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);
+ args.what.mknoddata3_u.chr_device.spec.specdata1 = major;
+ args.what.mknoddata3_u.chr_device.spec.specdata2 = minor;
+ break;
+ case S_IFBLK:
+ args.what.type = NF3BLK;
+ args.what.mknoddata3_u.blk_device.dev_attributes.mode.set_it = 1;
+ args.what.mknoddata3_u.blk_device.dev_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);
+ args.what.mknoddata3_u.blk_device.spec.specdata1 = major;
+ args.what.mknoddata3_u.blk_device.spec.specdata2 = minor;
+ case S_IFSOCK:
+ args.what.type = NF3SOCK;
+ args.what.mknoddata3_u.sock_attributes.mode.set_it = 1;
+ args.what.mknoddata3_u.sock_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;
+ case S_IFIFO:
+ args.what.type = NF3FIFO;
+ args.what.mknoddata3_u.pipe_attributes.mode.set_it = 1;
+ 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 NFS3/MKNOD call");
+ return -1;
+ }
+
+ 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 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)
+{
+ REMOVE3args args;
+
+ 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;
+
+ 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 NFS3/READDIR call");
+ rpc_free_pdu(rpc, pdu);
+ return -3;
+ }
+
+ return 0;
+}
+
+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)
+{
+ READDIR3args args;
+
+ memset(&args, 0, sizeof(READDIR3args));
+ args.dir.data.data_len = fh->data.data_len;
+ args.dir.data.data_val = fh->data.data_val;
+ args.cookie = cookie;
+ memcpy(&args.cookieverf, cookieverf, sizeof(cookieverf3));
+ args.count = count;
+
+ 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 NFS3/READDIRPLUS call");
+ rpc_free_pdu(rpc, pdu);
+ return -3;
+ }
+
+ return 0;
+}
+
+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)
+{
+ READDIRPLUS3args args;
+
+ memset(&args, 0, sizeof(READDIRPLUS3args));
+ args.dir.data.data_len = fh->data.data_len;
+ args.dir.data.data_val = fh->data.data_val;
+ args.cookie = cookie;
+ memcpy(&args.cookieverf, cookieverf, sizeof(cookieverf3));
+ args.dircount = count;
+ args.maxcount = count;
+
+ 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 NFS3/FSSTAT call");
+ rpc_free_pdu(rpc, pdu);
+ return -3;
+ }
+
+ return 0;
+}
+
+int rpc_nfs_fsstat_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data)
+{
+ FSSTAT3args args;
+
+ 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 NFS3/FSINFO call");
+ return -1;
+ }
+
+ 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 NFS3/FSINFO call");
+ rpc_free_pdu(rpc, pdu);
+ return -3;
+ }
+
+ return 0;
+}
+
+int rpc_nfs_fsinfo_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data)
+{
+ FSINFO3args args;
+
+ 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, &args, 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 NFS3/READLINK call");