fuse.h 17 KB

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