You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
2.9 KiB

  1. /*
  2. FUSE: Filesystem in Userspace
  3. Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
  4. This program can be distributed under the terms of the GNU LGPLv2.
  5. See the file COPYING.LIB
  6. */
  7. #pragma once
  8. #include "fuse.h"
  9. #include "fuse_lowlevel.h"
  10. struct fuse_chan;
  11. struct fuse_ll;
  12. struct fuse_session
  13. {
  14. struct fuse_session_ops op;
  15. int (*receive_buf)(struct fuse_session *se, struct fuse_buf *buf,
  16. struct fuse_chan **chp);
  17. void (*process_buf)(void *data, const struct fuse_buf *buf,
  18. struct fuse_chan *ch);
  19. void *data;
  20. volatile int exited;
  21. struct fuse_chan *ch;
  22. };
  23. struct fuse_req
  24. {
  25. struct fuse_ll *f;
  26. uint64_t unique;
  27. int ctr;
  28. pthread_mutex_t lock;
  29. struct fuse_ctx ctx;
  30. struct fuse_chan *ch;
  31. int interrupted;
  32. unsigned int ioctl_64bit : 1;
  33. union {
  34. struct {
  35. uint64_t unique;
  36. } i;
  37. struct {
  38. fuse_interrupt_func_t func;
  39. void *data;
  40. } ni;
  41. } u;
  42. struct fuse_req *next;
  43. struct fuse_req *prev;
  44. };
  45. struct fuse_notify_req
  46. {
  47. uint64_t unique;
  48. void (*reply)(struct fuse_notify_req *, fuse_req_t, fuse_ino_t,
  49. const void *, const struct fuse_buf *);
  50. struct fuse_notify_req *next;
  51. struct fuse_notify_req *prev;
  52. };
  53. struct fuse_ll
  54. {
  55. int debug;
  56. int allow_root;
  57. int no_remote_posix_lock;
  58. int no_remote_flock;
  59. int big_writes;
  60. int splice_write;
  61. int splice_move;
  62. int splice_read;
  63. int no_splice_write;
  64. int no_splice_move;
  65. int no_splice_read;
  66. struct fuse_lowlevel_ops op;
  67. int got_init;
  68. void *userdata;
  69. uid_t owner;
  70. struct fuse_conn_info conn;
  71. struct fuse_req list;
  72. struct fuse_req interrupts;
  73. pthread_mutex_t lock;
  74. int got_destroy;
  75. pthread_key_t pipe_key;
  76. int broken_splice_nonblock;
  77. uint64_t notify_ctr;
  78. struct fuse_notify_req notify_list;
  79. };
  80. struct fuse_cmd
  81. {
  82. char *buf;
  83. size_t buflen;
  84. struct fuse_chan *ch;
  85. };
  86. struct fuse *fuse_new_common(struct fuse_chan *ch, struct fuse_args *args,
  87. const struct fuse_operations *op,
  88. size_t op_size, void *user_data);
  89. struct fuse_chan *fuse_kern_chan_new(int fd);
  90. struct fuse_session *fuse_lowlevel_new_common(struct fuse_args *args,
  91. const struct fuse_lowlevel_ops *op,
  92. size_t op_size, void *userdata);
  93. int fuse_chan_clearfd(struct fuse_chan *ch);
  94. void fuse_kern_unmount(const char *mountpoint, int fd);
  95. int fuse_kern_mount(const char *mountpoint, struct fuse_args *args);
  96. int fuse_send_reply_iov_nofree(fuse_req_t req, int error, struct iovec *iov,
  97. int count);
  98. void fuse_free_req(fuse_req_t req);
  99. struct fuse *fuse_setup_common(int argc, char *argv[],
  100. const struct fuse_operations *op,
  101. size_t op_size,
  102. char **mountpoint,
  103. int *fd,
  104. void *user_data);
  105. int fuse_start_thread(pthread_t *thread_id, void *(*func)(void *), void *arg);