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.

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