virtiofs: introduce setupmapping/removemapping commands
authorVivek Goyal <vgoyal@redhat.com>
Wed, 19 Aug 2020 22:19:50 +0000 (18:19 -0400)
committerMiklos Szeredi <mszeredi@redhat.com>
Thu, 10 Sep 2020 09:39:23 +0000 (11:39 +0200)
Introduce two new fuse commands to setup/remove memory mappings. This
will be used to setup/tear down file mapping in dax window.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Peng Tao <tao.peng@linux.alibaba.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
include/uapi/linux/fuse.h

index 5b85819..60a7bfc 100644 (file)
@@ -894,4 +894,33 @@ struct fuse_copy_file_range_in {
        uint64_t        flags;
 };
 
+#define FUSE_SETUPMAPPING_FLAG_WRITE (1ull << 0)
+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;
+};
+
+struct fuse_removemapping_in {
+       /* number of fuse_removemapping_one follows */
+       uint32_t        count;
+};
+
+struct fuse_removemapping_one {
+       /* Offset into the dax window start the unmapping */
+       uint64_t        moffset;
+       /* Length of mapping required */
+       uint64_t        len;
+};
+
+#define FUSE_REMOVEMAPPING_MAX_ENTRY   \
+               (PAGE_SIZE / sizeof(struct fuse_removemapping_one))
+
 #endif /* _LINUX_FUSE_H */