0001
0002 #ifndef _LINUX_SUNRPC_RPC_PIPE_FS_H
0003 #define _LINUX_SUNRPC_RPC_PIPE_FS_H
0004
0005 #include <linux/workqueue.h>
0006
0007 struct rpc_pipe_dir_head {
0008 struct list_head pdh_entries;
0009 struct dentry *pdh_dentry;
0010 };
0011
0012 struct rpc_pipe_dir_object_ops;
0013 struct rpc_pipe_dir_object {
0014 struct list_head pdo_head;
0015 const struct rpc_pipe_dir_object_ops *pdo_ops;
0016
0017 void *pdo_data;
0018 };
0019
0020 struct rpc_pipe_dir_object_ops {
0021 int (*create)(struct dentry *dir,
0022 struct rpc_pipe_dir_object *pdo);
0023 void (*destroy)(struct dentry *dir,
0024 struct rpc_pipe_dir_object *pdo);
0025 };
0026
0027 struct rpc_pipe_msg {
0028 struct list_head list;
0029 void *data;
0030 size_t len;
0031 size_t copied;
0032 int errno;
0033 };
0034
0035 struct rpc_pipe_ops {
0036 ssize_t (*upcall)(struct file *, struct rpc_pipe_msg *, char __user *, size_t);
0037 ssize_t (*downcall)(struct file *, const char __user *, size_t);
0038 void (*release_pipe)(struct inode *);
0039 int (*open_pipe)(struct inode *);
0040 void (*destroy_msg)(struct rpc_pipe_msg *);
0041 };
0042
0043 struct rpc_pipe {
0044 struct list_head pipe;
0045 struct list_head in_upcall;
0046 struct list_head in_downcall;
0047 int pipelen;
0048 int nreaders;
0049 int nwriters;
0050 #define RPC_PIPE_WAIT_FOR_OPEN 1
0051 int flags;
0052 struct delayed_work queue_timeout;
0053 const struct rpc_pipe_ops *ops;
0054 spinlock_t lock;
0055 struct dentry *dentry;
0056 };
0057
0058 struct rpc_inode {
0059 struct inode vfs_inode;
0060 void *private;
0061 struct rpc_pipe *pipe;
0062 wait_queue_head_t waitq;
0063 };
0064
0065 static inline struct rpc_inode *
0066 RPC_I(struct inode *inode)
0067 {
0068 return container_of(inode, struct rpc_inode, vfs_inode);
0069 }
0070
0071 enum {
0072 SUNRPC_PIPEFS_NFS_PRIO,
0073 SUNRPC_PIPEFS_RPC_PRIO,
0074 };
0075
0076 extern int rpc_pipefs_notifier_register(struct notifier_block *);
0077 extern void rpc_pipefs_notifier_unregister(struct notifier_block *);
0078
0079 enum {
0080 RPC_PIPEFS_MOUNT,
0081 RPC_PIPEFS_UMOUNT,
0082 };
0083
0084 extern struct dentry *rpc_d_lookup_sb(const struct super_block *sb,
0085 const unsigned char *dir_name);
0086 extern int rpc_pipefs_init_net(struct net *net);
0087 extern void rpc_pipefs_exit_net(struct net *net);
0088 extern struct super_block *rpc_get_sb_net(const struct net *net);
0089 extern void rpc_put_sb_net(const struct net *net);
0090
0091 extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *,
0092 char __user *, size_t);
0093 extern int rpc_queue_upcall(struct rpc_pipe *, struct rpc_pipe_msg *);
0094
0095 struct rpc_clnt;
0096 extern struct dentry *rpc_create_client_dir(struct dentry *, const char *, struct rpc_clnt *);
0097 extern int rpc_remove_client_dir(struct rpc_clnt *);
0098
0099 extern void rpc_init_pipe_dir_head(struct rpc_pipe_dir_head *pdh);
0100 extern void rpc_init_pipe_dir_object(struct rpc_pipe_dir_object *pdo,
0101 const struct rpc_pipe_dir_object_ops *pdo_ops,
0102 void *pdo_data);
0103 extern int rpc_add_pipe_dir_object(struct net *net,
0104 struct rpc_pipe_dir_head *pdh,
0105 struct rpc_pipe_dir_object *pdo);
0106 extern void rpc_remove_pipe_dir_object(struct net *net,
0107 struct rpc_pipe_dir_head *pdh,
0108 struct rpc_pipe_dir_object *pdo);
0109 extern struct rpc_pipe_dir_object *rpc_find_or_alloc_pipe_dir_object(
0110 struct net *net,
0111 struct rpc_pipe_dir_head *pdh,
0112 int (*match)(struct rpc_pipe_dir_object *, void *),
0113 struct rpc_pipe_dir_object *(*alloc)(void *),
0114 void *data);
0115
0116 struct cache_detail;
0117 extern struct dentry *rpc_create_cache_dir(struct dentry *,
0118 const char *,
0119 umode_t umode,
0120 struct cache_detail *);
0121 extern void rpc_remove_cache_dir(struct dentry *);
0122
0123 struct rpc_pipe *rpc_mkpipe_data(const struct rpc_pipe_ops *ops, int flags);
0124 void rpc_destroy_pipe_data(struct rpc_pipe *pipe);
0125 extern struct dentry *rpc_mkpipe_dentry(struct dentry *, const char *, void *,
0126 struct rpc_pipe *);
0127 extern int rpc_unlink(struct dentry *);
0128 extern int register_rpc_pipefs(void);
0129 extern void unregister_rpc_pipefs(void);
0130
0131 extern bool gssd_running(struct net *net);
0132
0133 #endif