fuse.h 16 KB

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