thebeanogamer / rpms / qemu-kvm

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