vsprintf: factor out skip_space code in a separate function
[safe/jmp/linux-2.6] / net / sunrpc / rpc_pipe.c
index 57e9cd3..49278f8 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/sunrpc/clnt.h>
 #include <linux/workqueue.h>
 #include <linux/sunrpc/rpc_pipe_fs.h>
+#include <linux/sunrpc/cache.h>
 
 static struct vfsmount *rpc_mount __read_mostly;
 static int rpc_mount_count;
@@ -415,11 +416,13 @@ struct vfsmount *rpc_get_mount(void)
                return ERR_PTR(err);
        return rpc_mount;
 }
+EXPORT_SYMBOL_GPL(rpc_get_mount);
 
 void rpc_put_mount(void)
 {
        simple_release_fs(&rpc_mount, &rpc_mount_count);
 }
+EXPORT_SYMBOL_GPL(rpc_put_mount);
 
 static int rpc_delete_dentry(struct dentry *dentry)
 {
@@ -857,7 +860,8 @@ static void rpc_clntdir_depopulate(struct dentry *dentry)
 
 /**
  * rpc_create_client_dir - Create a new rpc_client directory in rpc_pipefs
- * @path: path from the rpc_pipefs root to the new directory
+ * @dentry: dentry from the rpc_pipefs root to the new directory
+ * @name: &struct qstr for the name
  * @rpc_client: rpc client to associate with this directory
  *
  * This creates a directory at the given @path associated with
@@ -882,10 +886,52 @@ int rpc_remove_client_dir(struct dentry *dentry)
        return rpc_rmdir_depopulate(dentry, rpc_clntdir_depopulate);
 }
 
+static const struct rpc_filelist cache_pipefs_files[3] = {
+       [0] = {
+               .name = "channel",
+               .i_fop = &cache_file_operations_pipefs,
+               .mode = S_IFREG|S_IRUSR|S_IWUSR,
+       },
+       [1] = {
+               .name = "content",
+               .i_fop = &content_file_operations_pipefs,
+               .mode = S_IFREG|S_IRUSR,
+       },
+       [2] = {
+               .name = "flush",
+               .i_fop = &cache_flush_operations_pipefs,
+               .mode = S_IFREG|S_IRUSR|S_IWUSR,
+       },
+};
+
+static int rpc_cachedir_populate(struct dentry *dentry, void *private)
+{
+       return rpc_populate(dentry,
+                           cache_pipefs_files, 0, 3,
+                           private);
+}
+
+static void rpc_cachedir_depopulate(struct dentry *dentry)
+{
+       rpc_depopulate(dentry, cache_pipefs_files, 0, 3);
+}
+
+struct dentry *rpc_create_cache_dir(struct dentry *parent, struct qstr *name,
+                                   mode_t umode, struct cache_detail *cd)
+{
+       return rpc_mkdir_populate(parent, name, umode, NULL,
+                       rpc_cachedir_populate, cd);
+}
+
+void rpc_remove_cache_dir(struct dentry *dentry)
+{
+       rpc_rmdir_depopulate(dentry, rpc_cachedir_depopulate);
+}
+
 /*
  * populate the filesystem
  */
-static struct super_operations s_ops = {
+static const struct super_operations s_ops = {
        .alloc_inode    = rpc_alloc_inode,
        .destroy_inode  = rpc_destroy_inode,
        .statfs         = simple_statfs,
@@ -903,6 +949,7 @@ enum {
        RPCAUTH_portmap,
        RPCAUTH_statd,
        RPCAUTH_nfsd4_cb,
+       RPCAUTH_cache,
        RPCAUTH_RootEOF
 };
 
@@ -931,6 +978,10 @@ static const struct rpc_filelist files[] = {
                .name = "nfsd4_cb",
                .mode = S_IFDIR | S_IRUGO | S_IXUGO,
        },
+       [RPCAUTH_cache] = {
+               .name = "cache",
+               .mode = S_IFDIR | S_IRUGO | S_IXUGO,
+       },
 };
 
 static int