From patchwork Sun Jan 24 23:20:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 1431057 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=2ATXMg5z; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DP8Cz4xZdz9sVm for ; Mon, 25 Jan 2021 10:22:23 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tYSghudK/QOXCT5Vyp/uSeQhfwmNGuf5MxBHiC8GakM=; b=2ATXMg5zsqJiFpRKoKfWG1vKQ h/m7v4Ev6iQDRhHaAhDWFLUAZ+5f9GNYjFo+VoqtCD4HwZ/LAxgXuSlNaXb/j8rbQrYvxxtGlcmd4 a+8ZwaOlen7BmWqPbBLWEf2CnATVDcREGiPleRtOpuUjhsqFshqtE1ug7rbJPqxekUoEnAVW3k17X a5dmGPJ0MOr+g1uIrDWP/vmsqzHjsbhdBpc8gc7k6G811bxzbE0Ms26ZXjZTQJ7Rig5IPvymKf6Qg 4SjVjmMfTzNoGG9GfMYDofyRdxbI3go+YVQ39LcyVWh4RPlQXoQ2X0IjiTnkXhZOSOq4IA9hQ4ph6 jZFobA6uA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l3oh7-00077M-CH; Sun, 24 Jan 2021 23:21:21 +0000 Received: from lilium.sigma-star.at ([109.75.188.150]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l3ogt-00074G-7e for linux-mtd@lists.infradead.org; Sun, 24 Jan 2021 23:21:09 +0000 Received: from localhost (localhost [127.0.0.1]) by lilium.sigma-star.at (Postfix) with ESMTP id C27B2180FCFCB; Mon, 25 Jan 2021 00:21:02 +0100 (CET) Received: from lilium.sigma-star.at ([127.0.0.1]) by localhost (lilium.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 0zSQ5wgsYSEQ; Mon, 25 Jan 2021 00:21:02 +0100 (CET) Received: from lilium.sigma-star.at ([127.0.0.1]) by localhost (lilium.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 2bhaQ0vUSK7X; Mon, 25 Jan 2021 00:21:02 +0100 (CET) From: Richard Weinberger To: miklos@szeredi.hu Subject: [PATCH 6/8] fuse: Add MUSE specific defines FUSE interface Date: Mon, 25 Jan 2021 00:20:05 +0100 Message-Id: <20210124232007.21639-7-richard@nod.at> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210124232007.21639-1-richard@nod.at> References: <20210124232007.21639-1-richard@nod.at> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210124_182107_411173_25876CB1 X-CRM114-Status: GOOD ( 10.86 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 T_SPF_PERMERROR SPF: test of record failed (permerror) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: vigneshr@ti.com, fuse-devel@lists.sourceforge.net, Richard Weinberger , miquel.raynal@bootlin.com, linux-kernel@vger.kernel.org, boris.brezillon@collabora.com, linux-mtd@lists.infradead.org, rminnich@google.com, sven@narfation.org Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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 --- 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 */