| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #ifndef _LINUX_SUNRPC_RPC_PIPE_FS_H
 | 
					
						
							|  |  |  | #define _LINUX_SUNRPC_RPC_PIPE_FS_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifdef __KERNEL__
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-20 17:08:39 -04:00
										 |  |  | #include <linux/workqueue.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-26 15:38:11 -04:00
										 |  |  | struct rpc_pipe_dir_head { | 
					
						
							|  |  |  | 	struct list_head pdh_entries; | 
					
						
							|  |  |  | 	struct dentry *pdh_dentry; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct rpc_pipe_dir_object_ops; | 
					
						
							|  |  |  | struct rpc_pipe_dir_object { | 
					
						
							|  |  |  | 	struct list_head pdo_head; | 
					
						
							|  |  |  | 	const struct rpc_pipe_dir_object_ops *pdo_ops; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void *pdo_data; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct rpc_pipe_dir_object_ops { | 
					
						
							|  |  |  | 	int (*create)(struct dentry *dir, | 
					
						
							|  |  |  | 			struct rpc_pipe_dir_object *pdo); | 
					
						
							|  |  |  | 	void (*destroy)(struct dentry *dir, | 
					
						
							|  |  |  | 			struct rpc_pipe_dir_object *pdo); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 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 *); | 
					
						
							| 
									
										
										
										
											2008-12-23 16:08:32 -05:00
										 |  |  | 	int (*open_pipe)(struct inode *); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	void (*destroy_msg)(struct rpc_pipe_msg *); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-26 15:43:32 +03:00
										 |  |  | struct rpc_pipe { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	struct list_head pipe; | 
					
						
							|  |  |  | 	struct list_head in_upcall; | 
					
						
							| 
									
										
										
										
											2007-06-07 15:31:36 -04:00
										 |  |  | 	struct list_head in_downcall; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	int pipelen; | 
					
						
							|  |  |  | 	int nreaders; | 
					
						
							|  |  |  | 	int nwriters; | 
					
						
							|  |  |  | #define RPC_PIPE_WAIT_FOR_OPEN	1
 | 
					
						
							|  |  |  | 	int flags; | 
					
						
							| 
									
										
										
										
											2006-11-22 14:54:01 +00:00
										 |  |  | 	struct delayed_work queue_timeout; | 
					
						
							| 
									
										
										
										
											2009-08-09 15:14:15 -04:00
										 |  |  | 	const struct rpc_pipe_ops *ops; | 
					
						
							| 
									
										
										
										
											2011-12-26 15:43:23 +03:00
										 |  |  | 	spinlock_t lock; | 
					
						
							| 
									
										
										
										
											2011-12-26 15:44:06 +03:00
										 |  |  | 	struct dentry *dentry; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-26 15:43:32 +03:00
										 |  |  | struct rpc_inode { | 
					
						
							|  |  |  | 	struct inode vfs_inode; | 
					
						
							|  |  |  | 	void *private; | 
					
						
							|  |  |  | 	struct rpc_pipe *pipe; | 
					
						
							| 
									
										
										
										
											2012-02-27 22:05:54 +04:00
										 |  |  | 	wait_queue_head_t waitq; | 
					
						
							| 
									
										
										
										
											2011-12-26 15:43:32 +03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | static inline struct rpc_inode * | 
					
						
							|  |  |  | RPC_I(struct inode *inode) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return container_of(inode, struct rpc_inode, vfs_inode); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-10 16:13:19 +04:00
										 |  |  | enum { | 
					
						
							|  |  |  | 	SUNRPC_PIPEFS_NFS_PRIO, | 
					
						
							|  |  |  | 	SUNRPC_PIPEFS_RPC_PRIO, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-26 15:39:13 +03:00
										 |  |  | 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, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-26 15:39:22 +03:00
										 |  |  | extern struct dentry *rpc_d_lookup_sb(const struct super_block *sb, | 
					
						
							|  |  |  | 				      const unsigned char *dir_name); | 
					
						
							| 
									
										
										
										
											2013-11-14 07:25:17 -05:00
										 |  |  | extern int rpc_pipefs_init_net(struct net *net); | 
					
						
							|  |  |  | extern void rpc_pipefs_exit_net(struct net *net); | 
					
						
							| 
									
										
										
										
											2011-12-26 15:39:39 +03:00
										 |  |  | extern struct super_block *rpc_get_sb_net(const struct net *net); | 
					
						
							|  |  |  | extern void rpc_put_sb_net(const struct net *net); | 
					
						
							| 
									
										
										
										
											2011-12-26 15:39:22 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-22 21:50:10 -04:00
										 |  |  | extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *, | 
					
						
							|  |  |  | 				       char __user *, size_t); | 
					
						
							| 
									
										
										
										
											2011-12-26 15:43:49 +03:00
										 |  |  | extern int rpc_queue_upcall(struct rpc_pipe *, struct rpc_pipe_msg *); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-09 15:14:22 -04:00
										 |  |  | struct rpc_clnt; | 
					
						
							| 
									
										
										
										
											2013-07-14 16:43:54 +04:00
										 |  |  | extern struct dentry *rpc_create_client_dir(struct dentry *, const char *, struct rpc_clnt *); | 
					
						
							| 
									
										
										
										
											2013-08-26 17:44:26 -04:00
										 |  |  | extern int rpc_remove_client_dir(struct rpc_clnt *); | 
					
						
							| 
									
										
										
										
											2013-08-26 15:38:11 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | extern void rpc_init_pipe_dir_head(struct rpc_pipe_dir_head *pdh); | 
					
						
							|  |  |  | extern void rpc_init_pipe_dir_object(struct rpc_pipe_dir_object *pdo, | 
					
						
							|  |  |  | 		const struct rpc_pipe_dir_object_ops *pdo_ops, | 
					
						
							|  |  |  | 		void *pdo_data); | 
					
						
							|  |  |  | extern int rpc_add_pipe_dir_object(struct net *net, | 
					
						
							|  |  |  | 		struct rpc_pipe_dir_head *pdh, | 
					
						
							|  |  |  | 		struct rpc_pipe_dir_object *pdo); | 
					
						
							|  |  |  | extern void rpc_remove_pipe_dir_object(struct net *net, | 
					
						
							|  |  |  | 		struct rpc_pipe_dir_head *pdh, | 
					
						
							|  |  |  | 		struct rpc_pipe_dir_object *pdo); | 
					
						
							| 
									
										
										
										
											2013-08-27 16:27:04 -04:00
										 |  |  | extern struct rpc_pipe_dir_object *rpc_find_or_alloc_pipe_dir_object( | 
					
						
							|  |  |  | 		struct net *net, | 
					
						
							|  |  |  | 		struct rpc_pipe_dir_head *pdh, | 
					
						
							|  |  |  | 		int (*match)(struct rpc_pipe_dir_object *, void *), | 
					
						
							|  |  |  | 		struct rpc_pipe_dir_object *(*alloc)(void *), | 
					
						
							|  |  |  | 		void *data); | 
					
						
							| 
									
										
										
										
											2009-08-09 15:14:30 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | struct cache_detail; | 
					
						
							|  |  |  | extern struct dentry *rpc_create_cache_dir(struct dentry *, | 
					
						
							| 
									
										
										
										
											2013-07-14 16:43:54 +04:00
										 |  |  | 					   const char *, | 
					
						
							| 
									
										
										
										
											2011-07-25 00:35:13 -04:00
										 |  |  | 					   umode_t umode, | 
					
						
							| 
									
										
										
										
											2009-08-09 15:14:30 -04:00
										 |  |  | 					   struct cache_detail *); | 
					
						
							|  |  |  | extern void rpc_remove_cache_dir(struct dentry *); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-10 16:13:19 +04:00
										 |  |  | extern int rpc_rmdir(struct dentry *dentry); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-26 15:44:06 +03:00
										 |  |  | struct rpc_pipe *rpc_mkpipe_data(const struct rpc_pipe_ops *ops, int flags); | 
					
						
							|  |  |  | void rpc_destroy_pipe_data(struct rpc_pipe *pipe); | 
					
						
							|  |  |  | extern struct dentry *rpc_mkpipe_dentry(struct dentry *, const char *, void *, | 
					
						
							|  |  |  | 					struct rpc_pipe *); | 
					
						
							| 
									
										
										
										
											2006-07-31 14:11:48 -07:00
										 |  |  | extern int rpc_unlink(struct dentry *); | 
					
						
							| 
									
										
										
										
											2007-05-14 17:21:26 -04:00
										 |  |  | extern int register_rpc_pipefs(void); | 
					
						
							|  |  |  | extern void unregister_rpc_pipefs(void); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-11-14 07:25:18 -05:00
										 |  |  | extern bool gssd_running(struct net *net); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | #endif
 |