linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: linux-fsdevel@vger.kernel.org, miklos@szeredi.hu, Nikolaus@rath.org
Cc: stefanha@redhat.com, vgoyal@redhat.com, tao.peng@linux.alibaba.com
Subject: [PATCH 1/3] fuse: Add 'setupmapping'
Date: Fri,  2 Aug 2019 18:15:19 +0100	[thread overview]
Message-ID: <20190802171521.21807-2-dgilbert@redhat.com> (raw)
In-Reply-To: <20190802171521.21807-1-dgilbert@redhat.com>

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

'setupmapping' is a command for use with 'virtiofsd', a fuse-over-virtio
implementation; it may find use in other fuse impelementations as well
in which the kernel does not have access to the address space of the
daemon directly.

A 'setupmapping' operation causes a section of a file to be mapped
into a memory window visible to the kernel.
The offsets in the file and the window are defined by the kernel performing
the operation.

The daemon may reject the request, for reasons including permissions and
limited resources.

When a request perfectly overlaps a previous mapping, the
previous mapping is replaced.  When a mapping partially overlaps a previous
mapping, the previous mapping is split into one or two smaller mappings.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 include/uapi/linux/fuse.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
index 2971d29a42e4..fb79d4d0b3a7 100644
--- a/include/uapi/linux/fuse.h
+++ b/include/uapi/linux/fuse.h
@@ -133,6 +133,7 @@
  *
  *  7.31
  *  - add FUSE_WRITE_KILL_PRIV flag
+ *  - add FUSE_SETUPMAPPING
  */
 
 #ifndef _LINUX_FUSE_H
@@ -422,6 +423,7 @@ enum fuse_opcode {
 	FUSE_RENAME2		= 45,
 	FUSE_LSEEK		= 46,
 	FUSE_COPY_FILE_RANGE	= 47,
+	FUSE_SETUPMAPPING	= 48,
 
 	/* CUSE specific operations */
 	CUSE_INIT		= 4096,
@@ -845,4 +847,19 @@ struct fuse_copy_file_range_in {
 	uint64_t	flags;
 };
 
+#define FUSE_SETUPMAPPING_FLAG_WRITE	(1ull << 0)
+#define FUSE_SETUPMAPPING_FLAG_READ	(1ull << 1)
+struct fuse_setupmapping_in {
+	/* An already open handle */
+	uint64_t	fh;
+	/* Offset into the file to start the mapping */
+	uint64_t	foffset;
+	/* Length of mapping required */
+	uint64_t	len;
+	/* Flags, FUSE_SETUPMAPPING_FLAG_* */
+	uint64_t	flags;
+	/* Offset in Memory Window */
+	uint64_t	moffset;
+};
+
 #endif /* _LINUX_FUSE_H */
-- 
2.21.0


  reply	other threads:[~2019-08-02 17:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-02 17:15 [PATCH 0/3] Fuse definitions for virtiofs Dr. David Alan Gilbert (git)
2019-08-02 17:15 ` Dr. David Alan Gilbert (git) [this message]
2019-08-02 17:15 ` [PATCH 2/3] fuse: add 'removemapping' Dr. David Alan Gilbert (git)
2019-08-02 17:15 ` [PATCH 3/3] fuse: Add map_alignment for setup/remove mapping Dr. David Alan Gilbert (git)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190802171521.21807-2-dgilbert@redhat.com \
    --to=dgilbert@redhat.com \
    --cc=Nikolaus@rath.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=stefanha@redhat.com \
    --cc=tao.peng@linux.alibaba.com \
    --cc=vgoyal@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).