wcc->before.pre_op_attr_u.attributes.ctime.nseconds = (inode->ctime % 1000000) * 1000;
}
-void *
-nfsproc3_null_3_svc(void *argp, RPCRequest *req)
+void nfsproc3_null_3_svc(void *argp, RPCRequest *req)
{
- return null_result;
+ async_rpc_send_reply(req, null_result);
}
-getattr3res *
-nfsproc3_getattr_3_svc(nfs_fh3 *argp, RPCRequest *req)
+void nfsproc3_getattr_3_svc(nfs_fh3 *argp, RPCRequest *req)
{
static getattr3res result;
result.status = NFS3ERR_STALE;
}
- return &result;
+ async_rpc_send_reply(req, &result);
}
-wccstat3 *
-nfsproc3_setattr_3_svc(setattr3args *argp, RPCRequest *req)
+void nfsproc3_setattr_3_svc(setattr3args *argp, RPCRequest *req)
{
static wccstat3 result;
BlueSkyInode *inode = lookup_fh(&argp->object);
if (inode == NULL) {
result.status = NFS3ERR_STALE;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
encode_pre_wcc(&result.wccstat3_u.wcc, inode);
result.status = NFS3ERR_NOT_SYNC;
result.wccstat3_u.wcc.after.present = TRUE;
encode_fattr3(&result.wccstat3_u.wcc.after.post_op_attr_u.attributes, inode);
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
}
inode);
result.status = NFS3_OK;
- return &result;
+ async_rpc_send_reply(req, &result);
}
-lookup3res *
-nfsproc3_lookup_3_svc(diropargs3 *argp, RPCRequest *req)
+void nfsproc3_lookup_3_svc(diropargs3 *argp, RPCRequest *req)
{
static lookup3res result;
if (dir == NULL) {
result.status = NFS3ERR_STALE;
result.lookup3res_u.resfail.present = FALSE;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
result.lookup3res_u.resfail.present = TRUE;
result.status = NFS3ERR_NAMETOOLONG;
else
result.status = NFS3ERR_NOENT;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
/* TODO: Special-case "." and "..". */
uint64_t inum = bluesky_directory_lookup(dir, argp->name);
if (inum == 0) {
result.status = NFS3ERR_NOENT;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
BlueSkyInode *inode = bluesky_get_inode(fs, inum);
if (inode == NULL) {
result.status = NFS3ERR_NOENT;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
result.status = NFS3_OK;
result.lookup3res_u.resok.object.data.data_len = 8;
result.lookup3res_u.resok.object.data.data_val = (char *)&fh_bytes;
- return &result;
+ async_rpc_send_reply(req, &result);
}
-access3res *
-nfsproc3_access_3_svc(access3args *argp, RPCRequest *req)
+void nfsproc3_access_3_svc(access3args *argp, RPCRequest *req)
{
static access3res result;
if (inode == NULL) {
result.status = NFS3ERR_STALE;
result.access3res_u.resfail.present = FALSE;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
result.status = NFS3_OK;
encode_fattr3(&result.access3res_u.resok.obj_attributes.post_op_attr_u.attributes, inode);
result.access3res_u.resok.access = argp->access;
- return &result;
+ async_rpc_send_reply(req, &result);
}
-readlink3res *
-nfsproc3_readlink_3_svc(nfs_fh3 *argp, RPCRequest *req)
+void nfsproc3_readlink_3_svc(nfs_fh3 *argp, RPCRequest *req)
{
static readlink3res result;
memset(&result, 0, sizeof(result));
result.status = NFS3ERR_STALE;
}
- return &result;
+ async_rpc_send_reply(req, &result);
}
-read3res *
-nfsproc3_read_3_svc(read3args *argp, RPCRequest *req)
+void nfsproc3_read_3_svc(read3args *argp, RPCRequest *req)
{
static read3res result;
static char buf[32768];
if (inode == NULL) {
result.status = NFS3ERR_STALE;
result.read3res_u.resfail.present = FALSE;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
int count = argp->count;
result.read3res_u.resok.data.data_val = buf;
result.read3res_u.resok.data.data_len = count;
- return &result;
+ async_rpc_send_reply(req, &result);
}
-write3res *
-nfsproc3_write_3_svc(write3args *argp, RPCRequest *req)
+void nfsproc3_write_3_svc(write3args *argp, RPCRequest *req)
{
static write3res result;
struct wcc_data wcc;
if (inode == NULL) {
result.status = NFS3ERR_STALE;
result.write3res_u.resfail = wcc;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
encode_pre_wcc(&wcc, inode);
if (inode->type != BLUESKY_REGULAR) {
result.status = NFS3ERR_INVAL;
result.write3res_u.resfail = wcc;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
uint64_t lastbyte = argp->offset + argp->count;
result.write3res_u.resok.count = argp->count;
result.write3res_u.resok.committed = FILE_SYNC;
- return &result;
+ async_rpc_send_reply(req, &result);
}
-diropres3 *
-nfsproc3_create_3_svc(create3args *argp, RPCRequest *req)
+void nfsproc3_create_3_svc(create3args *argp, RPCRequest *req)
{
static diropres3 result;
struct wcc_data wcc;
if (dir == NULL) {
result.status = NFS3ERR_STALE;
result.diropres3_u.resfail = wcc;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
encode_pre_wcc(&wcc, dir);
if (dir->type != BLUESKY_DIRECTORY) {
result.status = NFS3ERR_NOTDIR;
result.diropres3_u.resfail = wcc;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
if (!validate_filename(argp->where.name)
{
result.status = NFS3ERR_EXIST;
result.diropres3_u.resfail = wcc;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
BlueSkyInode *file;
result.diropres3_u.resok.obj.post_op_fh3_u.handle.data.data_len = 8;
result.diropres3_u.resok.obj.post_op_fh3_u.handle.data.data_val = (char *)&fh_bytes;
- return &result;
+ async_rpc_send_reply(req, &result);
}
-diropres3 *
-nfsproc3_mkdir_3_svc(mkdir3args *argp, RPCRequest *req)
+void nfsproc3_mkdir_3_svc(mkdir3args *argp, RPCRequest *req)
{
static diropres3 result;
struct wcc_data wcc;
if (dir == NULL) {
result.status = NFS3ERR_STALE;
result.diropres3_u.resfail = wcc;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
encode_pre_wcc(&wcc, dir);
if (dir->type != BLUESKY_DIRECTORY) {
result.status = NFS3ERR_NOTDIR;
result.diropres3_u.resfail = wcc;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
if (!validate_filename(argp->where.name)
{
result.status = NFS3ERR_EXIST;
result.diropres3_u.resfail = wcc;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
BlueSkyInode *file;
result.diropres3_u.resok.obj.post_op_fh3_u.handle.data.data_len = 8;
result.diropres3_u.resok.obj.post_op_fh3_u.handle.data.data_val = (char *)&fh_bytes;
- return &result;
+ async_rpc_send_reply(req, &result);
}
-diropres3 *
-nfsproc3_symlink_3_svc(symlink3args *argp, RPCRequest *req)
+void nfsproc3_symlink_3_svc(symlink3args *argp, RPCRequest *req)
{
static diropres3 result;
struct wcc_data wcc;
if (dir == NULL) {
result.status = NFS3ERR_STALE;
result.diropres3_u.resfail = wcc;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
encode_pre_wcc(&wcc, dir);
if (dir->type != BLUESKY_DIRECTORY) {
result.status = NFS3ERR_NOTDIR;
result.diropres3_u.resfail = wcc;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
if (!validate_filename(argp->where.name)
{
result.status = NFS3ERR_EXIST;
result.diropres3_u.resfail = wcc;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
BlueSkyInode *file;
result.diropres3_u.resok.obj.post_op_fh3_u.handle.data.data_len = 8;
result.diropres3_u.resok.obj.post_op_fh3_u.handle.data.data_val = (char *)&fh_bytes;
- return &result;
+ async_rpc_send_reply(req, &result);
}
-diropres3 *
-nfsproc3_mknod_3_svc(mknod3args *argp, RPCRequest *req)
+void nfsproc3_mknod_3_svc(mknod3args *argp, RPCRequest *req)
{
static diropres3 result;
result.status = NFS3ERR_NOTSUPP;
- return &result;
+ async_rpc_send_reply(req, &result);
}
-wccstat3 *
-nfsproc3_remove_3_svc(diropargs3 *argp, RPCRequest *req)
+void nfsproc3_remove_3_svc(diropargs3 *argp, RPCRequest *req)
{
static wccstat3 result;
BlueSkyInode *dir = lookup_fh(&argp->dir);
if (dir == NULL) {
result.status = NFS3ERR_STALE;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
encode_pre_wcc(&result.wccstat3_u.wcc, dir);
|| strcmp(argp->name, "..") == 0)
{
result.status = NFS3ERR_NOENT;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
/* TODO: Decrement link count, deallocate inode if needed. */
encode_fattr3(&result.wccstat3_u.wcc.after.post_op_attr_u.attributes,
dir);
- return &result;
+ async_rpc_send_reply(req, &result);
}
-wccstat3 *
-nfsproc3_rmdir_3_svc(diropargs3 *argp, RPCRequest *req)
+void nfsproc3_rmdir_3_svc(diropargs3 *argp, RPCRequest *req)
{
static wccstat3 result;
BlueSkyInode *dir = lookup_fh(&argp->dir);
if (dir == NULL) {
result.status = NFS3ERR_STALE;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
encode_pre_wcc(&result.wccstat3_u.wcc, dir);
|| strcmp(argp->name, "..") == 0)
{
result.status = NFS3ERR_NOENT;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
uint64_t inum = bluesky_directory_lookup(dir, argp->name);
BlueSkyInode *inode = bluesky_get_inode(fs, inum);
if (inode == NULL) {
result.status = NFS3ERR_NOENT;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
if (inode->type != BLUESKY_DIRECTORY) {
result.status = NFS3ERR_NOTDIR;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
if (g_sequence_get_length(inode->dirents) > 0) {
printf("Directory not empty: %d entries\n",
g_sequence_get_length(inode->dirents));
result.status = NFS3ERR_NOTEMPTY;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
/* TODO: Decrement link count, deallocate inode if needed. */
encode_fattr3(&result.wccstat3_u.wcc.after.post_op_attr_u.attributes,
dir);
- return &result;
+ async_rpc_send_reply(req, &result);
}
-rename3res *
-nfsproc3_rename_3_svc(rename3args *argp, RPCRequest *req)
+void nfsproc3_rename_3_svc(rename3args *argp, RPCRequest *req)
{
static rename3res result;
wcc_data *wcc1 = &result.rename3res_u.res.fromdir_wcc;
BlueSkyInode *dir1 = lookup_fh(&argp->from.dir);
if (dir1 == NULL) {
result.status = NFS3ERR_STALE;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
encode_pre_wcc(wcc1, dir1);
BlueSkyInode *dir2 = lookup_fh(&argp->to.dir);
if (dir2 == NULL) {
result.status = NFS3ERR_STALE;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
encode_pre_wcc(wcc2, dir1);
else
result.status = NFS3ERR_PERM;
- return &result;
+ async_rpc_send_reply(req, &result);
}
-link3res *
-nfsproc3_link_3_svc(link3args *argp, RPCRequest *req)
+void nfsproc3_link_3_svc(link3args *argp, RPCRequest *req)
{
static link3res result;
struct wcc_data wcc;
if (inode == NULL) {
result.status = NFS3ERR_STALE;
result.link3res_u.res.linkdir_wcc = wcc;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
BlueSkyInode *dir = lookup_fh(&argp->link.dir);
if (dir == NULL) {
result.status = NFS3ERR_STALE;
result.link3res_u.res.linkdir_wcc = wcc;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
encode_pre_wcc(&wcc, dir);
if (dir->type != BLUESKY_DIRECTORY) {
result.status = NFS3ERR_NOTDIR;
result.link3res_u.res.linkdir_wcc = wcc;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
if (!validate_filename(argp->link.name)
{
result.status = NFS3ERR_EXIST;
result.link3res_u.res.linkdir_wcc = wcc;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
if (!bluesky_directory_insert(dir, argp->link.name, inode->inum)) {
result.status = NFS3ERR_EXIST;
result.link3res_u.res.linkdir_wcc = wcc;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
inode->nlink++;
bluesky_inode_update_ctime(inode, 0);
encode_fattr3(&result.link3res_u.res.file_attributes.post_op_attr_u.attributes, inode);
result.link3res_u.res.linkdir_wcc = wcc;
- return &result;
+ async_rpc_send_reply(req, &result);
}
gint bluesky_dirent_compare(gconstpointer a, gconstpointer b,
gpointer unused);
#define MAX_READDIR_DIRENTS 64
-readdir3res *
-nfsproc3_readdir_3_svc(readdir3args *argp, RPCRequest *req)
+void nfsproc3_readdir_3_svc(readdir3args *argp, RPCRequest *req)
{
static readdir3res result;
if (dir == NULL) {
result.status = NFS3ERR_STALE;
result.readdir3res_u.resfail.present = FALSE;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
result.status = NFS3_OK;
result.readdir3res_u.resok.reply.entries = NULL;
result.readdir3res_u.resok.reply.eof = g_sequence_iter_is_end(i);
- return &result;
+ async_rpc_send_reply(req, &result);
}
-readdirplus3res *
-nfsproc3_readdirplus_3_svc(readdirplus3args *argp, RPCRequest *req)
+void nfsproc3_readdirplus_3_svc(readdirplus3args *argp, RPCRequest *req)
{
/* XDR-encoded sizes:
* post_op_attr: 88 bytes
if (dir == NULL) {
result.status = NFS3ERR_STALE;
result.readdirplus3res_u.resfail.present = FALSE;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
result.status = NFS3_OK;
result.readdirplus3res_u.resok.reply.entries = NULL;
result.readdirplus3res_u.resok.reply.eof = g_sequence_iter_is_end(i);
- return &result;
+ async_rpc_send_reply(req, &result);
}
-fsstat3res *
-nfsproc3_fsstat_3_svc(nfs_fh3 *argp, RPCRequest *req)
+void nfsproc3_fsstat_3_svc(nfs_fh3 *argp, RPCRequest *req)
{
static fsstat3res result;
if (inode == NULL) {
result.status = NFS3ERR_STALE;
result.fsstat3res_u.resfail.present = FALSE;
- return &result;
+ async_rpc_send_reply(req, &result);
+ return;
}
result.status = NFS3_OK;
result.fsstat3res_u.resok.afiles = 0;
result.fsstat3res_u.resok.invarsec = 0;
- return &result;
+ async_rpc_send_reply(req, &result);
}
-fsinfo3res *
-nfsproc3_fsinfo_3_svc(nfs_fh3 *argp, RPCRequest *req)
+void nfsproc3_fsinfo_3_svc(nfs_fh3 *argp, RPCRequest *req)
{
static fsinfo3res result;
result.fsinfo3res_u.resok.properties
= FSF3_LINK | FSF3_SYMLINK | FSF3_HOMOGENEOUS | FSF3_CANSETTIME;
- return &result;
+ async_rpc_send_reply(req, &result);
}
-pathconf3res *
-nfsproc3_pathconf_3_svc(nfs_fh3 *argp, RPCRequest *req)
+void nfsproc3_pathconf_3_svc(nfs_fh3 *argp, RPCRequest *req)
{
static pathconf3res result;
result.pathconf3res_u.resok.case_insensitive = FALSE;
result.pathconf3res_u.resok.case_preserving = TRUE;
- return &result;
+ async_rpc_send_reply(req, &result);
}
-commit3res *
-nfsproc3_commit_3_svc(commit3args *argp, RPCRequest *req)
+void nfsproc3_commit_3_svc(commit3args *argp, RPCRequest *req)
{
static commit3res result;
result.status = NFS3ERR_NOTSUPP;
- return &result;
+ async_rpc_send_reply(req, &result);
}
#define NFS_V3 3
#define NFSPROC3_NULL 0
-extern void * nfsproc3_null_3_svc(void *, RPCRequest *);
+extern void nfsproc3_null_3_svc(void *, RPCRequest *);
#define NFSPROC3_GETATTR 1
-extern getattr3res * nfsproc3_getattr_3_svc(nfs_fh3 *, RPCRequest *);
+extern void nfsproc3_getattr_3_svc(nfs_fh3 *, RPCRequest *);
#define NFSPROC3_SETATTR 2
-extern wccstat3 * nfsproc3_setattr_3_svc(setattr3args *, RPCRequest *);
+extern void nfsproc3_setattr_3_svc(setattr3args *, RPCRequest *);
#define NFSPROC3_LOOKUP 3
-extern lookup3res * nfsproc3_lookup_3_svc(diropargs3 *, RPCRequest *);
+extern void nfsproc3_lookup_3_svc(diropargs3 *, RPCRequest *);
#define NFSPROC3_ACCESS 4
-extern access3res * nfsproc3_access_3_svc(access3args *, RPCRequest *);
+extern void nfsproc3_access_3_svc(access3args *, RPCRequest *);
#define NFSPROC3_READLINK 5
-extern readlink3res * nfsproc3_readlink_3_svc(nfs_fh3 *, RPCRequest *);
+extern void nfsproc3_readlink_3_svc(nfs_fh3 *, RPCRequest *);
#define NFSPROC3_READ 6
-extern read3res * nfsproc3_read_3_svc(read3args *, RPCRequest *);
+extern void nfsproc3_read_3_svc(read3args *, RPCRequest *);
#define NFSPROC3_WRITE 7
-extern write3res * nfsproc3_write_3_svc(write3args *, RPCRequest *);
+extern void nfsproc3_write_3_svc(write3args *, RPCRequest *);
#define NFSPROC3_CREATE 8
-extern diropres3 * nfsproc3_create_3_svc(create3args *, RPCRequest *);
+extern void nfsproc3_create_3_svc(create3args *, RPCRequest *);
#define NFSPROC3_MKDIR 9
-extern diropres3 * nfsproc3_mkdir_3_svc(mkdir3args *, RPCRequest *);
+extern void nfsproc3_mkdir_3_svc(mkdir3args *, RPCRequest *);
#define NFSPROC3_SYMLINK 10
-extern diropres3 * nfsproc3_symlink_3_svc(symlink3args *, RPCRequest *);
+extern void nfsproc3_symlink_3_svc(symlink3args *, RPCRequest *);
#define NFSPROC3_MKNOD 11
-extern diropres3 * nfsproc3_mknod_3_svc(mknod3args *, RPCRequest *);
+extern void nfsproc3_mknod_3_svc(mknod3args *, RPCRequest *);
#define NFSPROC3_REMOVE 12
-extern wccstat3 * nfsproc3_remove_3_svc(diropargs3 *, RPCRequest *);
+extern void nfsproc3_remove_3_svc(diropargs3 *, RPCRequest *);
#define NFSPROC3_RMDIR 13
-extern wccstat3 * nfsproc3_rmdir_3_svc(diropargs3 *, RPCRequest *);
+extern void nfsproc3_rmdir_3_svc(diropargs3 *, RPCRequest *);
#define NFSPROC3_RENAME 14
-extern rename3res * nfsproc3_rename_3_svc(rename3args *, RPCRequest *);
+extern void nfsproc3_rename_3_svc(rename3args *, RPCRequest *);
#define NFSPROC3_LINK 15
-extern link3res * nfsproc3_link_3_svc(link3args *, RPCRequest *);
+extern void nfsproc3_link_3_svc(link3args *, RPCRequest *);
#define NFSPROC3_READDIR 16
-extern readdir3res * nfsproc3_readdir_3_svc(readdir3args *, RPCRequest *);
+extern void nfsproc3_readdir_3_svc(readdir3args *, RPCRequest *);
#define NFSPROC3_READDIRPLUS 17
-extern readdirplus3res * nfsproc3_readdirplus_3_svc(readdirplus3args *, RPCRequest *);
+extern void nfsproc3_readdirplus_3_svc(readdirplus3args *, RPCRequest *);
#define NFSPROC3_FSSTAT 18
-extern fsstat3res * nfsproc3_fsstat_3_svc(nfs_fh3 *, RPCRequest *);
+extern void nfsproc3_fsstat_3_svc(nfs_fh3 *, RPCRequest *);
#define NFSPROC3_FSINFO 19
-extern fsinfo3res * nfsproc3_fsinfo_3_svc(nfs_fh3 *, RPCRequest *);
+extern void nfsproc3_fsinfo_3_svc(nfs_fh3 *, RPCRequest *);
#define NFSPROC3_PATHCONF 20
-extern pathconf3res * nfsproc3_pathconf_3_svc(nfs_fh3 *, RPCRequest *);
+extern void nfsproc3_pathconf_3_svc(nfs_fh3 *, RPCRequest *);
#define NFSPROC3_COMMIT 21
-extern commit3res * nfsproc3_commit_3_svc(commit3args *, RPCRequest *);
+extern void nfsproc3_commit_3_svc(commit3args *, RPCRequest *);
/* the xdr functions */