fuse.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. /*
  2. This file defines the kernel interface of FUSE
  3. Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu>
  4. This program can be distributed under the terms of the GNU GPL.
  5. See the file COPYING.
  6. This -- and only this -- header file may also be distributed under
  7. the terms of the BSD Licence as follows:
  8. Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved.
  9. Redistribution and use in source and binary forms, with or without
  10. modification, are permitted provided that the following conditions
  11. are met:
  12. 1. Redistributions of source code must retain the above copyright
  13. notice, this list of conditions and the following disclaimer.
  14. 2. Redistributions in binary form must reproduce the above copyright
  15. notice, this list of conditions and the following disclaimer in the
  16. documentation and/or other materials provided with the distribution.
  17. THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  18. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  19. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  20. ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
  21. FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  22. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  23. OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  24. HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  25. LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  26. OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  27. SUCH DAMAGE.
  28. */
  29. /*
  30. * This file defines the kernel interface of FUSE
  31. *
  32. * Protocol changelog:
  33. *
  34. * 7.9:
  35. * - new fuse_getattr_in input argument of GETATTR
  36. * - add lk_flags in fuse_lk_in
  37. * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
  38. * - add blksize field to fuse_attr
  39. * - add file flags field to fuse_read_in and fuse_write_in
  40. *
  41. * 7.10
  42. * - add nonseekable open flag
  43. *
  44. * 7.11
  45. * - add IOCTL message
  46. * - add unsolicited notification support
  47. * - add POLL message and NOTIFY_POLL notification
  48. *
  49. * 7.12
  50. * - add umask flag to input argument of open, mknod and mkdir
  51. * - add notification messages for invalidation of inodes and
  52. * directory entries
  53. *
  54. * 7.13
  55. * - make max number of background requests and congestion threshold
  56. * tunables
  57. *
  58. * 7.14
  59. * - add splice support to fuse device
  60. *
  61. * 7.15
  62. * - add store notify
  63. * - add retrieve notify
  64. *
  65. * 7.16
  66. * - add BATCH_FORGET request
  67. * - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct
  68. * fuse_ioctl_iovec' instead of ambiguous 'struct iovec'
  69. * - add FUSE_IOCTL_32BIT flag
  70. *
  71. * 7.17
  72. * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK
  73. *
  74. * 7.18
  75. * - add FUSE_IOCTL_DIR flag
  76. * - add FUSE_NOTIFY_DELETE
  77. *
  78. * 7.19
  79. * - add FUSE_FALLOCATE
  80. *
  81. * 7.20
  82. * - add FUSE_AUTO_INVAL_DATA
  83. *
  84. * 7.21
  85. * - add FUSE_READDIRPLUS
  86. * - send the requested events in POLL request
  87. *
  88. * 7.22
  89. * - add FUSE_ASYNC_DIO
  90. *
  91. * 7.23
  92. * - add FUSE_WRITEBACK_CACHE
  93. * - add time_gran to fuse_init_out
  94. * - add reserved space to fuse_init_out
  95. * - add FATTR_CTIME
  96. * - add ctime and ctimensec to fuse_setattr_in
  97. * - add FUSE_RENAME2 request
  98. * - add FUSE_NO_OPEN_SUPPORT flag
  99. */
  100. #ifndef _LINUX_FUSE_H
  101. #define _LINUX_FUSE_H
  102. #include <stdint.h>
  103. /*
  104. * Version negotiation:
  105. *
  106. * Both the kernel and userspace send the version they support in the
  107. * INIT request and reply respectively.
  108. *
  109. * If the major versions match then both shall use the smallest
  110. * of the two minor versions for communication.
  111. *
  112. * If the kernel supports a larger major version, then userspace shall
  113. * reply with the major version it supports, ignore the rest of the
  114. * INIT message and expect a new INIT message from the kernel with a
  115. * matching major version.
  116. *
  117. * If the library supports a larger major version, then it shall fall
  118. * back to the major protocol version sent by the kernel for
  119. * communication and reply with that major version (and an arbitrary
  120. * supported minor version).
  121. */
  122. /** Version number of this interface */
  123. #define FUSE_KERNEL_VERSION 7
  124. /** Minor version number of this interface */
  125. #define FUSE_KERNEL_MINOR_VERSION 23
  126. /** The node ID of the root inode */
  127. #define FUSE_ROOT_ID 1
  128. /* Make sure all structures are padded to 64bit boundary, so 32bit
  129. userspace works under 64bit kernels */
  130. struct fuse_attr {
  131. uint64_t ino;
  132. uint64_t size;
  133. uint64_t blocks;
  134. uint64_t atime;
  135. uint64_t mtime;
  136. uint64_t ctime;
  137. uint32_t atimensec;
  138. uint32_t mtimensec;
  139. uint32_t ctimensec;
  140. uint32_t mode;
  141. uint32_t nlink;
  142. uint32_t uid;
  143. uint32_t gid;
  144. uint32_t rdev;
  145. uint32_t blksize;
  146. uint32_t padding;
  147. };
  148. struct fuse_kstatfs {
  149. uint64_t blocks;
  150. uint64_t bfree;
  151. uint64_t bavail;
  152. uint64_t files;
  153. uint64_t ffree;
  154. uint32_t bsize;
  155. uint32_t namelen;
  156. uint32_t frsize;
  157. uint32_t padding;
  158. uint32_t spare[6];
  159. };
  160. struct fuse_file_lock {
  161. uint64_t start;
  162. uint64_t end;
  163. uint32_t type;
  164. uint32_t pid; /* tgid */
  165. };
  166. /**
  167. * Bitmasks for fuse_setattr_in.valid
  168. */
  169. #define FATTR_MODE (1 << 0)
  170. #define FATTR_UID (1 << 1)
  171. #define FATTR_GID (1 << 2)
  172. #define FATTR_SIZE (1 << 3)
  173. #define FATTR_ATIME (1 << 4)
  174. #define FATTR_MTIME (1 << 5)
  175. #define FATTR_FH (1 << 6)
  176. #define FATTR_ATIME_NOW (1 << 7)
  177. #define FATTR_MTIME_NOW (1 << 8)
  178. #define FATTR_LOCKOWNER (1 << 9)
  179. #define FATTR_CTIME (1 << 10)
  180. /**
  181. * Flags returned by the OPEN request
  182. *
  183. * FOPEN_DIRECT_IO: bypass page cache for this open file
  184. * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
  185. * FOPEN_NONSEEKABLE: the file is not seekable
  186. */
  187. #define FOPEN_DIRECT_IO (1 << 0)
  188. #define FOPEN_KEEP_CACHE (1 << 1)
  189. #define FOPEN_NONSEEKABLE (1 << 2)
  190. /**
  191. * INIT request/reply flags
  192. *
  193. * FUSE_ASYNC_READ: asynchronous read requests
  194. * FUSE_POSIX_LOCKS: remote locking for POSIX file locks
  195. * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported)
  196. * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem
  197. * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."
  198. * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB
  199. * FUSE_DONT_MASK: don't apply umask to file mode on create operations
  200. * FUSE_SPLICE_WRITE: kernel supports splice write on the device
  201. * FUSE_SPLICE_MOVE: kernel supports splice move on the device
  202. * FUSE_SPLICE_READ: kernel supports splice read on the device
  203. * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks
  204. * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories
  205. * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages
  206. * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one)
  207. * FUSE_READDIRPLUS_AUTO: adaptive readdirplus
  208. * FUSE_ASYNC_DIO: asynchronous direct I/O submission
  209. * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes
  210. * FUSE_NO_OPEN_SUPPORT: kernel supports zero-message opens
  211. */
  212. #define FUSE_ASYNC_READ (1 << 0)
  213. #define FUSE_POSIX_LOCKS (1 << 1)
  214. #define FUSE_FILE_OPS (1 << 2)
  215. #define FUSE_ATOMIC_O_TRUNC (1 << 3)
  216. #define FUSE_EXPORT_SUPPORT (1 << 4)
  217. #define FUSE_BIG_WRITES (1 << 5)
  218. #define FUSE_DONT_MASK (1 << 6)
  219. #define FUSE_SPLICE_WRITE (1 << 7)
  220. #define FUSE_SPLICE_MOVE (1 << 8)
  221. #define FUSE_SPLICE_READ (1 << 9)
  222. #define FUSE_FLOCK_LOCKS (1 << 10)
  223. #define FUSE_HAS_IOCTL_DIR (1 << 11)
  224. #define FUSE_AUTO_INVAL_DATA (1 << 12)
  225. #define FUSE_DO_READDIRPLUS (1 << 13)
  226. #define FUSE_READDIRPLUS_AUTO (1 << 14)
  227. #define FUSE_ASYNC_DIO (1 << 15)
  228. #define FUSE_WRITEBACK_CACHE (1 << 16)
  229. #define FUSE_NO_OPEN_SUPPORT (1 << 17)
  230. /**
  231. * CUSE INIT request/reply flags
  232. *
  233. * CUSE_UNRESTRICTED_IOCTL: use unrestricted ioctl
  234. */
  235. #define CUSE_UNRESTRICTED_IOCTL (1 << 0)
  236. /**
  237. * Release flags
  238. */
  239. #define FUSE_RELEASE_FLUSH (1 << 0)
  240. #define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1)
  241. /**
  242. * Getattr flags
  243. */
  244. #define FUSE_GETATTR_FH (1 << 0)
  245. /**
  246. * Lock flags
  247. */
  248. #define FUSE_LK_FLOCK (1 << 0)
  249. /**
  250. * WRITE flags
  251. *
  252. * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed
  253. * FUSE_WRITE_LOCKOWNER: lock_owner field is valid
  254. */
  255. #define FUSE_WRITE_CACHE (1 << 0)
  256. #define FUSE_WRITE_LOCKOWNER (1 << 1)
  257. /**
  258. * Read flags
  259. */
  260. #define FUSE_READ_LOCKOWNER (1 << 1)
  261. /**
  262. * Ioctl flags
  263. *
  264. * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
  265. * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
  266. * FUSE_IOCTL_RETRY: retry with new iovecs
  267. * FUSE_IOCTL_32BIT: 32bit ioctl
  268. * FUSE_IOCTL_DIR: is a directory
  269. *
  270. * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
  271. */
  272. #define FUSE_IOCTL_COMPAT (1 << 0)
  273. #define FUSE_IOCTL_UNRESTRICTED (1 << 1)
  274. #define FUSE_IOCTL_RETRY (1 << 2)
  275. #define FUSE_IOCTL_32BIT (1 << 3)
  276. #define FUSE_IOCTL_DIR (1 << 4)
  277. #define FUSE_IOCTL_MAX_IOV 256
  278. /**
  279. * Poll flags
  280. *
  281. * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify
  282. */
  283. #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
  284. enum fuse_opcode {
  285. FUSE_LOOKUP = 1,
  286. FUSE_FORGET = 2, /* no reply */
  287. FUSE_GETATTR = 3,
  288. FUSE_SETATTR = 4,
  289. FUSE_READLINK = 5,
  290. FUSE_SYMLINK = 6,
  291. FUSE_MKNOD = 8,
  292. FUSE_MKDIR = 9,
  293. FUSE_UNLINK = 10,
  294. FUSE_RMDIR = 11,
  295. FUSE_RENAME = 12,
  296. FUSE_LINK = 13,
  297. FUSE_OPEN = 14,
  298. FUSE_READ = 15,
  299. FUSE_WRITE = 16,
  300. FUSE_STATFS = 17,
  301. FUSE_RELEASE = 18,
  302. FUSE_FSYNC = 20,
  303. FUSE_SETXATTR = 21,
  304. FUSE_GETXATTR = 22,
  305. FUSE_LISTXATTR = 23,
  306. FUSE_REMOVEXATTR = 24,
  307. FUSE_FLUSH = 25,
  308. FUSE_INIT = 26,
  309. FUSE_OPENDIR = 27,
  310. FUSE_READDIR = 28,
  311. FUSE_RELEASEDIR = 29,
  312. FUSE_FSYNCDIR = 30,
  313. FUSE_GETLK = 31,
  314. FUSE_SETLK = 32,
  315. FUSE_SETLKW = 33,
  316. FUSE_ACCESS = 34,
  317. FUSE_CREATE = 35,
  318. FUSE_INTERRUPT = 36,
  319. FUSE_BMAP = 37,
  320. FUSE_DESTROY = 38,
  321. FUSE_IOCTL = 39,
  322. FUSE_POLL = 40,
  323. FUSE_NOTIFY_REPLY = 41,
  324. FUSE_BATCH_FORGET = 42,
  325. FUSE_FALLOCATE = 43,
  326. FUSE_READDIRPLUS = 44,
  327. FUSE_RENAME2 = 45,
  328. /* CUSE specific operations */
  329. CUSE_INIT = 4096,
  330. };
  331. enum fuse_notify_code {
  332. FUSE_NOTIFY_POLL = 1,
  333. FUSE_NOTIFY_INVAL_INODE = 2,
  334. FUSE_NOTIFY_INVAL_ENTRY = 3,
  335. FUSE_NOTIFY_STORE = 4,
  336. FUSE_NOTIFY_RETRIEVE = 5,
  337. FUSE_NOTIFY_DELETE = 6,
  338. FUSE_NOTIFY_CODE_MAX,
  339. };
  340. /* The read buffer is required to be at least 8k, but may be much larger */
  341. #define FUSE_MIN_READ_BUFFER 8192
  342. #define FUSE_COMPAT_ENTRY_OUT_SIZE 120
  343. struct fuse_entry_out {
  344. uint64_t nodeid; /* Inode ID */
  345. uint64_t generation; /* Inode generation: nodeid:gen must
  346. be unique for the fs's lifetime */
  347. uint64_t entry_valid; /* Cache timeout for the name */
  348. uint64_t attr_valid; /* Cache timeout for the attributes */
  349. uint32_t entry_valid_nsec;
  350. uint32_t attr_valid_nsec;
  351. struct fuse_attr attr;
  352. };
  353. struct fuse_forget_in {
  354. uint64_t nlookup;
  355. };
  356. struct fuse_forget_one {
  357. uint64_t nodeid;
  358. uint64_t nlookup;
  359. };
  360. struct fuse_batch_forget_in {
  361. uint32_t count;
  362. uint32_t dummy;
  363. };
  364. struct fuse_getattr_in {
  365. uint32_t getattr_flags;
  366. uint32_t dummy;
  367. uint64_t fh;
  368. };
  369. #define FUSE_COMPAT_ATTR_OUT_SIZE 96
  370. struct fuse_attr_out {
  371. uint64_t attr_valid; /* Cache timeout for the attributes */
  372. uint32_t attr_valid_nsec;
  373. uint32_t dummy;
  374. struct fuse_attr attr;
  375. };
  376. #define FUSE_COMPAT_MKNOD_IN_SIZE 8
  377. struct fuse_mknod_in {
  378. uint32_t mode;
  379. uint32_t rdev;
  380. uint32_t umask;
  381. uint32_t padding;
  382. };
  383. struct fuse_mkdir_in {
  384. uint32_t mode;
  385. uint32_t umask;
  386. };
  387. struct fuse_rename_in {
  388. uint64_t newdir;
  389. };
  390. struct fuse_rename2_in {
  391. uint64_t newdir;
  392. uint32_t flags;
  393. uint32_t padding;
  394. };
  395. struct fuse_link_in {
  396. uint64_t oldnodeid;
  397. };
  398. struct fuse_setattr_in {
  399. uint32_t valid;
  400. uint32_t padding;
  401. uint64_t fh;
  402. uint64_t size;
  403. uint64_t lock_owner;
  404. uint64_t atime;
  405. uint64_t mtime;
  406. uint64_t ctime;
  407. uint32_t atimensec;
  408. uint32_t mtimensec;
  409. uint32_t ctimensec;
  410. uint32_t mode;
  411. uint32_t unused4;
  412. uint32_t uid;
  413. uint32_t gid;
  414. uint32_t unused5;
  415. };
  416. struct fuse_open_in {
  417. uint32_t flags;
  418. uint32_t unused;
  419. };
  420. struct fuse_create_in {
  421. uint32_t flags;
  422. uint32_t mode;
  423. uint32_t umask;
  424. uint32_t padding;
  425. };
  426. struct fuse_open_out {
  427. uint64_t fh;
  428. uint32_t open_flags;
  429. uint32_t padding;
  430. };
  431. struct fuse_release_in {
  432. uint64_t fh;
  433. uint32_t flags;
  434. uint32_t release_flags;
  435. uint64_t lock_owner;
  436. };
  437. struct fuse_flush_in {
  438. uint64_t fh;
  439. uint32_t unused;
  440. uint32_t padding;
  441. uint64_t lock_owner;
  442. };
  443. struct fuse_read_in {
  444. uint64_t fh;
  445. uint64_t offset;
  446. uint32_t size;
  447. uint32_t read_flags;
  448. uint64_t lock_owner;
  449. uint32_t flags;
  450. uint32_t padding;
  451. };
  452. #define FUSE_COMPAT_WRITE_IN_SIZE 24
  453. struct fuse_write_in {
  454. uint64_t fh;
  455. uint64_t offset;
  456. uint32_t size;
  457. uint32_t write_flags;
  458. uint64_t lock_owner;
  459. uint32_t flags;
  460. uint32_t padding;
  461. };
  462. struct fuse_write_out {
  463. uint32_t size;
  464. uint32_t padding;
  465. };
  466. #define FUSE_COMPAT_STATFS_SIZE 48
  467. struct fuse_statfs_out {
  468. struct fuse_kstatfs st;
  469. };
  470. struct fuse_fsync_in {
  471. uint64_t fh;
  472. uint32_t fsync_flags;
  473. uint32_t padding;
  474. };
  475. struct fuse_setxattr_in {
  476. uint32_t size;
  477. uint32_t flags;
  478. };
  479. struct fuse_getxattr_in {
  480. uint32_t size;
  481. uint32_t padding;
  482. };
  483. struct fuse_getxattr_out {
  484. uint32_t size;
  485. uint32_t padding;
  486. };
  487. struct fuse_lk_in {
  488. uint64_t fh;
  489. uint64_t owner;
  490. struct fuse_file_lock lk;
  491. uint32_t lk_flags;
  492. uint32_t padding;
  493. };
  494. struct fuse_lk_out {
  495. struct fuse_file_lock lk;
  496. };
  497. struct fuse_access_in {
  498. uint32_t mask;
  499. uint32_t padding;
  500. };
  501. struct fuse_init_in {
  502. uint32_t major;
  503. uint32_t minor;
  504. uint32_t max_readahead;
  505. uint32_t flags;
  506. };
  507. #define FUSE_COMPAT_INIT_OUT_SIZE 8
  508. #define FUSE_COMPAT_22_INIT_OUT_SIZE 24
  509. struct fuse_init_out {
  510. uint32_t major;
  511. uint32_t minor;
  512. uint32_t max_readahead;
  513. uint32_t flags;
  514. uint16_t max_background;
  515. uint16_t congestion_threshold;
  516. uint32_t max_write;
  517. uint32_t time_gran;
  518. uint32_t unused[9];
  519. };
  520. #define CUSE_INIT_INFO_MAX 4096
  521. struct cuse_init_in {
  522. uint32_t major;
  523. uint32_t minor;
  524. uint32_t unused;
  525. uint32_t flags;
  526. };
  527. struct cuse_init_out {
  528. uint32_t major;
  529. uint32_t minor;
  530. uint32_t unused;
  531. uint32_t flags;
  532. uint32_t max_read;
  533. uint32_t max_write;
  534. uint32_t dev_major; /* chardev major */
  535. uint32_t dev_minor; /* chardev minor */
  536. uint32_t spare[10];
  537. };
  538. struct fuse_interrupt_in {
  539. uint64_t unique;
  540. };
  541. struct fuse_bmap_in {
  542. uint64_t block;
  543. uint32_t blocksize;
  544. uint32_t padding;
  545. };
  546. struct fuse_bmap_out {
  547. uint64_t block;
  548. };
  549. struct fuse_ioctl_in {
  550. uint64_t fh;
  551. uint32_t flags;
  552. uint32_t cmd;
  553. uint64_t arg;
  554. uint32_t in_size;
  555. uint32_t out_size;
  556. };
  557. struct fuse_ioctl_iovec {
  558. uint64_t base;
  559. uint64_t len;
  560. };
  561. struct fuse_ioctl_out {
  562. int32_t result;
  563. uint32_t flags;
  564. uint32_t in_iovs;
  565. uint32_t out_iovs;
  566. };
  567. struct fuse_poll_in {
  568. uint64_t fh;
  569. uint64_t kh;
  570. uint32_t flags;
  571. uint32_t events;
  572. };
  573. struct fuse_poll_out {
  574. uint32_t revents;
  575. uint32_t padding;
  576. };
  577. struct fuse_notify_poll_wakeup_out {
  578. uint64_t kh;
  579. };
  580. struct fuse_fallocate_in {
  581. uint64_t fh;
  582. uint64_t offset;
  583. uint64_t length;
  584. uint32_t mode;
  585. uint32_t padding;
  586. };
  587. struct fuse_in_header {
  588. uint32_t len;
  589. uint32_t opcode;
  590. uint64_t unique;
  591. uint64_t nodeid;
  592. uint32_t uid;
  593. uint32_t gid;
  594. uint32_t pid;
  595. uint32_t padding;
  596. };
  597. struct fuse_out_header {
  598. uint32_t len;
  599. int32_t error;
  600. uint64_t unique;
  601. };
  602. struct fuse_dirent {
  603. uint64_t ino;
  604. uint64_t off;
  605. uint32_t namelen;
  606. uint32_t type;
  607. char name[];
  608. };
  609. #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
  610. #define FUSE_DIRENT_ALIGN(x) \
  611. (((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))
  612. #define FUSE_DIRENT_SIZE(d) \
  613. FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
  614. struct fuse_direntplus {
  615. struct fuse_entry_out entry_out;
  616. struct fuse_dirent dirent;
  617. };
  618. #define FUSE_NAME_OFFSET_DIRENTPLUS \
  619. offsetof(struct fuse_direntplus, dirent.name)
  620. #define FUSE_DIRENTPLUS_SIZE(d) \
  621. FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)
  622. struct fuse_notify_inval_inode_out {
  623. uint64_t ino;
  624. int64_t off;
  625. int64_t len;
  626. };
  627. struct fuse_notify_inval_entry_out {
  628. uint64_t parent;
  629. uint32_t namelen;
  630. uint32_t padding;
  631. };
  632. struct fuse_notify_delete_out {
  633. uint64_t parent;
  634. uint64_t child;
  635. uint32_t namelen;
  636. uint32_t padding;
  637. };
  638. struct fuse_notify_store_out {
  639. uint64_t nodeid;
  640. uint64_t offset;
  641. uint32_t size;
  642. uint32_t padding;
  643. };
  644. struct fuse_notify_retrieve_out {
  645. uint64_t notify_unique;
  646. uint64_t nodeid;
  647. uint64_t offset;
  648. uint32_t size;
  649. uint32_t padding;
  650. };
  651. /* Matches the size of fuse_write_in */
  652. struct fuse_notify_retrieve_in {
  653. uint64_t dummy1;
  654. uint64_t offset;
  655. uint32_t size;
  656. uint32_t dummy2;
  657. uint64_t dummy3;
  658. uint64_t dummy4;
  659. };
  660. /* Device ioctls: */
  661. #define FUSE_DEV_IOC_CLONE _IOR(229, 0, uint32_t)
  662. #endif /* _LINUX_FUSE_H */