From patchwork Thu Oct 5 23:08:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Edwards X-Patchwork-Id: 1844178 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=GptpDXJ4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S1nLK0C60z1yqD for ; Fri, 6 Oct 2023 10:08:55 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0AE4A86BDF; Fri, 6 Oct 2023 01:08:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GptpDXJ4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8B80586C2F; Fri, 6 Oct 2023 01:08:45 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D999F86AB3 for ; Fri, 6 Oct 2023 01:08:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=cfsworks@gmail.com Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-352308c0799so6222635ab.2 for ; Thu, 05 Oct 2023 16:08:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696547320; x=1697152120; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=KTTlwcuq7oz/hnR9jBdwuqizbLOus3krmkoDrF9Pqls=; b=GptpDXJ4LLLlyhOb073kzJWcLJdESn2gSr2cJ3N4Xwrxlv6RApB1ceZogYZwHdgxSp dCnQNEqBxTqQhaqU5C1zHaO3uJSCekw5h5PFp+JTm8ZApo+aJQNFmFONncAmePwZSnlt 0DF6AVW3WayrTMtEtGq/tlk+xN7qX36T56Wu9UlqOnZ2vKLO8TIoq+PnuHDesJEbZthR T9JkCPWg4drfepeJm3+4lcqo6JkTirIe24K9fXs7XuhUByD4cSs543pjwiZS9COQLYQT vHK73lIrQW5EWlfXTUDhV/+v72uBTeexeY5Wcxakw6TAu2GGiIDVfD23dufuZM6+8+/h P9xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696547320; x=1697152120; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KTTlwcuq7oz/hnR9jBdwuqizbLOus3krmkoDrF9Pqls=; b=EslC2lWVX5MXP9kWqmpktceOLCEvqMre/eptiheBJVqIjyBoV941j3LHpb7VaaisVf k22IwLQSJkBxvNCKuiI7mNoC05TjNCo1UoqLsaqHgSpLByRELitNUDJpM5PImpeUe00b 5wLAk4a6+kzfpmtozktcp6786e9KcqivH3Z51vwVLJYAl1/v5l9J0rvJLpW+AJgsSol9 OSeXm/J03wYPhQ2D0Rh2C/5L+tMluuEDSZZxTKJOCY0EZ/UqgVOA1QCKexVX0JYnwfMK uXZoMJ8n6wWGOUxcvCsuLiRtNLTD0+GOB/AWc1oxey6D0vdtydXP87iZcY0BvFP+hjLb 3fqQ== X-Gm-Message-State: AOJu0YzPBiFTpkF1JiL1zVVlE2xMCyS8Ed7l9YafFoaRMLMZbATCJoP4 oxLxS9UHCwRWEZJ/Ojy8Wcs= X-Google-Smtp-Source: AGHT+IGoHaeAgi5JFEdLLNn6CY/RzmE08Et4tYif/MeWDaK3Gvl93i0NUmYjB0ao1FGu93s6NSWnKA== X-Received: by 2002:a05:6e02:2165:b0:352:609f:e4af with SMTP id s5-20020a056e02216500b00352609fe4afmr7255363ilv.24.1696547320314; Thu, 05 Oct 2023 16:08:40 -0700 (PDT) Received: from celestia.nettie.lan ([2001:470:42c4:101:9b88:f219:40c8:60fc]) by smtp.gmail.com with ESMTPSA id l17-20020a922811000000b003513b7613f3sm709974ilf.3.2023.10.05.16.08.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 16:08:39 -0700 (PDT) From: Sam Edwards X-Google-Original-From: Sam Edwards To: Heiko Schocher , Simon Glass Cc: Kyungmin Park , u-boot@lists.denx.de, Sam Edwards Subject: [RFC PATCH v2 0/4] mtd: ubi: Enable accessing RO filesystems in UBI vols Date: Thu, 5 Oct 2023 17:08:27 -0600 Message-ID: <20231005230831.4032070-1-CFSworks@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Hi list, This is the second version of my RFC patchset to treat static UBI volumes as DM block devices, allowing users to access read-only filesystems (SquashFS, EROFS) contained within such volumes. This is a rebased and updated version, as requested by Heiko. Previously, we have agreed on a syntax, which my downstream is now starting to use: => ls ubi 0:rootfs /boot => ls ubi 0:2 /boot This is still not yet ready for mainline inclusion, because the actual UBI DM access is happening in disk/part.c, which is not "clean" with the way the DM/legacy switching is currently plumbed. I'm still looking for guidance on how to name/implement block functions for looking up a *subvolume* block device by type+parentidx+{name,ID}. Changes v1->v2: - Rebased onto next post-2023.10's release. - Fix NULL dereference caused by passing NULL to `blk_create_device` - Parse UBI index/volume numbers with `dectoul` instead of `hextoul`, to match Linux's behavior of treating these numbers as decimal. - Do not treat a valid decimal number as a volume name, even if the volume ID doesn't exist, to match Linux's behavior of always treating decimal numbers as volume IDs. Cheers, Sam Sam Edwards (4): mtd: ubi: register UBI attachments as DM devices mtd: ubi: bind block device driver for static volumes disk: part: fall-through if "ubi" requested but ubifs not mounted HACK: enable access to `ubi 0:volname` block devices cmd/ubi.c | 11 +++ disk/part.c | 69 +++++++++++-- drivers/mtd/ubi/Makefile | 1 + drivers/mtd/ubi/ubi-uclass.c | 185 +++++++++++++++++++++++++++++++++++ include/dm/uclass-id.h | 1 + include/ubi_uboot.h | 5 + 6 files changed, 264 insertions(+), 8 deletions(-) create mode 100644 drivers/mtd/ubi/ubi-uclass.c