From patchwork Sat Aug 12 00:06:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Edwards X-Patchwork-Id: 1820447 X-Patchwork-Delegate: dario.binacchi@amarulasolutions.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) 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=20221208 header.b=Ilzchboc; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RN1DX5Cy0z1yf2 for ; Sat, 12 Aug 2023 10:06:52 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5701886954; Sat, 12 Aug 2023 02:06:25 +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="Ilzchboc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AE73C86959; Sat, 12 Aug 2023 02:06:23 +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-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) (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 8D7CD86915 for ; Sat, 12 Aug 2023 02:06:21 +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-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6873a30d02eso1899192b3a.3 for ; Fri, 11 Aug 2023 17:06:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691798780; x=1692403580; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=v2zmJKnSfR4C/ixDOEZa5+Scmj0+LOzHh0gJlz+aL10=; b=IlzchbocLT/9rwMdIce0qHF/zSswpGzzxCdAv3S3UM3WNRJa3mVyitornO5hlNBYsv V8q5WADW+UJSZIG5mCSNdrvAAerurbpEML4BTrFv58DL0OdhG8PDUTjKlFtAoU1M9RaM HQJhuKJ5Vj5icKi++O5ZGC9GwykAyfOkiFOIVkjOX+5OKaza9qFi67kFkN33gK6Hrv0s CdE6/QOClARLcTpmK+4ryk4aJikF7vZ57WEElF1zn1qqaqvZG86YOCr2OVp5a4sJD0qZ f7qpCvAOz52V+y6PRr3LP7pEAEGfyP7BKBb3HgYeTliDcPlPfxMCcL1j8/37l1r/7czJ E4hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691798780; x=1692403580; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=v2zmJKnSfR4C/ixDOEZa5+Scmj0+LOzHh0gJlz+aL10=; b=E2Fs1JQjqOlVw+ms1mAAEZD1AuO/PyCAu36Qdggx1szvT9fJ8GNsnDvCgXu6qSdHua nx3DiOUAICHL4ngBn9YspnnK0Rk/rTqbYyNPNAF1gqJ73ultG+bJRp2wEeczizG5Dlmb ZGnH7BozyJhozZNETHOnb2JqRQnnlCwKUy0LwUeqUNjEscIY0x5yu9rh2PAM+pMRFyCz D/4q9USryh1gj1etL9HcWhkIgr853WSMsiPHqWN16EVSj4+vkW6Pk4Uj2VnlJUxf5+PS omoyqYodN3we3wR8CXDALupkAR7b7MCU8Nk4l9xn8IqeSglnRX2cwNw0s+HcxvHEe2V/ Jmug== X-Gm-Message-State: AOJu0Yy6elJ8nWceeSIZGuKZggGtyeBJqP9aMBrTI+EMpcXrtSwyp4Q4 uoKCGoJutHXZdtYA3nP2MSlreYJARGs= X-Google-Smtp-Source: AGHT+IEEQZdDFY4Mw4EWhlyZ/jIOG+Njvx/zk+g5JuL15CcXoiaCPZ9j+NQKdKeshKYZOqWWheN+jw== X-Received: by 2002:a05:6a20:9683:b0:137:a9d7:de12 with SMTP id hp3-20020a056a20968300b00137a9d7de12mr2697699pzc.59.1691798779836; Fri, 11 Aug 2023 17:06:19 -0700 (PDT) Received: from celestia.nettie.lan (static-198-54-134-172.cust.tzulo.com. [198.54.134.172]) by smtp.gmail.com with ESMTPSA id x16-20020a62fb10000000b00686bef8e55csm3848834pfm.39.2023.08.11.17.06.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Aug 2023 17:06:18 -0700 (PDT) From: Sam Edwards X-Google-Original-From: Sam Edwards To: Heiko Schocher , Kyungmin Park Cc: u-boot@lists.denx.de, Sam Edwards Subject: [RFC PATCH 3/4] disk: part: fall-through if "ubi" requested but ubifs not mounted Date: Fri, 11 Aug 2023 18:06:05 -0600 Message-ID: <20230812000606.72319-4-CFSworks@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230812000606.72319-1-CFSworks@gmail.com> References: <20230812000606.72319-1-CFSworks@gmail.com> 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 Since we're adding the ability to access static UBI volumes as block devices, it is no longer an error to use the "ubi" ifname with UBIFS unmounted. Ideally, the access to UBIFS should instead be called "ubifs" but it would break backwards compatibility to change this. Instead, use the UBIFS mount status to disambiguate what the user means by "ubi" There is no change in functionality in this patch: UBIFS access works the same and an error still occurs when using "ubi" without UBIFS mounted. The only difference is that now, the error message is a plain "Bad device specification" and does not suggest using ubifsmount. Signed-off-by: Sam Edwards --- disk/part.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/disk/part.c b/disk/part.c index 0a03b8213d..1ad8277b65 100644 --- a/disk/part.c +++ b/disk/part.c @@ -492,15 +492,13 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str, #if IS_ENABLED(CONFIG_CMD_UBIFS) && !IS_ENABLED(CONFIG_SPL_BUILD) /* - * Special-case ubi, ubi goes through a mtd, rather than through - * a regular block device. + * Special-case ubifs, which does not go through the block device layer + * and also must be mounted ahead of time. U-Boot has historically + * called this "ubi" too, even though *static* UBI volumes are + * accessible as block devices. For backward compatibility, assume that + * when UBIFS is mounted, the user intends "ubi" to mean "ubifs." */ - if (!strcmp(ifname, "ubi")) { - if (!ubifs_is_mounted()) { - printf("UBIFS not mounted, use ubifsmount to mount volume first!\n"); - return -EINVAL; - } - + if (ubifs_is_mounted() && !strcmp(ifname, "ubi")) { strcpy((char *)info->type, BOOT_PART_TYPE); strcpy((char *)info->name, "UBI"); return 0;