rpc_pipe_fs.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef _LINUX_SUNRPC_RPC_PIPE_FS_H
  2. #define _LINUX_SUNRPC_RPC_PIPE_FS_H
  3. #ifdef __KERNEL__
  4. #include <linux/workqueue.h>
  5. struct rpc_pipe_msg {
  6. struct list_head list;
  7. void *data;
  8. size_t len;
  9. size_t copied;
  10. int errno;
  11. };
  12. struct rpc_pipe_ops {
  13. ssize_t (*upcall)(struct file *, struct rpc_pipe_msg *, char __user *, size_t);
  14. ssize_t (*downcall)(struct file *, const char __user *, size_t);
  15. void (*release_pipe)(struct inode *);
  16. int (*open_pipe)(struct inode *);
  17. void (*destroy_msg)(struct rpc_pipe_msg *);
  18. };
  19. struct rpc_inode {
  20. struct inode vfs_inode;
  21. void *private;
  22. struct list_head pipe;
  23. struct list_head in_upcall;
  24. struct list_head in_downcall;
  25. int pipelen;
  26. int nreaders;
  27. int nwriters;
  28. int nkern_readwriters;
  29. wait_queue_head_t waitq;
  30. #define RPC_PIPE_WAIT_FOR_OPEN 1
  31. int flags;
  32. struct delayed_work queue_timeout;
  33. const struct rpc_pipe_ops *ops;
  34. };
  35. static inline struct rpc_inode *
  36. RPC_I(struct inode *inode)
  37. {
  38. return container_of(inode, struct rpc_inode, vfs_inode);
  39. }
  40. extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);
  41. struct rpc_clnt;
  42. extern struct dentry *rpc_create_client_dir(struct dentry *, struct qstr *, struct rpc_clnt *);
  43. extern int rpc_remove_client_dir(struct dentry *);
  44. struct cache_detail;
  45. extern struct dentry *rpc_create_cache_dir(struct dentry *,
  46. struct qstr *,
  47. mode_t umode,
  48. struct cache_detail *);
  49. extern void rpc_remove_cache_dir(struct dentry *);
  50. extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *,
  51. const struct rpc_pipe_ops *, int flags);
  52. extern int rpc_unlink(struct dentry *);
  53. extern struct vfsmount *rpc_get_mount(void);
  54. extern void rpc_put_mount(void);
  55. extern int register_rpc_pipefs(void);
  56. extern void unregister_rpc_pipefs(void);
  57. #endif
  58. #endif