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.

809 lines
17 KiB

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