From patchwork Mon Apr 25 05:31:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1621702 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=Hh+lm7Ay; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kmv3h0jmfz9s0r for ; Mon, 25 Apr 2022 15:40:00 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 66C9983BC7; Mon, 25 Apr 2022 07:39:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Hh+lm7Ay"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B5BC083E72; Mon, 25 Apr 2022 07:32:29 +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=0.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) (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 76C1383E4F for ; Mon, 25 Apr 2022 07:32:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ed1-x52f.google.com with SMTP id z19so3802619edx.9 for ; Sun, 24 Apr 2022 22:32:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=22/DWQkUS7g2O4wsdRbdfvJ27x14X+bn1L2xwlL9XPY=; b=Hh+lm7AyikFn4XPJXCIEagO50MoGSK3FfR2egrk/m3ttvIqra0uVv66rRmbr7w5ckt rsAMS4hnxL8dh967RrOEdWxfMvGWQR++QadOubHvdNvsWSui3GhOy3USnm2yR5dUyD4T +ABcx92ha9JltWnE3HTQnDjcGldvSXXIH4QJQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=22/DWQkUS7g2O4wsdRbdfvJ27x14X+bn1L2xwlL9XPY=; b=l8flK8s4XYzb86hrbtpoeJOP2l7PTrV7IOAz7mOml4eeKw9n8cqzeF2xpZjZJdy4l1 KcvpxpeocmLEEKk3lDPq92QxojfogwAA5wb2i4U1kdq1XCQRKWycZ9Sw/APi73uR4Fnk /kki/lbPaX79SwvSnZpoog1LPAAFEGrQCDg8HZfvu00micQ0XuGtu+qQWj8TVUHSWFmQ 0+kq9IrioMwsotSPCSLYE3YDf0lnC1NPTcr9PmwUk5T5zGE1RBzRs5mlTxx7rpbJ7NcR arj+xUCQTnWYPdsgMJCW+qiC35S7GOhHAYRX7qtjAEbMk/P6BxYRRg1XM0yvSG1plYCv DLrg== X-Gm-Message-State: AOAM5312tROaer2c4b7ayyUBfM1MMb16I16y4D2neKMdc24AJbTAGtDS M5WYnqXtYTdnnAtHO1C5stMyv/JOEWIipy57 X-Google-Smtp-Source: ABdhPJx7posBUSkN0wsCl8Z6ftMXDQAsJOWqnHcLOYBqhF7w+pqnS8Rbl65KNFusPJxhj88KqR5tXQ== X-Received: by 2002:a05:6402:350a:b0:423:e41e:75cb with SMTP id b10-20020a056402350a00b00423e41e75cbmr17317725edd.178.1650864736847; Sun, 24 Apr 2022 22:32:16 -0700 (PDT) Received: from sjg1.c.hospitality.swisscom.com (d54c768e3.static.telenet.be. [84.199.104.227]) by smtp.gmail.com with ESMTPSA id s12-20020a1709062ecc00b006e8558c9a5csm3230784eji.94.2022.04.24.22.32.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Apr 2022 22:32:16 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Dennis Gilmore , Lukas Auer , Daniel Schwierzeck , Tom Rini , Michal Simek , Ilias Apalodimas , Steffen Jaeckel , Simon Glass Subject: [PATCH v5 11/34] fs: Add a function to set the filesystem type Date: Sun, 24 Apr 2022 23:31:04 -0600 Message-Id: <20220425053127.19950-11-sjg@chromium.org> X-Mailer: git-send-email 2.36.0.rc2.479.g8af0fa9b8e-goog In-Reply-To: <20220425053127.19950-1-sjg@chromium.org> References: <20220425053127.19950-1-sjg@chromium.org> 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.5 at phobos.denx.de X-Virus-Status: Clean When sandbox is used with hostfs we won't have a block device, but still must set up the filesystem type before any filesystem operation, such as loading a file. Add a function to handle this. Signed-off-by: Simon Glass --- (no changes since v4) Changes in v4: - Add new patch with a function to set the filesystem type fs/fs.c | 5 +++++ include/fs.h | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/fs/fs.c b/fs/fs.c index b812597ced9..6de1a3eb6d5 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -36,6 +36,11 @@ static int fs_dev_part; static struct disk_partition fs_partition; static int fs_type = FS_TYPE_ANY; +void fs_set_type(int type) +{ + fs_type = type; +} + static inline int fs_probe_unsupported(struct blk_desc *fs_dev_desc, struct disk_partition *fs_partition) { diff --git a/include/fs.h b/include/fs.h index e2beba36b98..b43f16a692f 100644 --- a/include/fs.h +++ b/include/fs.h @@ -57,6 +57,17 @@ int do_ext2load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); */ int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype); +/** + * fs_set_type() - Tell fs layer which filesystem type is used + * + * This is needed when reading from a non-block device such as sandbox. It does + * a similar job to fs_set_blk_dev() but just sets the filesystem type instead + * of detecting it and loading it on the block device + * + * @type: Filesystem type to use (FS_TYPE...) + */ +void fs_set_type(int type); + /* * fs_set_blk_dev_with_part - Set current block device + partition *