rpc_pipe_fs.h 2.3 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5
#ifndef _LINUX_SUNRPC_RPC_PIPE_FS_H
#define _LINUX_SUNRPC_RPC_PIPE_FS_H

#ifdef __KERNEL__

6 7
#include <linux/workqueue.h>

L
Linus Torvalds 已提交
8 9 10 11 12 13 14 15 16 17 18 19
struct rpc_pipe_msg {
	struct list_head list;
	void *data;
	size_t len;
	size_t copied;
	int errno;
};

struct rpc_pipe_ops {
	ssize_t (*upcall)(struct file *, struct rpc_pipe_msg *, char __user *, size_t);
	ssize_t (*downcall)(struct file *, const char __user *, size_t);
	void (*release_pipe)(struct inode *);
20
	int (*open_pipe)(struct inode *);
L
Linus Torvalds 已提交
21 22 23 24 25 26 27 28
	void (*destroy_msg)(struct rpc_pipe_msg *);
};

struct rpc_inode {
	struct inode vfs_inode;
	void *private;
	struct list_head pipe;
	struct list_head in_upcall;
29
	struct list_head in_downcall;
L
Linus Torvalds 已提交
30 31 32 33 34 35
	int pipelen;
	int nreaders;
	int nwriters;
	wait_queue_head_t waitq;
#define RPC_PIPE_WAIT_FOR_OPEN	1
	int flags;
36
	struct delayed_work queue_timeout;
37
	const struct rpc_pipe_ops *ops;
L
Linus Torvalds 已提交
38 39 40 41 42 43 44 45
};

static inline struct rpc_inode *
RPC_I(struct inode *inode)
{
	return container_of(inode, struct rpc_inode, vfs_inode);
}

46 47 48 49 50 51 52 53
extern int rpc_pipefs_notifier_register(struct notifier_block *);
extern void rpc_pipefs_notifier_unregister(struct notifier_block *);

enum {
	RPC_PIPEFS_MOUNT,
	RPC_PIPEFS_UMOUNT,
};

54 55
extern struct dentry *rpc_d_lookup_sb(const struct super_block *sb,
				      const unsigned char *dir_name);
56 57 58
extern void rpc_pipefs_init_net(struct net *net);
extern struct super_block *rpc_get_sb_net(const struct net *net);
extern void rpc_put_sb_net(const struct net *net);
59

60 61
extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *,
				       char __user *, size_t);
L
Linus Torvalds 已提交
62 63
extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);

64
struct rpc_clnt;
65
extern struct dentry *rpc_create_client_dir(struct dentry *, struct qstr *, struct rpc_clnt *);
66
extern int rpc_remove_client_dir(struct dentry *);
67 68 69 70

struct cache_detail;
extern struct dentry *rpc_create_cache_dir(struct dentry *,
					   struct qstr *,
A
Al Viro 已提交
71
					   umode_t umode,
72 73 74
					   struct cache_detail *);
extern void rpc_remove_cache_dir(struct dentry *);

75 76
extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *,
				 const struct rpc_pipe_ops *, int flags);
77
extern int rpc_unlink(struct dentry *);
78 79
extern struct vfsmount *rpc_get_mount(void);
extern void rpc_put_mount(void);
T
Trond Myklebust 已提交
80 81
extern int register_rpc_pipefs(void);
extern void unregister_rpc_pipefs(void);
L
Linus Torvalds 已提交
82 83 84

#endif
#endif