peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame 0011-virtiofsd-Pull-in-kernel-s-fuse.h.patch

1d442b
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
1d442b
Date: Mon, 27 Jan 2020 19:00:40 +0000
1d442b
Subject: [PATCH] virtiofsd: Pull in kernel's fuse.h
1d442b
MIME-Version: 1.0
1d442b
Content-Type: text/plain; charset=UTF-8
1d442b
Content-Transfer-Encoding: 8bit
1d442b
1d442b
Update scripts/update-linux-headers.sh to add fuse.h and
1d442b
use it to pull in fuse.h from the kernel; from v5.5-rc1
1d442b
1d442b
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
1d442b
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
1d442b
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
1d442b
(cherry picked from commit a62a9e192bc5f0aa0bc076b51db5a069add87c78)
1d442b
---
1d442b
 include/standard-headers/linux/fuse.h | 891 ++++++++++++++++++++++++++
1d442b
 scripts/update-linux-headers.sh       |   1 +
1d442b
 2 files changed, 892 insertions(+)
1d442b
 create mode 100644 include/standard-headers/linux/fuse.h
1d442b
1d442b
diff --git a/include/standard-headers/linux/fuse.h b/include/standard-headers/linux/fuse.h
1d442b
new file mode 100644
1d442b
index 0000000000..f4df0a40f6
1d442b
--- /dev/null
1d442b
+++ b/include/standard-headers/linux/fuse.h
1d442b
@@ -0,0 +1,891 @@
1d442b
+/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */
1d442b
+/*
1d442b
+    This file defines the kernel interface of FUSE
1d442b
+    Copyright (C) 2001-2008  Miklos Szeredi <miklos@szeredi.hu>
1d442b
+
1d442b
+    This program can be distributed under the terms of the GNU GPL.
1d442b
+    See the file COPYING.
1d442b
+
1d442b
+    This -- and only this -- header file may also be distributed under
1d442b
+    the terms of the BSD Licence as follows:
1d442b
+
1d442b
+    Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved.
1d442b
+
1d442b
+    Redistribution and use in source and binary forms, with or without
1d442b
+    modification, are permitted provided that the following conditions
1d442b
+    are met:
1d442b
+    1. Redistributions of source code must retain the above copyright
1d442b
+       notice, this list of conditions and the following disclaimer.
1d442b
+    2. Redistributions in binary form must reproduce the above copyright
1d442b
+       notice, this list of conditions and the following disclaimer in the
1d442b
+       documentation and/or other materials provided with the distribution.
1d442b
+
1d442b
+    THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1d442b
+    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1d442b
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1d442b
+    ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
1d442b
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1d442b
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1d442b
+    OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1d442b
+    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1d442b
+    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1d442b
+    OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1d442b
+    SUCH DAMAGE.
1d442b
+*/
1d442b
+
1d442b
+/*
1d442b
+ * This file defines the kernel interface of FUSE
1d442b
+ *
1d442b
+ * Protocol changelog:
1d442b
+ *
1d442b
+ * 7.1:
1d442b
+ *  - add the following messages:
1d442b
+ *      FUSE_SETATTR, FUSE_SYMLINK, FUSE_MKNOD, FUSE_MKDIR, FUSE_UNLINK,
1d442b
+ *      FUSE_RMDIR, FUSE_RENAME, FUSE_LINK, FUSE_OPEN, FUSE_READ, FUSE_WRITE,
1d442b
+ *      FUSE_RELEASE, FUSE_FSYNC, FUSE_FLUSH, FUSE_SETXATTR, FUSE_GETXATTR,
1d442b
+ *      FUSE_LISTXATTR, FUSE_REMOVEXATTR, FUSE_OPENDIR, FUSE_READDIR,
1d442b
+ *      FUSE_RELEASEDIR
1d442b
+ *  - add padding to messages to accommodate 32-bit servers on 64-bit kernels
1d442b
+ *
1d442b
+ * 7.2:
1d442b
+ *  - add FOPEN_DIRECT_IO and FOPEN_KEEP_CACHE flags
1d442b
+ *  - add FUSE_FSYNCDIR message
1d442b
+ *
1d442b
+ * 7.3:
1d442b
+ *  - add FUSE_ACCESS message
1d442b
+ *  - add FUSE_CREATE message
1d442b
+ *  - add filehandle to fuse_setattr_in
1d442b
+ *
1d442b
+ * 7.4:
1d442b
+ *  - add frsize to fuse_kstatfs
1d442b
+ *  - clean up request size limit checking
1d442b
+ *
1d442b
+ * 7.5:
1d442b
+ *  - add flags and max_write to fuse_init_out
1d442b
+ *
1d442b
+ * 7.6:
1d442b
+ *  - add max_readahead to fuse_init_in and fuse_init_out
1d442b
+ *
1d442b
+ * 7.7:
1d442b
+ *  - add FUSE_INTERRUPT message
1d442b
+ *  - add POSIX file lock support
1d442b
+ *
1d442b
+ * 7.8:
1d442b
+ *  - add lock_owner and flags fields to fuse_release_in
1d442b
+ *  - add FUSE_BMAP message
1d442b
+ *  - add FUSE_DESTROY message
1d442b
+ *
1d442b
+ * 7.9:
1d442b
+ *  - new fuse_getattr_in input argument of GETATTR
1d442b
+ *  - add lk_flags in fuse_lk_in
1d442b
+ *  - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
1d442b
+ *  - add blksize field to fuse_attr
1d442b
+ *  - add file flags field to fuse_read_in and fuse_write_in
1d442b
+ *  - Add ATIME_NOW and MTIME_NOW flags to fuse_setattr_in
1d442b
+ *
1d442b
+ * 7.10
1d442b
+ *  - add nonseekable open flag
1d442b
+ *
1d442b
+ * 7.11
1d442b
+ *  - add IOCTL message
1d442b
+ *  - add unsolicited notification support
1d442b
+ *  - add POLL message and NOTIFY_POLL notification
1d442b
+ *
1d442b
+ * 7.12
1d442b
+ *  - add umask flag to input argument of create, mknod and mkdir
1d442b
+ *  - add notification messages for invalidation of inodes and
1d442b
+ *    directory entries
1d442b
+ *
1d442b
+ * 7.13
1d442b
+ *  - make max number of background requests and congestion threshold
1d442b
+ *    tunables
1d442b
+ *
1d442b
+ * 7.14
1d442b
+ *  - add splice support to fuse device
1d442b
+ *
1d442b
+ * 7.15
1d442b
+ *  - add store notify
1d442b
+ *  - add retrieve notify
1d442b
+ *
1d442b
+ * 7.16
1d442b
+ *  - add BATCH_FORGET request
1d442b
+ *  - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct
1d442b
+ *    fuse_ioctl_iovec' instead of ambiguous 'struct iovec'
1d442b
+ *  - add FUSE_IOCTL_32BIT flag
1d442b
+ *
1d442b
+ * 7.17
1d442b
+ *  - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK
1d442b
+ *
1d442b
+ * 7.18
1d442b
+ *  - add FUSE_IOCTL_DIR flag
1d442b
+ *  - add FUSE_NOTIFY_DELETE
1d442b
+ *
1d442b
+ * 7.19
1d442b
+ *  - add FUSE_FALLOCATE
1d442b
+ *
1d442b
+ * 7.20
1d442b
+ *  - add FUSE_AUTO_INVAL_DATA
1d442b
+ *
1d442b
+ * 7.21
1d442b
+ *  - add FUSE_READDIRPLUS
1d442b
+ *  - send the requested events in POLL request
1d442b
+ *
1d442b
+ * 7.22
1d442b
+ *  - add FUSE_ASYNC_DIO
1d442b
+ *
1d442b
+ * 7.23
1d442b
+ *  - add FUSE_WRITEBACK_CACHE
1d442b
+ *  - add time_gran to fuse_init_out
1d442b
+ *  - add reserved space to fuse_init_out
1d442b
+ *  - add FATTR_CTIME
1d442b
+ *  - add ctime and ctimensec to fuse_setattr_in
1d442b
+ *  - add FUSE_RENAME2 request
1d442b
+ *  - add FUSE_NO_OPEN_SUPPORT flag
1d442b
+ *
1d442b
+ *  7.24
1d442b
+ *  - add FUSE_LSEEK for SEEK_HOLE and SEEK_DATA support
1d442b
+ *
1d442b
+ *  7.25
1d442b
+ *  - add FUSE_PARALLEL_DIROPS
1d442b
+ *
1d442b
+ *  7.26
1d442b
+ *  - add FUSE_HANDLE_KILLPRIV
1d442b
+ *  - add FUSE_POSIX_ACL
1d442b
+ *
1d442b
+ *  7.27
1d442b
+ *  - add FUSE_ABORT_ERROR
1d442b
+ *
1d442b
+ *  7.28
1d442b
+ *  - add FUSE_COPY_FILE_RANGE
1d442b
+ *  - add FOPEN_CACHE_DIR
1d442b
+ *  - add FUSE_MAX_PAGES, add max_pages to init_out
1d442b
+ *  - add FUSE_CACHE_SYMLINKS
1d442b
+ *
1d442b
+ *  7.29
1d442b
+ *  - add FUSE_NO_OPENDIR_SUPPORT flag
1d442b
+ *
1d442b
+ *  7.30
1d442b
+ *  - add FUSE_EXPLICIT_INVAL_DATA
1d442b
+ *  - add FUSE_IOCTL_COMPAT_X32
1d442b
+ *
1d442b
+ *  7.31
1d442b
+ *  - add FUSE_WRITE_KILL_PRIV flag
1d442b
+ *  - add FUSE_SETUPMAPPING and FUSE_REMOVEMAPPING
1d442b
+ *  - add map_alignment to fuse_init_out, add FUSE_MAP_ALIGNMENT flag
1d442b
+ */
1d442b
+
1d442b
+#ifndef _LINUX_FUSE_H
1d442b
+#define _LINUX_FUSE_H
1d442b
+
1d442b
+#include <stdint.h>
1d442b
+
1d442b
+/*
1d442b
+ * Version negotiation:
1d442b
+ *
1d442b
+ * Both the kernel and userspace send the version they support in the
1d442b
+ * INIT request and reply respectively.
1d442b
+ *
1d442b
+ * If the major versions match then both shall use the smallest
1d442b
+ * of the two minor versions for communication.
1d442b
+ *
1d442b
+ * If the kernel supports a larger major version, then userspace shall
1d442b
+ * reply with the major version it supports, ignore the rest of the
1d442b
+ * INIT message and expect a new INIT message from the kernel with a
1d442b
+ * matching major version.
1d442b
+ *
1d442b
+ * If the library supports a larger major version, then it shall fall
1d442b
+ * back to the major protocol version sent by the kernel for
1d442b
+ * communication and reply with that major version (and an arbitrary
1d442b
+ * supported minor version).
1d442b
+ */
1d442b
+
1d442b
+/** Version number of this interface */
1d442b
+#define FUSE_KERNEL_VERSION 7
1d442b
+
1d442b
+/** Minor version number of this interface */
1d442b
+#define FUSE_KERNEL_MINOR_VERSION 31
1d442b
+
1d442b
+/** The node ID of the root inode */
1d442b
+#define FUSE_ROOT_ID 1
1d442b
+
1d442b
+/* Make sure all structures are padded to 64bit boundary, so 32bit
1d442b
+   userspace works under 64bit kernels */
1d442b
+
1d442b
+struct fuse_attr {
1d442b
+	uint64_t	ino;
1d442b
+	uint64_t	size;
1d442b
+	uint64_t	blocks;
1d442b
+	uint64_t	atime;
1d442b
+	uint64_t	mtime;
1d442b
+	uint64_t	ctime;
1d442b
+	uint32_t	atimensec;
1d442b
+	uint32_t	mtimensec;
1d442b
+	uint32_t	ctimensec;
1d442b
+	uint32_t	mode;
1d442b
+	uint32_t	nlink;
1d442b
+	uint32_t	uid;
1d442b
+	uint32_t	gid;
1d442b
+	uint32_t	rdev;
1d442b
+	uint32_t	blksize;
1d442b
+	uint32_t	padding;
1d442b
+};
1d442b
+
1d442b
+struct fuse_kstatfs {
1d442b
+	uint64_t	blocks;
1d442b
+	uint64_t	bfree;
1d442b
+	uint64_t	bavail;
1d442b
+	uint64_t	files;
1d442b
+	uint64_t	ffree;
1d442b
+	uint32_t	bsize;
1d442b
+	uint32_t	namelen;
1d442b
+	uint32_t	frsize;
1d442b
+	uint32_t	padding;
1d442b
+	uint32_t	spare[6];
1d442b
+};
1d442b
+
1d442b
+struct fuse_file_lock {
1d442b
+	uint64_t	start;
1d442b
+	uint64_t	end;
1d442b
+	uint32_t	type;
1d442b
+	uint32_t	pid; /* tgid */
1d442b
+};
1d442b
+
1d442b
+/**
1d442b
+ * Bitmasks for fuse_setattr_in.valid
1d442b
+ */
1d442b
+#define FATTR_MODE	(1 << 0)
1d442b
+#define FATTR_UID	(1 << 1)
1d442b
+#define FATTR_GID	(1 << 2)
1d442b
+#define FATTR_SIZE	(1 << 3)
1d442b
+#define FATTR_ATIME	(1 << 4)
1d442b
+#define FATTR_MTIME	(1 << 5)
1d442b
+#define FATTR_FH	(1 << 6)
1d442b
+#define FATTR_ATIME_NOW	(1 << 7)
1d442b
+#define FATTR_MTIME_NOW	(1 << 8)
1d442b
+#define FATTR_LOCKOWNER	(1 << 9)
1d442b
+#define FATTR_CTIME	(1 << 10)
1d442b
+
1d442b
+/**
1d442b
+ * Flags returned by the OPEN request
1d442b
+ *
1d442b
+ * FOPEN_DIRECT_IO: bypass page cache for this open file
1d442b
+ * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
1d442b
+ * FOPEN_NONSEEKABLE: the file is not seekable
1d442b
+ * FOPEN_CACHE_DIR: allow caching this directory
1d442b
+ * FOPEN_STREAM: the file is stream-like (no file position at all)
1d442b
+ */
1d442b
+#define FOPEN_DIRECT_IO		(1 << 0)
1d442b
+#define FOPEN_KEEP_CACHE	(1 << 1)
1d442b
+#define FOPEN_NONSEEKABLE	(1 << 2)
1d442b
+#define FOPEN_CACHE_DIR		(1 << 3)
1d442b
+#define FOPEN_STREAM		(1 << 4)
1d442b
+
1d442b
+/**
1d442b
+ * INIT request/reply flags
1d442b
+ *
1d442b
+ * FUSE_ASYNC_READ: asynchronous read requests
1d442b
+ * FUSE_POSIX_LOCKS: remote locking for POSIX file locks
1d442b
+ * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported)
1d442b
+ * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem
1d442b
+ * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."
1d442b
+ * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB
1d442b
+ * FUSE_DONT_MASK: don't apply umask to file mode on create operations
1d442b
+ * FUSE_SPLICE_WRITE: kernel supports splice write on the device
1d442b
+ * FUSE_SPLICE_MOVE: kernel supports splice move on the device
1d442b
+ * FUSE_SPLICE_READ: kernel supports splice read on the device
1d442b
+ * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks
1d442b
+ * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories
1d442b
+ * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages
1d442b
+ * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one)
1d442b
+ * FUSE_READDIRPLUS_AUTO: adaptive readdirplus
1d442b
+ * FUSE_ASYNC_DIO: asynchronous direct I/O submission
1d442b
+ * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes
1d442b
+ * FUSE_NO_OPEN_SUPPORT: kernel supports zero-message opens
1d442b
+ * FUSE_PARALLEL_DIROPS: allow parallel lookups and readdir
1d442b
+ * FUSE_HANDLE_KILLPRIV: fs handles killing suid/sgid/cap on write/chown/trunc
1d442b
+ * FUSE_POSIX_ACL: filesystem supports posix acls
1d442b
+ * FUSE_ABORT_ERROR: reading the device after abort returns ECONNABORTED
1d442b
+ * FUSE_MAX_PAGES: init_out.max_pages contains the max number of req pages
1d442b
+ * FUSE_CACHE_SYMLINKS: cache READLINK responses
1d442b
+ * FUSE_NO_OPENDIR_SUPPORT: kernel supports zero-message opendir
1d442b
+ * FUSE_EXPLICIT_INVAL_DATA: only invalidate cached pages on explicit request
1d442b
+ * FUSE_MAP_ALIGNMENT: map_alignment field is valid
1d442b
+ */
1d442b
+#define FUSE_ASYNC_READ		(1 << 0)
1d442b
+#define FUSE_POSIX_LOCKS	(1 << 1)
1d442b
+#define FUSE_FILE_OPS		(1 << 2)
1d442b
+#define FUSE_ATOMIC_O_TRUNC	(1 << 3)
1d442b
+#define FUSE_EXPORT_SUPPORT	(1 << 4)
1d442b
+#define FUSE_BIG_WRITES		(1 << 5)
1d442b
+#define FUSE_DONT_MASK		(1 << 6)
1d442b
+#define FUSE_SPLICE_WRITE	(1 << 7)
1d442b
+#define FUSE_SPLICE_MOVE	(1 << 8)
1d442b
+#define FUSE_SPLICE_READ	(1 << 9)
1d442b
+#define FUSE_FLOCK_LOCKS	(1 << 10)
1d442b
+#define FUSE_HAS_IOCTL_DIR	(1 << 11)
1d442b
+#define FUSE_AUTO_INVAL_DATA	(1 << 12)
1d442b
+#define FUSE_DO_READDIRPLUS	(1 << 13)
1d442b
+#define FUSE_READDIRPLUS_AUTO	(1 << 14)
1d442b
+#define FUSE_ASYNC_DIO		(1 << 15)
1d442b
+#define FUSE_WRITEBACK_CACHE	(1 << 16)
1d442b
+#define FUSE_NO_OPEN_SUPPORT	(1 << 17)
1d442b
+#define FUSE_PARALLEL_DIROPS    (1 << 18)
1d442b
+#define FUSE_HANDLE_KILLPRIV	(1 << 19)
1d442b
+#define FUSE_POSIX_ACL		(1 << 20)
1d442b
+#define FUSE_ABORT_ERROR	(1 << 21)
1d442b
+#define FUSE_MAX_PAGES		(1 << 22)
1d442b
+#define FUSE_CACHE_SYMLINKS	(1 << 23)
1d442b
+#define FUSE_NO_OPENDIR_SUPPORT (1 << 24)
1d442b
+#define FUSE_EXPLICIT_INVAL_DATA (1 << 25)
1d442b
+#define FUSE_MAP_ALIGNMENT	(1 << 26)
1d442b
+
1d442b
+/**
1d442b
+ * CUSE INIT request/reply flags
1d442b
+ *
1d442b
+ * CUSE_UNRESTRICTED_IOCTL:  use unrestricted ioctl
1d442b
+ */
1d442b
+#define CUSE_UNRESTRICTED_IOCTL	(1 << 0)
1d442b
+
1d442b
+/**
1d442b
+ * Release flags
1d442b
+ */
1d442b
+#define FUSE_RELEASE_FLUSH	(1 << 0)
1d442b
+#define FUSE_RELEASE_FLOCK_UNLOCK	(1 << 1)
1d442b
+
1d442b
+/**
1d442b
+ * Getattr flags
1d442b
+ */
1d442b
+#define FUSE_GETATTR_FH		(1 << 0)
1d442b
+
1d442b
+/**
1d442b
+ * Lock flags
1d442b
+ */
1d442b
+#define FUSE_LK_FLOCK		(1 << 0)
1d442b
+
1d442b
+/**
1d442b
+ * WRITE flags
1d442b
+ *
1d442b
+ * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed
1d442b
+ * FUSE_WRITE_LOCKOWNER: lock_owner field is valid
1d442b
+ * FUSE_WRITE_KILL_PRIV: kill suid and sgid bits
1d442b
+ */
1d442b
+#define FUSE_WRITE_CACHE	(1 << 0)
1d442b
+#define FUSE_WRITE_LOCKOWNER	(1 << 1)
1d442b
+#define FUSE_WRITE_KILL_PRIV	(1 << 2)
1d442b
+
1d442b
+/**
1d442b
+ * Read flags
1d442b
+ */
1d442b
+#define FUSE_READ_LOCKOWNER	(1 << 1)
1d442b
+
1d442b
+/**
1d442b
+ * Ioctl flags
1d442b
+ *
1d442b
+ * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
1d442b
+ * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
1d442b
+ * FUSE_IOCTL_RETRY: retry with new iovecs
1d442b
+ * FUSE_IOCTL_32BIT: 32bit ioctl
1d442b
+ * FUSE_IOCTL_DIR: is a directory
1d442b
+ * FUSE_IOCTL_COMPAT_X32: x32 compat ioctl on 64bit machine (64bit time_t)
1d442b
+ *
1d442b
+ * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
1d442b
+ */
1d442b
+#define FUSE_IOCTL_COMPAT	(1 << 0)
1d442b
+#define FUSE_IOCTL_UNRESTRICTED	(1 << 1)
1d442b
+#define FUSE_IOCTL_RETRY	(1 << 2)
1d442b
+#define FUSE_IOCTL_32BIT	(1 << 3)
1d442b
+#define FUSE_IOCTL_DIR		(1 << 4)
1d442b
+#define FUSE_IOCTL_COMPAT_X32	(1 << 5)
1d442b
+
1d442b
+#define FUSE_IOCTL_MAX_IOV	256
1d442b
+
1d442b
+/**
1d442b
+ * Poll flags
1d442b
+ *
1d442b
+ * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify
1d442b
+ */
1d442b
+#define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
1d442b
+
1d442b
+/**
1d442b
+ * Fsync flags
1d442b
+ *
1d442b
+ * FUSE_FSYNC_FDATASYNC: Sync data only, not metadata
1d442b
+ */
1d442b
+#define FUSE_FSYNC_FDATASYNC	(1 << 0)
1d442b
+
1d442b
+enum fuse_opcode {
1d442b
+	FUSE_LOOKUP		= 1,
1d442b
+	FUSE_FORGET		= 2,  /* no reply */
1d442b
+	FUSE_GETATTR		= 3,
1d442b
+	FUSE_SETATTR		= 4,
1d442b
+	FUSE_READLINK		= 5,
1d442b
+	FUSE_SYMLINK		= 6,
1d442b
+	FUSE_MKNOD		= 8,
1d442b
+	FUSE_MKDIR		= 9,
1d442b
+	FUSE_UNLINK		= 10,
1d442b
+	FUSE_RMDIR		= 11,
1d442b
+	FUSE_RENAME		= 12,
1d442b
+	FUSE_LINK		= 13,
1d442b
+	FUSE_OPEN		= 14,
1d442b
+	FUSE_READ		= 15,
1d442b
+	FUSE_WRITE		= 16,
1d442b
+	FUSE_STATFS		= 17,
1d442b
+	FUSE_RELEASE		= 18,
1d442b
+	FUSE_FSYNC		= 20,
1d442b
+	FUSE_SETXATTR		= 21,
1d442b
+	FUSE_GETXATTR		= 22,
1d442b
+	FUSE_LISTXATTR		= 23,
1d442b
+	FUSE_REMOVEXATTR	= 24,
1d442b
+	FUSE_FLUSH		= 25,
1d442b
+	FUSE_INIT		= 26,
1d442b
+	FUSE_OPENDIR		= 27,
1d442b
+	FUSE_READDIR		= 28,
1d442b
+	FUSE_RELEASEDIR		= 29,
1d442b
+	FUSE_FSYNCDIR		= 30,
1d442b
+	FUSE_GETLK		= 31,
1d442b
+	FUSE_SETLK		= 32,
1d442b
+	FUSE_SETLKW		= 33,
1d442b
+	FUSE_ACCESS		= 34,
1d442b
+	FUSE_CREATE		= 35,
1d442b
+	FUSE_INTERRUPT		= 36,
1d442b
+	FUSE_BMAP		= 37,
1d442b
+	FUSE_DESTROY		= 38,
1d442b
+	FUSE_IOCTL		= 39,
1d442b
+	FUSE_POLL		= 40,
1d442b
+	FUSE_NOTIFY_REPLY	= 41,
1d442b
+	FUSE_BATCH_FORGET	= 42,
1d442b
+	FUSE_FALLOCATE		= 43,
1d442b
+	FUSE_READDIRPLUS	= 44,
1d442b
+	FUSE_RENAME2		= 45,
1d442b
+	FUSE_LSEEK		= 46,
1d442b
+	FUSE_COPY_FILE_RANGE	= 47,
1d442b
+	FUSE_SETUPMAPPING	= 48,
1d442b
+	FUSE_REMOVEMAPPING	= 49,
1d442b
+
1d442b
+	/* CUSE specific operations */
1d442b
+	CUSE_INIT		= 4096,
1d442b
+
1d442b
+	/* Reserved opcodes: helpful to detect structure endian-ness */
1d442b
+	CUSE_INIT_BSWAP_RESERVED	= 1048576,	/* CUSE_INIT << 8 */
1d442b
+	FUSE_INIT_BSWAP_RESERVED	= 436207616,	/* FUSE_INIT << 24 */
1d442b
+};
1d442b
+
1d442b
+enum fuse_notify_code {
1d442b
+	FUSE_NOTIFY_POLL   = 1,
1d442b
+	FUSE_NOTIFY_INVAL_INODE = 2,
1d442b
+	FUSE_NOTIFY_INVAL_ENTRY = 3,
1d442b
+	FUSE_NOTIFY_STORE = 4,
1d442b
+	FUSE_NOTIFY_RETRIEVE = 5,
1d442b
+	FUSE_NOTIFY_DELETE = 6,
1d442b
+	FUSE_NOTIFY_CODE_MAX,
1d442b
+};
1d442b
+
1d442b
+/* The read buffer is required to be at least 8k, but may be much larger */
1d442b
+#define FUSE_MIN_READ_BUFFER 8192
1d442b
+
1d442b
+#define FUSE_COMPAT_ENTRY_OUT_SIZE 120
1d442b
+
1d442b
+struct fuse_entry_out {
1d442b
+	uint64_t	nodeid;		/* Inode ID */
1d442b
+	uint64_t	generation;	/* Inode generation: nodeid:gen must
1d442b
+					   be unique for the fs's lifetime */
1d442b
+	uint64_t	entry_valid;	/* Cache timeout for the name */
1d442b
+	uint64_t	attr_valid;	/* Cache timeout for the attributes */
1d442b
+	uint32_t	entry_valid_nsec;
1d442b
+	uint32_t	attr_valid_nsec;
1d442b
+	struct fuse_attr attr;
1d442b
+};
1d442b
+
1d442b
+struct fuse_forget_in {
1d442b
+	uint64_t	nlookup;
1d442b
+};
1d442b
+
1d442b
+struct fuse_forget_one {
1d442b
+	uint64_t	nodeid;
1d442b
+	uint64_t	nlookup;
1d442b
+};
1d442b
+
1d442b
+struct fuse_batch_forget_in {
1d442b
+	uint32_t	count;
1d442b
+	uint32_t	dummy;
1d442b
+};
1d442b
+
1d442b
+struct fuse_getattr_in {
1d442b
+	uint32_t	getattr_flags;
1d442b
+	uint32_t	dummy;
1d442b
+	uint64_t	fh;
1d442b
+};
1d442b
+
1d442b
+#define FUSE_COMPAT_ATTR_OUT_SIZE 96
1d442b
+
1d442b
+struct fuse_attr_out {
1d442b
+	uint64_t	attr_valid;	/* Cache timeout for the attributes */
1d442b
+	uint32_t	attr_valid_nsec;
1d442b
+	uint32_t	dummy;
1d442b
+	struct fuse_attr attr;
1d442b
+};
1d442b
+
1d442b
+#define FUSE_COMPAT_MKNOD_IN_SIZE 8
1d442b
+
1d442b
+struct fuse_mknod_in {
1d442b
+	uint32_t	mode;
1d442b
+	uint32_t	rdev;
1d442b
+	uint32_t	umask;
1d442b
+	uint32_t	padding;
1d442b
+};
1d442b
+
1d442b
+struct fuse_mkdir_in {
1d442b
+	uint32_t	mode;
1d442b
+	uint32_t	umask;
1d442b
+};
1d442b
+
1d442b
+struct fuse_rename_in {
1d442b
+	uint64_t	newdir;
1d442b
+};
1d442b
+
1d442b
+struct fuse_rename2_in {
1d442b
+	uint64_t	newdir;
1d442b
+	uint32_t	flags;
1d442b
+	uint32_t	padding;
1d442b
+};
1d442b
+
1d442b
+struct fuse_link_in {
1d442b
+	uint64_t	oldnodeid;
1d442b
+};
1d442b
+
1d442b
+struct fuse_setattr_in {
1d442b
+	uint32_t	valid;
1d442b
+	uint32_t	padding;
1d442b
+	uint64_t	fh;
1d442b
+	uint64_t	size;
1d442b
+	uint64_t	lock_owner;
1d442b
+	uint64_t	atime;
1d442b
+	uint64_t	mtime;
1d442b
+	uint64_t	ctime;
1d442b
+	uint32_t	atimensec;
1d442b
+	uint32_t	mtimensec;
1d442b
+	uint32_t	ctimensec;
1d442b
+	uint32_t	mode;
1d442b
+	uint32_t	unused4;
1d442b
+	uint32_t	uid;
1d442b
+	uint32_t	gid;
1d442b
+	uint32_t	unused5;
1d442b
+};
1d442b
+
1d442b
+struct fuse_open_in {
1d442b
+	uint32_t	flags;
1d442b
+	uint32_t	unused;
1d442b
+};
1d442b
+
1d442b
+struct fuse_create_in {
1d442b
+	uint32_t	flags;
1d442b
+	uint32_t	mode;
1d442b
+	uint32_t	umask;
1d442b
+	uint32_t	padding;
1d442b
+};
1d442b
+
1d442b
+struct fuse_open_out {
1d442b
+	uint64_t	fh;
1d442b
+	uint32_t	open_flags;
1d442b
+	uint32_t	padding;
1d442b
+};
1d442b
+
1d442b
+struct fuse_release_in {
1d442b
+	uint64_t	fh;
1d442b
+	uint32_t	flags;
1d442b
+	uint32_t	release_flags;
1d442b
+	uint64_t	lock_owner;
1d442b
+};
1d442b
+
1d442b
+struct fuse_flush_in {
1d442b
+	uint64_t	fh;
1d442b
+	uint32_t	unused;
1d442b
+	uint32_t	padding;
1d442b
+	uint64_t	lock_owner;
1d442b
+};
1d442b
+
1d442b
+struct fuse_read_in {
1d442b
+	uint64_t	fh;
1d442b
+	uint64_t	offset;
1d442b
+	uint32_t	size;
1d442b
+	uint32_t	read_flags;
1d442b
+	uint64_t	lock_owner;
1d442b
+	uint32_t	flags;
1d442b
+	uint32_t	padding;
1d442b
+};
1d442b
+
1d442b
+#define FUSE_COMPAT_WRITE_IN_SIZE 24
1d442b
+
1d442b
+struct fuse_write_in {
1d442b
+	uint64_t	fh;
1d442b
+	uint64_t	offset;
1d442b
+	uint32_t	size;
1d442b
+	uint32_t	write_flags;
1d442b
+	uint64_t	lock_owner;
1d442b
+	uint32_t	flags;
1d442b
+	uint32_t	padding;
1d442b
+};
1d442b
+
1d442b
+struct fuse_write_out {
1d442b
+	uint32_t	size;
1d442b
+	uint32_t	padding;
1d442b
+};
1d442b
+
1d442b
+#define FUSE_COMPAT_STATFS_SIZE 48
1d442b
+
1d442b
+struct fuse_statfs_out {
1d442b
+	struct fuse_kstatfs st;
1d442b
+};
1d442b
+
1d442b
+struct fuse_fsync_in {
1d442b
+	uint64_t	fh;
1d442b
+	uint32_t	fsync_flags;
1d442b
+	uint32_t	padding;
1d442b
+};
1d442b
+
1d442b
+struct fuse_setxattr_in {
1d442b
+	uint32_t	size;
1d442b
+	uint32_t	flags;
1d442b
+};
1d442b
+
1d442b
+struct fuse_getxattr_in {
1d442b
+	uint32_t	size;
1d442b
+	uint32_t	padding;
1d442b
+};
1d442b
+
1d442b
+struct fuse_getxattr_out {
1d442b
+	uint32_t	size;
1d442b
+	uint32_t	padding;
1d442b
+};
1d442b
+
1d442b
+struct fuse_lk_in {
1d442b
+	uint64_t	fh;
1d442b
+	uint64_t	owner;
1d442b
+	struct fuse_file_lock lk;
1d442b
+	uint32_t	lk_flags;
1d442b
+	uint32_t	padding;
1d442b
+};
1d442b
+
1d442b
+struct fuse_lk_out {
1d442b
+	struct fuse_file_lock lk;
1d442b
+};
1d442b
+
1d442b
+struct fuse_access_in {
1d442b
+	uint32_t	mask;
1d442b
+	uint32_t	padding;
1d442b
+};
1d442b
+
1d442b
+struct fuse_init_in {
1d442b
+	uint32_t	major;
1d442b
+	uint32_t	minor;
1d442b
+	uint32_t	max_readahead;
1d442b
+	uint32_t	flags;
1d442b
+};
1d442b
+
1d442b
+#define FUSE_COMPAT_INIT_OUT_SIZE 8
1d442b
+#define FUSE_COMPAT_22_INIT_OUT_SIZE 24
1d442b
+
1d442b
+struct fuse_init_out {
1d442b
+	uint32_t	major;
1d442b
+	uint32_t	minor;
1d442b
+	uint32_t	max_readahead;
1d442b
+	uint32_t	flags;
1d442b
+	uint16_t	max_background;
1d442b
+	uint16_t	congestion_threshold;
1d442b
+	uint32_t	max_write;
1d442b
+	uint32_t	time_gran;
1d442b
+	uint16_t	max_pages;
1d442b
+	uint16_t	map_alignment;
1d442b
+	uint32_t	unused[8];
1d442b
+};
1d442b
+
1d442b
+#define CUSE_INIT_INFO_MAX 4096
1d442b
+
1d442b
+struct cuse_init_in {
1d442b
+	uint32_t	major;
1d442b
+	uint32_t	minor;
1d442b
+	uint32_t	unused;
1d442b
+	uint32_t	flags;
1d442b
+};
1d442b
+
1d442b
+struct cuse_init_out {
1d442b
+	uint32_t	major;
1d442b
+	uint32_t	minor;
1d442b
+	uint32_t	unused;
1d442b
+	uint32_t	flags;
1d442b
+	uint32_t	max_read;
1d442b
+	uint32_t	max_write;
1d442b
+	uint32_t	dev_major;		/* chardev major */
1d442b
+	uint32_t	dev_minor;		/* chardev minor */
1d442b
+	uint32_t	spare[10];
1d442b
+};
1d442b
+
1d442b
+struct fuse_interrupt_in {
1d442b
+	uint64_t	unique;
1d442b
+};
1d442b
+
1d442b
+struct fuse_bmap_in {
1d442b
+	uint64_t	block;
1d442b
+	uint32_t	blocksize;
1d442b
+	uint32_t	padding;
1d442b
+};
1d442b
+
1d442b
+struct fuse_bmap_out {
1d442b
+	uint64_t	block;
1d442b
+};
1d442b
+
1d442b
+struct fuse_ioctl_in {
1d442b
+	uint64_t	fh;
1d442b
+	uint32_t	flags;
1d442b
+	uint32_t	cmd;
1d442b
+	uint64_t	arg;
1d442b
+	uint32_t	in_size;
1d442b
+	uint32_t	out_size;
1d442b
+};
1d442b
+
1d442b
+struct fuse_ioctl_iovec {
1d442b
+	uint64_t	base;
1d442b
+	uint64_t	len;
1d442b
+};
1d442b
+
1d442b
+struct fuse_ioctl_out {
1d442b
+	int32_t		result;
1d442b
+	uint32_t	flags;
1d442b
+	uint32_t	in_iovs;
1d442b
+	uint32_t	out_iovs;
1d442b
+};
1d442b
+
1d442b
+struct fuse_poll_in {
1d442b
+	uint64_t	fh;
1d442b
+	uint64_t	kh;
1d442b
+	uint32_t	flags;
1d442b
+	uint32_t	events;
1d442b
+};
1d442b
+
1d442b
+struct fuse_poll_out {
1d442b
+	uint32_t	revents;
1d442b
+	uint32_t	padding;
1d442b
+};
1d442b
+
1d442b
+struct fuse_notify_poll_wakeup_out {
1d442b
+	uint64_t	kh;
1d442b
+};
1d442b
+
1d442b
+struct fuse_fallocate_in {
1d442b
+	uint64_t	fh;
1d442b
+	uint64_t	offset;
1d442b
+	uint64_t	length;
1d442b
+	uint32_t	mode;
1d442b
+	uint32_t	padding;
1d442b
+};
1d442b
+
1d442b
+struct fuse_in_header {
1d442b
+	uint32_t	len;
1d442b
+	uint32_t	opcode;
1d442b
+	uint64_t	unique;
1d442b
+	uint64_t	nodeid;
1d442b
+	uint32_t	uid;
1d442b
+	uint32_t	gid;
1d442b
+	uint32_t	pid;
1d442b
+	uint32_t	padding;
1d442b
+};
1d442b
+
1d442b
+struct fuse_out_header {
1d442b
+	uint32_t	len;
1d442b
+	int32_t		error;
1d442b
+	uint64_t	unique;
1d442b
+};
1d442b
+
1d442b
+struct fuse_dirent {
1d442b
+	uint64_t	ino;
1d442b
+	uint64_t	off;
1d442b
+	uint32_t	namelen;
1d442b
+	uint32_t	type;
1d442b
+	char name[];
1d442b
+};
1d442b
+
1d442b
+#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
1d442b
+#define FUSE_DIRENT_ALIGN(x) \
1d442b
+	(((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))
1d442b
+#define FUSE_DIRENT_SIZE(d) \
1d442b
+	FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
1d442b
+
1d442b
+struct fuse_direntplus {
1d442b
+	struct fuse_entry_out entry_out;
1d442b
+	struct fuse_dirent dirent;
1d442b
+};
1d442b
+
1d442b
+#define FUSE_NAME_OFFSET_DIRENTPLUS \
1d442b
+	offsetof(struct fuse_direntplus, dirent.name)
1d442b
+#define FUSE_DIRENTPLUS_SIZE(d) \
1d442b
+	FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)
1d442b
+
1d442b
+struct fuse_notify_inval_inode_out {
1d442b
+	uint64_t	ino;
1d442b
+	int64_t		off;
1d442b
+	int64_t		len;
1d442b
+};
1d442b
+
1d442b
+struct fuse_notify_inval_entry_out {
1d442b
+	uint64_t	parent;
1d442b
+	uint32_t	namelen;
1d442b
+	uint32_t	padding;
1d442b
+};
1d442b
+
1d442b
+struct fuse_notify_delete_out {
1d442b
+	uint64_t	parent;
1d442b
+	uint64_t	child;
1d442b
+	uint32_t	namelen;
1d442b
+	uint32_t	padding;
1d442b
+};
1d442b
+
1d442b
+struct fuse_notify_store_out {
1d442b
+	uint64_t	nodeid;
1d442b
+	uint64_t	offset;
1d442b
+	uint32_t	size;
1d442b
+	uint32_t	padding;
1d442b
+};
1d442b
+
1d442b
+struct fuse_notify_retrieve_out {
1d442b
+	uint64_t	notify_unique;
1d442b
+	uint64_t	nodeid;
1d442b
+	uint64_t	offset;
1d442b
+	uint32_t	size;
1d442b
+	uint32_t	padding;
1d442b
+};
1d442b
+
1d442b
+/* Matches the size of fuse_write_in */
1d442b
+struct fuse_notify_retrieve_in {
1d442b
+	uint64_t	dummy1;
1d442b
+	uint64_t	offset;
1d442b
+	uint32_t	size;
1d442b
+	uint32_t	dummy2;
1d442b
+	uint64_t	dummy3;
1d442b
+	uint64_t	dummy4;
1d442b
+};
1d442b
+
1d442b
+/* Device ioctls: */
1d442b
+#define FUSE_DEV_IOC_CLONE	_IOR(229, 0, uint32_t)
1d442b
+
1d442b
+struct fuse_lseek_in {
1d442b
+	uint64_t	fh;
1d442b
+	uint64_t	offset;
1d442b
+	uint32_t	whence;
1d442b
+	uint32_t	padding;
1d442b
+};
1d442b
+
1d442b
+struct fuse_lseek_out {
1d442b
+	uint64_t	offset;
1d442b
+};
1d442b
+
1d442b
+struct fuse_copy_file_range_in {
1d442b
+	uint64_t	fh_in;
1d442b
+	uint64_t	off_in;
1d442b
+	uint64_t	nodeid_out;
1d442b
+	uint64_t	fh_out;
1d442b
+	uint64_t	off_out;
1d442b
+	uint64_t	len;
1d442b
+	uint64_t	flags;
1d442b
+};
1d442b
+
1d442b
+#endif /* _LINUX_FUSE_H */
1d442b
diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
1d442b
index f76d77363b..29c27f4681 100755
1d442b
--- a/scripts/update-linux-headers.sh
1d442b
+++ b/scripts/update-linux-headers.sh
1d442b
@@ -186,6 +186,7 @@ rm -rf "$output/include/standard-headers/linux"
1d442b
 mkdir -p "$output/include/standard-headers/linux"
1d442b
 for i in "$tmpdir"/include/linux/*virtio*.h \
1d442b
          "$tmpdir/include/linux/qemu_fw_cfg.h" \
1d442b
+         "$tmpdir/include/linux/fuse.h" \
1d442b
          "$tmpdir/include/linux/input.h" \
1d442b
          "$tmpdir/include/linux/input-event-codes.h" \
1d442b
          "$tmpdir/include/linux/pci_regs.h" \