[PATCH 6/8] fuse: Add MUSE specific defines FUSE interface

Richard Weinberger
2021-01-24T23:22:20Z

Raise the FUSE API minor version to 34 and add all
MUSE specific operations and data structures.

MUSE_INIT: Initialize a new connection and installs the MTD
MUSE_ERASE: Erases a block
MUSE_READ: Reads a page with or without OOB
MUSE_WRITE: Writes a page with or without OOB
MUSE_MARKBAD: Marks a block as bad
MUSE_ISBAD: Checks whether a block is bad
MUSE_SYNC: Flushes all cached data

Signed-off-by: Richard Weinberger <richard@nod.at>
---
include/uapi/linux/fuse.h | 76 +++++++++++++++++++++++++++++++++++++++
1 file changed, 76 insertions(+)

diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
index 98ca64d1beb6..1c8fa9e42e73 100644
--- a/include/uapi/linux/fuse.h
+++ b/include/uapi/linux/fuse.h
@@ -179,6 +179,10 @@
* 7.33
* - add FUSE_HANDLE_KILLPRIV_V2, FUSE_WRITE_KILL_SUIDGID, FATTR_KILL_SUIDGID
* - add FUSE_OPEN_KILL_SUIDGID
+ *
+ * 7.34
+ * - add support for MUSE: MUSE_INIT, MUSE_ERASE, MUSE_READ, MUSE_WRITE,
+ * MUSE_MARKBAD, MUSE_ISBAD and MUSE_SYNC
*/

#ifndef _LINUX_FUSE_H
@@ -503,6 +507,15 @@ enum fuse_opcode {
/* CUSE specific operations */
CUSE_INIT = 4096,

+ /* MUSE specific operations */
+ MUSE_INIT = 8192,
+ MUSE_ERASE = 8193,
+ MUSE_READ = 8194,
+ MUSE_WRITE = 8195,
+ MUSE_MARKBAD = 8196,
+ MUSE_ISBAD = 8197,
+ MUSE_SYNC = 8198,
+
/* Reserved opcodes: helpful to detect structure endian-ness */
CUSE_INIT_BSWAP_RESERVED = 1048576, /* CUSE_INIT << 8 */
FUSE_INIT_BSWAP_RESERVED = 436207616, /* FUSE_INIT << 24 */
@@ -956,4 +969,67 @@ struct fuse_removemapping_one {
#define FUSE_REMOVEMAPPING_MAX_ENTRY \
(PAGE_SIZE / sizeof(struct fuse_removemapping_one))

+#define MUSE_INIT_INFO_MAX 4096
+
+struct muse_init_in {
+ uint32_t fuse_major;
+ uint32_t fuse_minor;
+};
+
+struct muse_init_out {
+ uint32_t fuse_major;
+ uint32_t fuse_minor;
+ uint32_t max_read;
+ uint32_t max_write;
+};
+
+struct muse_erase_in {
+ uint64_t addr;
+ uint64_t len;
+};
+
+#define MUSE_IO_INBAND (1 << 0)
+#define MUSE_IO_OOB_AUTO (1 << 1)
+#define MUSE_IO_OOB_PLACE (1 << 2)
+#define MUSE_IO_RAW (1 << 3)
+
+struct muse_read_in {
+ uint64_t addr;
+ uint64_t len;
+ uint32_t flags;
+ uint32_t padding;
+};
+
+struct muse_read_out {
+ uint64_t len;
+ uint32_t soft_error;
+ uint32_t padding;
+};
+
+struct muse_write_in {
+ uint64_t addr;
+ uint64_t len;
+ uint32_t flags;
+ uint32_t padding;
+};
+
+struct muse_write_out {
+ uint64_t len;
+ uint32_t soft_error;
+ uint32_t padding;
+};
+
+struct muse_markbad_in {
+ uint64_t addr;
+};
+
+struct muse_isbad_in {
+ uint64_t addr;
+};
+
+struct muse_isbad_out {
+ uint32_t result;
+ uint32_t padding;
+};
+
#endif /* _LINUX_FUSE_H */
--
2.26.2