From 8200797a31d02975f5280688c34e5fbe22707656 Mon Sep 17 00:00:00 2001 From: tol Date: Wed, 28 Mar 2007 12:05:47 +0000 Subject: [PATCH] forget about device fd, we don't need it --- nnpfs/bsd/nnpfs/nnpfs.h | 1 - nnpfs/bsd/nnpfs/nnpfs_dev.h | 12 +++++---- nnpfs/bsd/nnpfs/nnpfs_msg_locl.h | 20 +++++++------- nnpfs/bsd/nnpfs_blocks.c | 2 +- nnpfs/bsd/nnpfs_dev-bsd.c | 2 +- nnpfs/bsd/nnpfs_dev-common.c | 47 +++++++++++++++++---------------- nnpfs/bsd/nnpfs_message.c | 55 ++++++++++++++++++--------------------- nnpfs/bsd/nnpfs_syscalls-common.c | 8 +++--- nnpfs/bsd/nnpfs_vfsops-common.c | 3 +-- nnpfs/bsd/nnpfs_vnodeops-common.c | 30 ++++++++++----------- 10 files changed, 89 insertions(+), 91 deletions(-) diff --git a/nnpfs/bsd/nnpfs/nnpfs.h b/nnpfs/bsd/nnpfs/nnpfs.h index 08dcf94d8..38180c0d2 100644 --- a/nnpfs/bsd/nnpfs/nnpfs.h +++ b/nnpfs/bsd/nnpfs/nnpfs.h @@ -83,7 +83,6 @@ struct nnpfs { #define CHANNEL_CLOSING 0x10 struct mount *mp; struct nnpfs_node *root; - int fd; struct nnpfs_nodelist_head nodehead; struct nh_node_list freehead; /* char device */ diff --git a/nnpfs/bsd/nnpfs/nnpfs_dev.h b/nnpfs/bsd/nnpfs/nnpfs_dev.h index 5360a1d28..caa01f99f 100644 --- a/nnpfs/bsd/nnpfs/nnpfs_dev.h +++ b/nnpfs/bsd/nnpfs/nnpfs_dev.h @@ -96,24 +96,26 @@ nnpfs_devpoll(nnpfs_dev_t dev, int events, d_thread_t * p); #endif int -nnpfs_message_send(int fd, struct nnpfs_message_header * message, u_int size); +nnpfs_message_send(struct nnpfs *chan, struct nnpfs_message_header * message, u_int size); int -nnpfs_message_rpc(int fd, struct nnpfs_message_header * message, u_int size, +nnpfs_message_rpc(struct nnpfs *nnpfsp, + struct nnpfs_message_header *message, u_int size, d_thread_t *proc); int -nnpfs_message_rpc_async(int fd, struct nnpfs_message_header * message, u_int size, +nnpfs_message_rpc_async(struct nnpfs *nnpfsp, + struct nnpfs_message_header *message, u_int size, d_thread_t *proc); int -nnpfs_message_receive(int fd, +nnpfs_message_receive(struct nnpfs *nnpfsp, struct nnpfs_message_header *message, u_int size, d_thread_t *p); int -nnpfs_message_wakeup(int fd, +nnpfs_message_wakeup(struct nnpfs *chan, struct nnpfs_message_wakeup *message, u_int size, d_thread_t *p); diff --git a/nnpfs/bsd/nnpfs/nnpfs_msg_locl.h b/nnpfs/bsd/nnpfs/nnpfs_msg_locl.h index baea58346..9fa4951d0 100644 --- a/nnpfs/bsd/nnpfs/nnpfs_msg_locl.h +++ b/nnpfs/bsd/nnpfs/nnpfs_msg_locl.h @@ -37,61 +37,61 @@ #define _nnpfs_msg_locl_h int -nnpfs_message_installroot(int fd, +nnpfs_message_installroot(struct nnpfs *nnpfsp, struct nnpfs_message_installroot * message, u_int size, d_thread_t *p); int -nnpfs_message_installnode(int fd, +nnpfs_message_installnode(struct nnpfs *nnpfsp, struct nnpfs_message_installnode * message, u_int size, d_thread_t *p); int -nnpfs_message_installattr(int fd, +nnpfs_message_installattr(struct nnpfs *nnpfsp, struct nnpfs_message_installattr * message, u_int size, d_thread_t *p); int -nnpfs_message_installdata(int fd, +nnpfs_message_installdata(struct nnpfs *nnpfsp, struct nnpfs_message_installdata * message, u_int size, d_thread_t *p); int -nnpfs_message_invalidnode(int fd, +nnpfs_message_invalidnode(struct nnpfs *nnpfsp, struct nnpfs_message_invalidnode * message, u_int size, d_thread_t *p); int -nnpfs_message_updatefid(int fd, +nnpfs_message_updatefid(struct nnpfs *nnpfsp, struct nnpfs_message_updatefid * message, u_int size, d_thread_t *p); int -nnpfs_message_gc(int fd, +nnpfs_message_gc(struct nnpfs *nnpfsp, struct nnpfs_message_gc *message, u_int size, d_thread_t *p); int -nnpfs_message_version(int fd, +nnpfs_message_version(struct nnpfs *nnpfsp, struct nnpfs_message_version *message, u_int size, d_thread_t *p); int -nnpfs_message_delete_node(int fd, +nnpfs_message_delete_node(struct nnpfs *nnpfsp, struct nnpfs_message_delete_node *message, u_int size, d_thread_t *p); int -nnpfs_message_installquota(int fd, +nnpfs_message_installquota(struct nnpfs *nnpfsp, struct nnpfs_message_installquota *message, u_int size, d_thread_t *p); diff --git a/nnpfs/bsd/nnpfs_blocks.c b/nnpfs/bsd/nnpfs_blocks.c index d7feead8e..8eefe9554 100644 --- a/nnpfs/bsd/nnpfs_blocks.c +++ b/nnpfs/bsd/nnpfs_blocks.c @@ -688,5 +688,5 @@ nnpfs_block_create(struct nnpfs_node *node, uint64_t offset) msg.offset = offset; /* XXX currently no cleanup on failed send, hope it's just a devclose */ - return nnpfs_message_send(nnpfsp->fd, &msg.header, sizeof(msg)); + return nnpfs_message_send(nnpfsp, &msg.header, sizeof(msg)); } diff --git a/nnpfs/bsd/nnpfs_dev-bsd.c b/nnpfs/bsd/nnpfs_dev-bsd.c index ebbbb7024..7225ce333 100644 --- a/nnpfs/bsd/nnpfs_dev-bsd.c +++ b/nnpfs/bsd/nnpfs_dev-bsd.c @@ -240,7 +240,7 @@ nnpfs_uninstall_device(void) #if defined(__DragonFly__) nnpfs_devclose(make_adhoc_dev(&nnpfs_cdev, i), 0, 0, NULL); #elif defined(__FreeBSD__) - nnpfs_devclose(nnpfs_dev[i].dev, 0, 0, NULL); + nnpfs_devclose(chan->dev, 0, 0, NULL); #else nnpfs_devclose(makedev(0, i), 0, 0, NULL); #endif diff --git a/nnpfs/bsd/nnpfs_dev-common.c b/nnpfs/bsd/nnpfs_dev-common.c index ff4faf726..4e46e00d3 100644 --- a/nnpfs/bsd/nnpfs_dev-common.c +++ b/nnpfs/bsd/nnpfs_dev-common.c @@ -340,7 +340,7 @@ nnpfs_devwrite(nnpfs_dev_t dev, struct uio *uiop, int ioflag) error = EINVAL; break; } - ret = nnpfs_message_receive (minor(dev), + ret = nnpfs_message_receive(chan, msg_buf, msg_buf->size, pp); @@ -361,9 +361,9 @@ nnpfs_devwrite(nnpfs_dev_t dev, struct uio *uiop, int ioflag) * Send a message to user space. */ int -nnpfs_message_send(int fd, struct nnpfs_message_header * message, u_int size) +nnpfs_message_send(struct nnpfs *chan, + struct nnpfs_message_header *message, u_int size) { - struct nnpfs *chan = &nnpfs_dev[fd]; struct async_link *t; NNPFSDEB(XDEBMSG, ("nnpfs_message_send opcode = %d\n", message->opcode)); @@ -429,11 +429,11 @@ nnpfs_block_sigset (sigset_t *sigset) */ static int -nnpfs_message_rpc_int(int fd, struct nnpfs_message_header * message, u_int size, +nnpfs_message_rpc_int(struct nnpfs *chan, + struct nnpfs_message_header *message, u_int size, d_thread_t *proc, int async) { int ret; - struct nnpfs *chan = &nnpfs_dev[fd]; struct nnpfs_link *this_message; struct nnpfs_link *this_process; struct nnpfs_message_header *msg; @@ -636,17 +636,19 @@ nnpfs_message_rpc_int(int fd, struct nnpfs_message_header * message, u_int size, } int -nnpfs_message_rpc(int fd, struct nnpfs_message_header * message, u_int size, +nnpfs_message_rpc(struct nnpfs *nnpfsp, + struct nnpfs_message_header *message, u_int size, d_thread_t *proc) { - return nnpfs_message_rpc_int(fd, message, size, proc, FALSE); + return nnpfs_message_rpc_int(nnpfsp, message, size, proc, FALSE); } int -nnpfs_message_rpc_async(int fd, struct nnpfs_message_header * message, u_int size, +nnpfs_message_rpc_async(struct nnpfs *nnpfsp, + struct nnpfs_message_header *message, u_int size, d_thread_t *proc) { - return nnpfs_message_rpc_int(fd, message, size, proc, TRUE); + return nnpfs_message_rpc_int(nnpfsp, message, size, proc, TRUE); } /* @@ -655,7 +657,7 @@ nnpfs_message_rpc_async(int fd, struct nnpfs_message_header * message, u_int siz * invokes the correct function. */ int -nnpfs_message_receive(int fd, +nnpfs_message_receive(struct nnpfs *nnpfsp, struct nnpfs_message_header *message, u_int size, d_thread_t *p) @@ -665,58 +667,58 @@ nnpfs_message_receive(int fd, /* Dispatch and coerce message type */ switch (message->opcode) { case NNPFS_MSG_WAKEUP: - return nnpfs_message_wakeup(fd, + return nnpfs_message_wakeup(nnpfsp, (struct nnpfs_message_wakeup *) message, message->size, p); case NNPFS_MSG_INSTALLROOT: - return nnpfs_message_installroot(fd, + return nnpfs_message_installroot(nnpfsp, (struct nnpfs_message_installroot *) message, message->size, p); case NNPFS_MSG_INSTALLNODE: - return nnpfs_message_installnode(fd, + return nnpfs_message_installnode(nnpfsp, (struct nnpfs_message_installnode *) message, message->size, p); case NNPFS_MSG_INSTALLATTR: - return nnpfs_message_installattr(fd, + return nnpfs_message_installattr(nnpfsp, (struct nnpfs_message_installattr *) message, message->size, p); case NNPFS_MSG_INSTALLDATA: - return nnpfs_message_installdata(fd, + return nnpfs_message_installdata(nnpfsp, (struct nnpfs_message_installdata *) message, message->size, p); case NNPFS_MSG_INVALIDNODE: - return nnpfs_message_invalidnode(fd, + return nnpfs_message_invalidnode(nnpfsp, (struct nnpfs_message_invalidnode *) message, message->size, p); case NNPFS_MSG_UPDATEFID: - return nnpfs_message_updatefid(fd, + return nnpfs_message_updatefid(nnpfsp, (struct nnpfs_message_updatefid *)message, message->size, p); case NNPFS_MSG_GC: - return nnpfs_message_gc(fd, + return nnpfs_message_gc(nnpfsp, (struct nnpfs_message_gc *)message, message->size, p); case NNPFS_MSG_DELETE_NODE: - return nnpfs_message_delete_node(fd, + return nnpfs_message_delete_node(nnpfsp, (struct nnpfs_message_delete_node *)message, message->size, p); case NNPFS_MSG_INSTALLQUOTA: - return nnpfs_message_installquota(fd, + return nnpfs_message_installquota(nnpfsp, (struct nnpfs_message_installquota *)message, message->size, p); case NNPFS_MSG_VERSION: - return nnpfs_message_version(fd, + return nnpfs_message_version(nnpfsp, (struct nnpfs_message_version *)message, message->size, p); @@ -766,12 +768,11 @@ async_return(struct nnpfs *chan, } int -nnpfs_message_wakeup(int fd, +nnpfs_message_wakeup(struct nnpfs *chan, struct nnpfs_message_wakeup *message, u_int size, d_thread_t *p) { - struct nnpfs *chan = &nnpfs_dev[fd]; struct nnpfs_link *t; NNPFSDEB(XDEBMSG, ("nnpfs_message_wakeup error: %d\n", message->error)); diff --git a/nnpfs/bsd/nnpfs_message.c b/nnpfs/bsd/nnpfs_message.c index 3430b1f55..5a87e9c19 100644 --- a/nnpfs/bsd/nnpfs_message.c +++ b/nnpfs/bsd/nnpfs_message.c @@ -44,7 +44,7 @@ RCSID("$Id$"); int -nnpfs_message_installroot(int fd, +nnpfs_message_installroot(struct nnpfs *nnpfsp, struct nnpfs_message_installroot * message, u_int size, d_thread_t *p) @@ -57,14 +57,14 @@ nnpfs_message_installroot(int fd, message->node.handle.c, message->node.handle.d)); - if (nnpfs_dev[fd].root != NULL) { + if (nnpfsp->root != NULL) { printf("NNPFS PANIC nnpfs_message_installroot: called again!\n"); error = EBUSY; } else { - error = nnpfs_new_node(&nnpfs_dev[fd], + error = nnpfs_new_node(nnpfsp, &message->node, NULL, - &nnpfs_dev[fd].root, + &nnpfsp->root, p, 1 /* mark as root */); } @@ -75,7 +75,7 @@ nnpfs_message_installroot(int fd, } int -nnpfs_message_installnode(int fd, +nnpfs_message_installnode(struct nnpfs *nnpfsp, struct nnpfs_message_installnode * message, u_int size, d_thread_t *p) @@ -90,7 +90,7 @@ nnpfs_message_installnode(int fd, message->node.handle.d)); retry: - error = nnpfs_node_find(&nnpfs_dev[fd], &message->parent_handle, &dp); + error = nnpfs_node_find(nnpfsp, &message->parent_handle, &dp); if (error) { if (error == EISDIR) NNPFSDEB(XDEBMSG, ("installnode: parent node deleted\n")); @@ -109,7 +109,7 @@ retry: if (nnpfs_do_vget(t_vnode, 0 /* LK_SHARED */, p)) goto retry; - error = nnpfs_new_node(&nnpfs_dev[fd], &message->node, NULL, &n, p, 0); + error = nnpfs_new_node(nnpfsp, &message->node, NULL, &n, p, 0); if (error) { nnpfs_vletgo(t_vnode); return error; @@ -131,7 +131,7 @@ retry: } int -nnpfs_message_installattr(int fd, +nnpfs_message_installattr(struct nnpfs *nnpfsp, struct nnpfs_message_installattr * message, u_int size, d_thread_t *p) @@ -146,7 +146,7 @@ nnpfs_message_installattr(int fd, message->node.handle.c, message->node.handle.d)); - error = nnpfs_node_find(&nnpfs_dev[fd], &message->node.handle, &t); + error = nnpfs_node_find(nnpfsp, &message->node.handle, &t); if (error) { if (error == EISDIR) { NNPFSDEB(XDEBMSG, ("nnpfs_message_installattr: node deleted\n")); @@ -190,7 +190,7 @@ nnpfs_message_installattr(int fd, } int -nnpfs_message_installdata(int fd, +nnpfs_message_installdata(struct nnpfs *nnpfsp, struct nnpfs_message_installdata * message, u_int size, d_thread_t *p) @@ -209,7 +209,7 @@ nnpfs_message_installdata(int fd, (unsigned long long)message->offset)); retry: - error = nnpfs_node_find(&nnpfs_dev[fd], &message->node.handle, &t); + error = nnpfs_node_find(nnpfsp, &message->node.handle, &t); if (error) { if (error == ENOENT) { printf("NNPFS PANIC WARNING! nnpfs_message_installdata failed\n"); @@ -333,12 +333,11 @@ nnpfs_message_installdata(int fd, } int -nnpfs_message_invalidnode(int fd, +nnpfs_message_invalidnode(struct nnpfs *nnpfsp, struct nnpfs_message_invalidnode * message, u_int size, d_thread_t *p) { - struct nnpfs *nnpfsp = &nnpfs_dev[fd]; struct nnpfs_node *t; struct vnode *vp; int error; @@ -407,7 +406,7 @@ nnpfs_message_invalidnode(int fd, } int -nnpfs_message_updatefid(int fd, +nnpfs_message_updatefid(struct nnpfs *nnpfsp, struct nnpfs_message_updatefid * message, u_int size, d_thread_t *p) @@ -424,7 +423,7 @@ nnpfs_message_updatefid(int fd, message->new_handle.c, message->new_handle.d)); - error = nnpfs_update_handle(&nnpfs_dev[fd], + error = nnpfs_update_handle(nnpfsp, &message->old_handle, &message->new_handle); if (error) @@ -506,7 +505,7 @@ gc_vnode(struct vnode *vp, d_thread_t *p) #endif /* !__APPLE__ */ static int -gc_block(int fd, +gc_block(struct nnpfs *nnpfsp, struct nnpfs_node *xn, uint64_t offset, d_thread_t *p) @@ -555,7 +554,7 @@ gc_block(int fd, /* XXX locking, rpc may fail */ xn->daemon_length = nnpfs_vattr_get_size(&xn->attr); nnpfs_block_setinvalid(xn, offset); - error = nnpfs_message_rpc_async(fd, &msg.header, sizeof(msg), p); + error = nnpfs_message_rpc_async(nnpfsp, &msg.header, sizeof(msg), p); } else { struct nnpfs_message_deletedata msg; @@ -564,7 +563,7 @@ gc_block(int fd, msg.offset = offset; nnpfs_block_setinvalid(xn, offset); - error = nnpfs_message_send(fd, &msg.header, sizeof(msg)); + error = nnpfs_message_send(nnpfsp, &msg.header, sizeof(msg)); } if (error) @@ -594,7 +593,7 @@ gc_block(int fd, */ int -nnpfs_message_gc(int fd, +nnpfs_message_gc(struct nnpfs *nnpfsp, struct nnpfs_message_gc *message, u_int size, d_thread_t *p) @@ -605,7 +604,7 @@ nnpfs_message_gc(int fd, NNPFSDEB(XDEBMSG, ("nnpfs_message_gc\n")); for (i = 0; i < message->len; i++) { - int error = nnpfs_node_find(&nnpfs_dev[fd], + int error = nnpfs_node_find(nnpfsp, &message->handle[i].node, &node); if (error) { if (error == ENOENT) @@ -617,7 +616,7 @@ nnpfs_message_gc(int fd, if (message->handle[i].offset == NNPFS_NO_OFFSET) gc_vnode(XNODE_TO_VNODE(node), p); else { - gc_block(fd, node, message->handle[i].offset, p); + gc_block(nnpfsp, node, message->handle[i].offset, p); } } @@ -630,13 +629,12 @@ nnpfs_message_gc(int fd, */ int -nnpfs_message_version(int fd, +nnpfs_message_version(struct nnpfs *nnpfsp, struct nnpfs_message_version *message, u_int size, d_thread_t *p) { struct nnpfs_message_wakeup msg; - struct nnpfs *nnpfsp = &nnpfs_dev[fd]; int ret = NNPFS_VERSION; int error = 0; @@ -676,7 +674,7 @@ nnpfs_message_version(int fd, msg.error = ret; msg.len = 0; - return nnpfs_message_send(fd, + return nnpfs_message_send(nnpfsp, (struct nnpfs_message_header *) &msg, sizeof(msg)); } @@ -686,13 +684,12 @@ nnpfs_message_version(int fd, */ int -nnpfs_message_delete_node(int fd, +nnpfs_message_delete_node(struct nnpfs *nnpfsp, struct nnpfs_message_delete_node *message, u_int size, d_thread_t *p) { struct nnpfs_node *node; - struct nnpfs *nnpfsp = &nnpfs_dev[fd]; int ret; NNPFSDEB(XDEBMSG, ("nnpfs_message_delete_node\n")); @@ -706,7 +703,7 @@ nnpfs_message_delete_node(int fd, NNPFSDEB(XDEBMSG, ("nnpfs_delete_node: flags 0x%x\n", node->flags)); if (node->flags & NNPFS_LIMBO) { NNPFSDEB(XDEBMSG, ("nnpfs_delete_node: free node\n")); - nnpfs_free_node(&nnpfs_dev[fd], node); + nnpfs_free_node(nnpfsp, node); } else { NNPFSDEB(XDEBMSG, ("nnpfs_delete_node: not deleted")); } @@ -719,13 +716,11 @@ nnpfs_message_delete_node(int fd, */ int -nnpfs_message_installquota(int fd, +nnpfs_message_installquota(struct nnpfs *nnpfsp, struct nnpfs_message_installquota *message, u_int size, d_thread_t *p) { - struct nnpfs *nnpfsp = &nnpfs_dev[fd]; - NNPFSDEB(XDEBMSG, ("nnpfs_message_installquota\n")); nnpfsp->appendquota += message->appendbytes; diff --git a/nnpfs/bsd/nnpfs_syscalls-common.c b/nnpfs/bsd/nnpfs_syscalls-common.c index 902902e2f..f5f60f013 100644 --- a/nnpfs/bsd/nnpfs_syscalls-common.c +++ b/nnpfs/bsd/nnpfs_syscalls-common.c @@ -392,6 +392,7 @@ remote_pioctl (d_thread_t* p, struct nnpfs_message_pioctl msg; struct nnpfs_message_wakeup *msg2; nnpfs_kernel_cred cred = nnpfs_proc_to_cred(p); + struct nnpfs *nnpfsp = &nnpfs_dev[0]; /* XXX */ if (vp != NULL) { struct nnpfs_node *xn = VNODE_TO_XNODE(vp); @@ -411,6 +412,7 @@ remote_pioctl (d_thread_t* p, #endif msg.handle = xn->handle; + nnpfsp = NNPFS_FROM_VNODE(vp); nnpfs_vletgo(vp); } @@ -446,9 +448,9 @@ remote_pioctl (d_thread_t* p, msg.cred.uid = nnpfs_proc_to_euid(p); #endif - nnpfs_dev_lock(&nnpfs_dev[0]); - error = nnpfs_message_rpc(0, &msg.header, sizeof(msg), p); - nnpfs_dev_unlock(&nnpfs_dev[0]); + nnpfs_dev_lock(nnpfsp); + error = nnpfs_message_rpc(nnpfsp, &msg.header, sizeof(msg), p); + nnpfs_dev_unlock(nnpfsp); msg2 = (struct nnpfs_message_wakeup *) &msg; if (error == 0) diff --git a/nnpfs/bsd/nnpfs_vfsops-common.c b/nnpfs/bsd/nnpfs_vfsops-common.c index 4e1b696d2..e09208833 100644 --- a/nnpfs/bsd/nnpfs_vfsops-common.c +++ b/nnpfs/bsd/nnpfs_vfsops-common.c @@ -167,7 +167,6 @@ nnpfs_mount_common_sys(struct mount *mp, nnpfs->status |= NNPFS_MOUNTED; nnpfs->mp = mp; nnpfs->root = 0; - nnpfs->fd = minor(dev); nnpfs_init_head(&nnpfs->nodehead); NNPQUEUE_INIT(&nnpfs->freehead); @@ -340,7 +339,7 @@ nnpfs_root_common(struct mount *mp, struct vnode **vpp, msg.header.opcode = NNPFS_MSG_GETROOT; msg.cred.uid = nnpfs_cred_get_uid(cred); msg.cred.pag = nnpfs_get_pag(cred); - error = nnpfs_message_rpc(nnpfsp->fd, &msg.header, sizeof(msg), proc); + error = nnpfs_message_rpc(nnpfsp, &msg.header, sizeof(msg), proc); if (error == 0) error = NNPFS_MSG_WAKEUP_ERROR(&msg); } while (error == 0); diff --git a/nnpfs/bsd/nnpfs_vnodeops-common.c b/nnpfs/bsd/nnpfs_vnodeops-common.c index a36942ef6..3455139bf 100644 --- a/nnpfs/bsd/nnpfs_vnodeops-common.c +++ b/nnpfs/bsd/nnpfs_vnodeops-common.c @@ -90,7 +90,7 @@ nnpfs_open_valid(struct vnode *vp, nnpfs_vfs_context ctx, u_int tok) msg.handle = xn->handle; msg.tokens = tok; - error = nnpfs_message_rpc(nnpfsp->fd, &msg.header, + error = nnpfs_message_rpc(nnpfsp, &msg.header, sizeof(msg), nnpfs_vfs_context_proc(ctx)); if (error == 0) error = NNPFS_MSG_WAKEUP_ERROR(&msg); @@ -123,7 +123,7 @@ nnpfs_attr_valid(struct vnode *vp, nnpfs_kernel_cred cred, d_thread_t *p, msg.cred.uid = nnpfs_cred_get_uid(cred); msg.cred.pag = pag; msg.handle = xn->handle; - error = nnpfs_message_rpc(nnpfsp->fd, &msg.header, sizeof(msg), p); + error = nnpfs_message_rpc(nnpfsp, &msg.header, sizeof(msg), p); if (error == 0) error = NNPFS_MSG_WAKEUP_ERROR(&msg); } else { @@ -149,7 +149,7 @@ nnpfs_do_getdata(struct nnpfs_node *xn, nnpfs_cred *cred, u_int tok, msg.offset = offset; msg.len = end - offset; - error = nnpfs_message_rpc(NNPFS_FROM_XNODE(xn)->fd, &msg.header, sizeof(msg), + error = nnpfs_message_rpc(NNPFS_FROM_XNODE(xn), &msg.header, sizeof(msg), nnpfs_curproc()); if (error == 0) error = NNPFS_MSG_WAKEUP_ERROR(&msg); @@ -373,7 +373,7 @@ do_fsync(struct nnpfs *nnpfsp, xn->pending_writes++; /* XXX lock */ nrpcs++; - error = nnpfs_message_rpc(nnpfsp->fd, &msg.header, sizeof(msg), p); + error = nnpfs_message_rpc(nnpfsp, &msg.header, sizeof(msg), p); if (error == 0) error = NNPFS_MSG_WAKEUP_ERROR(&msg); @@ -852,7 +852,7 @@ nnpfs_setattr_common(struct vnode *vp, struct nnpfs_vfs_vattr *vap, XA_SET_MTIME(&msg.attr, nnpfs_vattr_get_mtime_sec(&xn->attr)); } - error = nnpfs_message_rpc(nnpfsp->fd, &msg.header, sizeof(msg), p); + error = nnpfs_message_rpc(nnpfsp, &msg.header, sizeof(msg), p); if (error == 0) error = NNPFS_MSG_WAKEUP_ERROR(&msg); @@ -1041,7 +1041,7 @@ nnpfs_lookup_common(struct vnode *dvp, msg.parent_handle = d->handle; memcpy(msg.name, cnp->cn_nameptr, cnp->cn_namelen); msg.name[cnp->cn_namelen] = '\0'; - error = nnpfs_message_rpc(nnpfsp->fd, &msg.header, sizeof(msg), p); + error = nnpfs_message_rpc(nnpfsp, &msg.header, sizeof(msg), p); if (error == 0) error = NNPFS_MSG_WAKEUP_ERROR(&msg); if(error == ENOENT && cnp->cn_nameiop != CREATE) { @@ -1096,7 +1096,7 @@ nnpfs_create_common(struct vnode *dvp, msg.attr.valid &= ~XA_V_UID; #endif - error = nnpfs_message_rpc(nnpfsp->fd, &msg.header, sizeof(msg), p); + error = nnpfs_message_rpc(nnpfsp, &msg.header, sizeof(msg), p); if (error == 0) error = NNPFS_MSG_WAKEUP_ERROR(&msg); } @@ -1136,7 +1136,7 @@ nnpfs_remove_common(struct vnode *dvp, if (strlcpy(msg.name, name, sizeof(msg.name)) >= NNPFS_MAX_NAME) error = ENAMETOOLONG; else - error = nnpfs_message_rpc(nnpfsp->fd, &msg.header, sizeof(msg), p); + error = nnpfs_message_rpc(nnpfsp, &msg.header, sizeof(msg), p); if (error == 0) error = NNPFS_MSG_WAKEUP_ERROR(&msg); @@ -1196,7 +1196,7 @@ nnpfs_rename_common(struct vnode *fdvp, msg.cred.uid = nnpfs_cred_get_uid(cred); msg.cred.pag = nnpfs_get_pag(cred); - error = nnpfs_message_rpc(nnpfsp->fd, &msg.header, sizeof(msg), p); + error = nnpfs_message_rpc(nnpfsp, &msg.header, sizeof(msg), p); if (error == 0) error = NNPFS_MSG_WAKEUP_ERROR(&msg); @@ -1236,7 +1236,7 @@ nnpfs_mkdir_common(struct vnode *dvp, vattr2nnpfs_attr(vap, &msg.attr); nnpfs_setcred(&msg.cred, cred); - error = nnpfs_message_rpc(nnpfsp->fd, &msg.header, sizeof(msg), p); + error = nnpfs_message_rpc(nnpfsp, &msg.header, sizeof(msg), p); if (error == 0) error = NNPFS_MSG_WAKEUP_ERROR(&msg); } @@ -1272,7 +1272,7 @@ nnpfs_rmdir_common(struct vnode *dvp, if (strlcpy(msg.name, name, sizeof(msg.name)) >= NNPFS_MAX_NAME) error = ENAMETOOLONG; else - error = nnpfs_message_rpc(nnpfsp->fd, &msg.header, sizeof(msg), p); + error = nnpfs_message_rpc(nnpfsp, &msg.header, sizeof(msg), p); if (error == 0) error = NNPFS_MSG_WAKEUP_ERROR(&msg); @@ -1379,7 +1379,7 @@ nnpfs_link_common(struct vnode *dvp, msg.cred.uid = nnpfs_cred_get_uid(cred); msg.cred.pag = nnpfs_get_pag(cred); - error = nnpfs_message_rpc(nnpfsp->fd, &msg.header, sizeof(msg), p); + error = nnpfs_message_rpc(nnpfsp, &msg.header, sizeof(msg), p); if (error == 0) error = NNPFS_MSG_WAKEUP_ERROR(&msg); @@ -1420,7 +1420,7 @@ nnpfs_symlink_common(struct vnode *dvp, error = ENAMETOOLONG; goto done; } - error = nnpfs_message_rpc(nnpfsp->fd, &msg.header, sizeof(msg), + error = nnpfs_message_rpc(nnpfsp, &msg.header, sizeof(msg), nnpfs_vfs_context_proc(ctx)); if (error == 0) error = NNPFS_MSG_WAKEUP_ERROR(&msg); @@ -1565,7 +1565,7 @@ nnpfs_reclaim_common(struct vnode *vp) msg.header.opcode = NNPFS_MSG_INACTIVENODE; msg.handle = xn->handle; msg.flag = NNPFS_NOREFS | NNPFS_DELETE; - nnpfs_message_send(nnpfsp->fd, &msg.header, sizeof(msg)); + nnpfs_message_send(nnpfsp, &msg.header, sizeof(msg)); } else { nnpfs_free_node(nnpfsp, xn); } @@ -1603,7 +1603,7 @@ nnpfs_advlock_common(struct vnode *dvp, msg.lockid = lockid; nnpfs_setcred(&msg.cred, cred); - error = nnpfs_message_rpc(nnpfsp->fd, &msg.header, sizeof(msg), + error = nnpfs_message_rpc(nnpfsp, &msg.header, sizeof(msg), nnpfs_vfs_context_proc(ctx)); if (error == 0) error = NNPFS_MSG_WAKEUP_ERROR(&msg); -- 2.11.4.GIT