fuse.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. /*
  2. FUSE: Filesystem in Userspace
  3. Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
  4. This program can be distributed under the terms of the GNU GPL.
  5. See the file COPYING.
  6. */
  7. /* This file defines the kernel interface of FUSE */
  8. #include <asm/types.h>
  9. /** Version number of this interface */
  10. #define FUSE_KERNEL_VERSION 7
  11. /** Minor version number of this interface */
  12. #define FUSE_KERNEL_MINOR_VERSION 1
  13. /** The node ID of the root inode */
  14. #define FUSE_ROOT_ID 1
  15. /** The major number of the fuse character device */
  16. #define FUSE_MAJOR 10
  17. /** The minor number of the fuse character device */
  18. #define FUSE_MINOR 229
  19. struct fuse_attr {
  20. __u64 ino;
  21. __u64 size;
  22. __u64 blocks;
  23. __u64 atime;
  24. __u64 mtime;
  25. __u64 ctime;
  26. __u32 atimensec;
  27. __u32 mtimensec;
  28. __u32 ctimensec;
  29. __u32 mode;
  30. __u32 nlink;
  31. __u32 uid;
  32. __u32 gid;
  33. __u32 rdev;
  34. };
  35. struct fuse_kstatfs {
  36. __u64 blocks;
  37. __u64 bfree;
  38. __u64 bavail;
  39. __u64 files;
  40. __u64 ffree;
  41. __u32 bsize;
  42. __u32 namelen;
  43. };
  44. #define FATTR_MODE (1 << 0)
  45. #define FATTR_UID (1 << 1)
  46. #define FATTR_GID (1 << 2)
  47. #define FATTR_SIZE (1 << 3)
  48. #define FATTR_ATIME (1 << 4)
  49. #define FATTR_MTIME (1 << 5)
  50. #define FATTR_CTIME (1 << 6)
  51. enum fuse_opcode {
  52. FUSE_LOOKUP = 1,
  53. FUSE_FORGET = 2, /* no reply */
  54. FUSE_GETATTR = 3,
  55. FUSE_SETATTR = 4,
  56. FUSE_READLINK = 5,
  57. FUSE_SYMLINK = 6,
  58. FUSE_GETDIR = 7,
  59. FUSE_MKNOD = 8,
  60. FUSE_MKDIR = 9,
  61. FUSE_UNLINK = 10,
  62. FUSE_RMDIR = 11,
  63. FUSE_RENAME = 12,
  64. FUSE_LINK = 13,
  65. FUSE_OPEN = 14,
  66. FUSE_READ = 15,
  67. FUSE_WRITE = 16,
  68. FUSE_STATFS = 17,
  69. FUSE_RELEASE = 18,
  70. FUSE_FSYNC = 20,
  71. FUSE_FLUSH = 25,
  72. FUSE_INIT = 26
  73. };
  74. /* Conservative buffer size for the client */
  75. #define FUSE_MAX_IN 8192
  76. #define FUSE_NAME_MAX 1024
  77. #define FUSE_SYMLINK_MAX 4096
  78. struct fuse_entry_out {
  79. __u64 nodeid; /* Inode ID */
  80. __u64 generation; /* Inode generation: nodeid:gen must
  81. be unique for the fs's lifetime */
  82. __u64 entry_valid; /* Cache timeout for the name */
  83. __u64 attr_valid; /* Cache timeout for the attributes */
  84. __u32 entry_valid_nsec;
  85. __u32 attr_valid_nsec;
  86. struct fuse_attr attr;
  87. };
  88. struct fuse_forget_in {
  89. __u64 nlookup;
  90. };
  91. struct fuse_attr_out {
  92. __u64 attr_valid; /* Cache timeout for the attributes */
  93. __u32 attr_valid_nsec;
  94. __u32 dummy;
  95. struct fuse_attr attr;
  96. };
  97. struct fuse_getdir_out {
  98. __u32 fd;
  99. };
  100. struct fuse_mknod_in {
  101. __u32 mode;
  102. __u32 rdev;
  103. };
  104. struct fuse_mkdir_in {
  105. __u32 mode;
  106. };
  107. struct fuse_rename_in {
  108. __u64 newdir;
  109. };
  110. struct fuse_link_in {
  111. __u64 oldnodeid;
  112. };
  113. struct fuse_setattr_in {
  114. __u32 valid;
  115. struct fuse_attr attr;
  116. };
  117. struct fuse_open_in {
  118. __u32 flags;
  119. };
  120. struct fuse_open_out {
  121. __u64 fh;
  122. __u32 open_flags;
  123. };
  124. struct fuse_release_in {
  125. __u64 fh;
  126. __u32 flags;
  127. };
  128. struct fuse_flush_in {
  129. __u64 fh;
  130. __u32 flush_flags;
  131. };
  132. struct fuse_read_in {
  133. __u64 fh;
  134. __u64 offset;
  135. __u32 size;
  136. };
  137. struct fuse_write_in {
  138. __u64 fh;
  139. __u64 offset;
  140. __u32 size;
  141. __u32 write_flags;
  142. };
  143. struct fuse_write_out {
  144. __u32 size;
  145. };
  146. struct fuse_statfs_out {
  147. struct fuse_kstatfs st;
  148. };
  149. struct fuse_fsync_in {
  150. __u64 fh;
  151. __u32 fsync_flags;
  152. };
  153. struct fuse_init_in_out {
  154. __u32 major;
  155. __u32 minor;
  156. };
  157. struct fuse_in_header {
  158. __u32 len;
  159. __u32 opcode;
  160. __u64 unique;
  161. __u64 nodeid;
  162. __u32 uid;
  163. __u32 gid;
  164. __u32 pid;
  165. };
  166. struct fuse_out_header {
  167. __u32 len;
  168. __s32 error;
  169. __u64 unique;
  170. };
  171. struct fuse_dirent {
  172. __u64 ino;
  173. __u64 off;
  174. __u32 namelen;
  175. __u32 type;
  176. char name[0];
  177. };
  178. #define FUSE_NAME_OFFSET ((unsigned) ((struct fuse_dirent *) 0)->name)
  179. #define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1))
  180. #define FUSE_DIRENT_SIZE(d) \
  181. FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)