diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-30 03:54:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-30 03:54:24 -0500 |
commit | 85004cc367abc000aa36c0d0e270ab609a68b0cb (patch) | |
tree | 5739aae778d67b6d119fe5c668313fc2823e9836 /net/sunrpc/rpc_pipe.c | |
parent | 149a051f82d2b3860fe32fa182dbc83a66274894 (diff) | |
parent | 3fbd67ad61f6d5a09ea717b56c50bc5c3d8042a8 (diff) |
Merge git://git.linux-nfs.org/pub/linux/nfs-2.6
* git://git.linux-nfs.org/pub/linux/nfs-2.6: (118 commits)
NFSv4: Iterate through all nfs_clients when the server recalls a delegation
NFSv4: Deal more correctly with duplicate delegations
NFS: Fix a potential race between umount and nfs_access_cache_shrinker()
NFS: Add an asynchronous delegreturn operation for use in nfs_clear_inode
nfs: convert NFS_*(inode) helpers to static inline
nfs: obliterate NFS_FLAGS macro
NFS: Address memory leaks in the NFS client mount option parser
nfs4: allow nfsv4 acls on non-regular-files
NFS: Optimise away the sigmask code in aio/dio reads and writes
SUNRPC: Don't bother changing the sigmask for asynchronous RPC calls
SUNRPC: rpcb_getport_sync() passes incorrect address size to rpc_create()
SUNRPC: Clean up block comment preceding rpcb_getport_sync()
SUNRPC: Use appropriate argument types in rpcb client
SUNRPC: rpcb_getport_sync() should use built-in hostname generator
SUNRPC: Clean up functions that free address_strings array
NFS: NFS version number is unsigned
NLM: Fix a bogus 'return' in nlmclnt_rpc_release
NLM: Introduce an arguments structure for nlmclnt_init()
NLM/NFS: Use cached nlm_host when calling nlmclnt_proc()
NFS: Invoke nlmclnt_init during NFS mount processing
...
Diffstat (limited to 'net/sunrpc/rpc_pipe.c')
-rw-r--r-- | net/sunrpc/rpc_pipe.c | 59 |
1 files changed, 56 insertions, 3 deletions
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index c59f3ca2b41b..7e197168a245 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -76,6 +76,16 @@ rpc_timeout_upcall_queue(struct work_struct *work) | |||
76 | rpc_purge_list(rpci, &free_list, destroy_msg, -ETIMEDOUT); | 76 | rpc_purge_list(rpci, &free_list, destroy_msg, -ETIMEDOUT); |
77 | } | 77 | } |
78 | 78 | ||
79 | /** | ||
80 | * rpc_queue_upcall | ||
81 | * @inode: inode of upcall pipe on which to queue given message | ||
82 | * @msg: message to queue | ||
83 | * | ||
84 | * Call with an @inode created by rpc_mkpipe() to queue an upcall. | ||
85 | * A userspace process may then later read the upcall by performing a | ||
86 | * read on an open file for this inode. It is up to the caller to | ||
87 | * initialize the fields of @msg (other than @msg->list) appropriately. | ||
88 | */ | ||
79 | int | 89 | int |
80 | rpc_queue_upcall(struct inode *inode, struct rpc_pipe_msg *msg) | 90 | rpc_queue_upcall(struct inode *inode, struct rpc_pipe_msg *msg) |
81 | { | 91 | { |
@@ -103,6 +113,7 @@ out: | |||
103 | wake_up(&rpci->waitq); | 113 | wake_up(&rpci->waitq); |
104 | return res; | 114 | return res; |
105 | } | 115 | } |
116 | EXPORT_SYMBOL(rpc_queue_upcall); | ||
106 | 117 | ||
107 | static inline void | 118 | static inline void |
108 | rpc_inode_setowner(struct inode *inode, void *private) | 119 | rpc_inode_setowner(struct inode *inode, void *private) |
@@ -512,8 +523,8 @@ rpc_get_inode(struct super_block *sb, int mode) | |||
512 | /* | 523 | /* |
513 | * FIXME: This probably has races. | 524 | * FIXME: This probably has races. |
514 | */ | 525 | */ |
515 | static void | 526 | static void rpc_depopulate(struct dentry *parent, |
516 | rpc_depopulate(struct dentry *parent, int start, int eof) | 527 | unsigned long start, unsigned long eof) |
517 | { | 528 | { |
518 | struct inode *dir = parent->d_inode; | 529 | struct inode *dir = parent->d_inode; |
519 | struct list_head *pos, *next; | 530 | struct list_head *pos, *next; |
@@ -663,7 +674,16 @@ rpc_lookup_negative(char *path, struct nameidata *nd) | |||
663 | return dentry; | 674 | return dentry; |
664 | } | 675 | } |
665 | 676 | ||
666 | 677 | /** | |
678 | * rpc_mkdir - Create a new directory in rpc_pipefs | ||
679 | * @path: path from the rpc_pipefs root to the new directory | ||
680 | * @rpc_clnt: rpc client to associate with this directory | ||
681 | * | ||
682 | * This creates a directory at the given @path associated with | ||
683 | * @rpc_clnt, which will contain a file named "info" with some basic | ||
684 | * information about the client, together with any "pipes" that may | ||
685 | * later be created using rpc_mkpipe(). | ||
686 | */ | ||
667 | struct dentry * | 687 | struct dentry * |
668 | rpc_mkdir(char *path, struct rpc_clnt *rpc_client) | 688 | rpc_mkdir(char *path, struct rpc_clnt *rpc_client) |
669 | { | 689 | { |
@@ -699,6 +719,10 @@ err_dput: | |||
699 | goto out; | 719 | goto out; |
700 | } | 720 | } |
701 | 721 | ||
722 | /** | ||
723 | * rpc_rmdir - Remove a directory created with rpc_mkdir() | ||
724 | * @dentry: directory to remove | ||
725 | */ | ||
702 | int | 726 | int |
703 | rpc_rmdir(struct dentry *dentry) | 727 | rpc_rmdir(struct dentry *dentry) |
704 | { | 728 | { |
@@ -717,6 +741,25 @@ rpc_rmdir(struct dentry *dentry) | |||
717 | return error; | 741 | return error; |
718 | } | 742 | } |
719 | 743 | ||
744 | /** | ||
745 | * rpc_mkpipe - make an rpc_pipefs file for kernel<->userspace communication | ||
746 | * @parent: dentry of directory to create new "pipe" in | ||
747 | * @name: name of pipe | ||
748 | * @private: private data to associate with the pipe, for the caller's use | ||
749 | * @ops: operations defining the behavior of the pipe: upcall, downcall, | ||
750 | * release_pipe, and destroy_msg. | ||
751 | * | ||
752 | * Data is made available for userspace to read by calls to | ||
753 | * rpc_queue_upcall(). The actual reads will result in calls to | ||
754 | * @ops->upcall, which will be called with the file pointer, | ||
755 | * message, and userspace buffer to copy to. | ||
756 | * | ||
757 | * Writes can come at any time, and do not necessarily have to be | ||
758 | * responses to upcalls. They will result in calls to @msg->downcall. | ||
759 | * | ||
760 | * The @private argument passed here will be available to all these methods | ||
761 | * from the file pointer, via RPC_I(file->f_dentry->d_inode)->private. | ||
762 | */ | ||
720 | struct dentry * | 763 | struct dentry * |
721 | rpc_mkpipe(struct dentry *parent, const char *name, void *private, struct rpc_pipe_ops *ops, int flags) | 764 | rpc_mkpipe(struct dentry *parent, const char *name, void *private, struct rpc_pipe_ops *ops, int flags) |
722 | { | 765 | { |
@@ -763,7 +806,16 @@ err_dput: | |||
763 | -ENOMEM); | 806 | -ENOMEM); |
764 | goto out; | 807 | goto out; |
765 | } | 808 | } |
809 | EXPORT_SYMBOL(rpc_mkpipe); | ||
766 | 810 | ||
811 | /** | ||
812 | * rpc_unlink - remove a pipe | ||
813 | * @dentry: dentry for the pipe, as returned from rpc_mkpipe | ||
814 | * | ||
815 | * After this call, lookups will no longer find the pipe, and any | ||
816 | * attempts to read or write using preexisting opens of the pipe will | ||
817 | * return -EPIPE. | ||
818 | */ | ||
767 | int | 819 | int |
768 | rpc_unlink(struct dentry *dentry) | 820 | rpc_unlink(struct dentry *dentry) |
769 | { | 821 | { |
@@ -785,6 +837,7 @@ rpc_unlink(struct dentry *dentry) | |||
785 | dput(parent); | 837 | dput(parent); |
786 | return error; | 838 | return error; |
787 | } | 839 | } |
840 | EXPORT_SYMBOL(rpc_unlink); | ||
788 | 841 | ||
789 | /* | 842 | /* |
790 | * populate the filesystem | 843 | * populate the filesystem |