diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-08-09 15:14:30 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-08-09 15:14:30 -0400 |
commit | 8854e82d9accc80f43c0bc3ff06b5979ac858185 (patch) | |
tree | 957a42c2959e52f9df2acd7a23c10bf5d6cbeaf0 /net/sunrpc/rpc_pipe.c | |
parent | 173912a6add00f4715774dcecf9ee53274c5924c (diff) |
SUNRPC: Add an rpc_pipefs front end for the sunrpc cache code
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/rpc_pipe.c')
-rw-r--r-- | net/sunrpc/rpc_pipe.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 57e9cd3c49b6..8dd81535e08f 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/sunrpc/clnt.h> | 26 | #include <linux/sunrpc/clnt.h> |
27 | #include <linux/workqueue.h> | 27 | #include <linux/workqueue.h> |
28 | #include <linux/sunrpc/rpc_pipe_fs.h> | 28 | #include <linux/sunrpc/rpc_pipe_fs.h> |
29 | #include <linux/sunrpc/cache.h> | ||
29 | 30 | ||
30 | static struct vfsmount *rpc_mount __read_mostly; | 31 | static struct vfsmount *rpc_mount __read_mostly; |
31 | static int rpc_mount_count; | 32 | static int rpc_mount_count; |
@@ -882,6 +883,48 @@ int rpc_remove_client_dir(struct dentry *dentry) | |||
882 | return rpc_rmdir_depopulate(dentry, rpc_clntdir_depopulate); | 883 | return rpc_rmdir_depopulate(dentry, rpc_clntdir_depopulate); |
883 | } | 884 | } |
884 | 885 | ||
886 | static const struct rpc_filelist cache_pipefs_files[3] = { | ||
887 | [0] = { | ||
888 | .name = "channel", | ||
889 | .i_fop = &cache_file_operations_pipefs, | ||
890 | .mode = S_IFIFO|S_IRUSR|S_IWUSR, | ||
891 | }, | ||
892 | [1] = { | ||
893 | .name = "content", | ||
894 | .i_fop = &content_file_operations_pipefs, | ||
895 | .mode = S_IFREG|S_IRUSR, | ||
896 | }, | ||
897 | [2] = { | ||
898 | .name = "flush", | ||
899 | .i_fop = &cache_flush_operations_pipefs, | ||
900 | .mode = S_IFREG|S_IRUSR|S_IWUSR, | ||
901 | }, | ||
902 | }; | ||
903 | |||
904 | static int rpc_cachedir_populate(struct dentry *dentry, void *private) | ||
905 | { | ||
906 | return rpc_populate(dentry, | ||
907 | cache_pipefs_files, 0, 3, | ||
908 | private); | ||
909 | } | ||
910 | |||
911 | static void rpc_cachedir_depopulate(struct dentry *dentry) | ||
912 | { | ||
913 | rpc_depopulate(dentry, cache_pipefs_files, 0, 3); | ||
914 | } | ||
915 | |||
916 | struct dentry *rpc_create_cache_dir(struct dentry *parent, struct qstr *name, | ||
917 | mode_t umode, struct cache_detail *cd) | ||
918 | { | ||
919 | return rpc_mkdir_populate(parent, name, umode, NULL, | ||
920 | rpc_cachedir_populate, cd); | ||
921 | } | ||
922 | |||
923 | void rpc_remove_cache_dir(struct dentry *dentry) | ||
924 | { | ||
925 | rpc_rmdir_depopulate(dentry, rpc_cachedir_depopulate); | ||
926 | } | ||
927 | |||
885 | /* | 928 | /* |
886 | * populate the filesystem | 929 | * populate the filesystem |
887 | */ | 930 | */ |