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.

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