From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 81173C433EF for ; Sun, 6 Mar 2022 12:53:02 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DF37E83D0F; Sun, 6 Mar 2022 13:52:00 +0100 (CET) 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="cerKT1h3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 146EC83D03; Sun, 6 Mar 2022 13:51:35 +0100 (CET) Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) (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 71AFE83BD4 for ; Sun, 6 Mar 2022 13:51:10 +0100 (CET) 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-io1-xd2f.google.com with SMTP id c23so14359278ioi.4 for ; Sun, 06 Mar 2022 04:51:10 -0800 (PST) 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=H5g6YMoNY/MQ2sQckQ9gpvPfmd8KS0Lf9mJ90SjCDsk=; b=cerKT1h32oeNekuNLWa3Qh4GB0G1Vc14r2k8U1WFTGKPClCPaUXGgyNj9yUxBUqr7E qbTCpotIuj764GcT8g/pVcWlUcmsDkKSq7DQ3rT9KDeyWr6+2Y5TBtYQ0rbB/AnkRa8h GIaduARV2HrMwLbRM3/CfhW7fhYDO/h6hYgd0= 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=H5g6YMoNY/MQ2sQckQ9gpvPfmd8KS0Lf9mJ90SjCDsk=; b=ze4HN00ly5rgpyEHDzJQAJ6gl4HhOBJZ5azXpF+cwLNm0zWYL9Sd5crvdNa2tdOiur zP45Z9piv1FOjRYxGk51G16MRhL8awb3t91HGm3kr8YHLL2yMpR0BRcHN8mHxUknkzDx EWKUURPNvo/gLJYLKTicVQ7cbJI4S+c3T9BbY8LdMdQKoikln9g5fUARFCZmT8qTjhwk MSe9Xj9oi6BJM+lwjtr0ZNmCtdtPtWw3cSMBcIxgLixxvj3I6WSJ/ulqMlmVRyK7N62i Ya8IwedOrDsqjidkpJ2SMKWrkHf9pNlVizehDwNsPz03UzQS6N05KVivGya+Vmd169pp 9iWA== X-Gm-Message-State: AOAM531p90uHhJEqG2mXZ/zYto92Iv93nhpgyjt+sYiZNZuNW0l/fc81 pnvfOWlsinzRDtsPHDHvJBUhgxq8IN3f5A== X-Google-Smtp-Source: ABdhPJxsdCj4uZoyrEE8RA5JzzEh4p5pMzGLrcGFqxEmjETVfjo3Wni1EzBkWbgnWi4PM1FOKchpvw== X-Received: by 2002:a05:6602:2817:b0:640:d4f5:12b9 with SMTP id d23-20020a056602281700b00640d4f512b9mr6544556ioe.35.1646571069040; Sun, 06 Mar 2022 04:51:09 -0800 (PST) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id p22-20020a5d8d16000000b006115627b87csm7653533ioj.55.2022.03.06.04.51.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Mar 2022 04:51:08 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Dennis Gilmore , Ilias Apalodimas , Lukas Auer , Tom Rini , Heinrich Schuchardt , Michal Simek , Daniel Schwierzeck , Steffen Jaeckel , Simon Glass Subject: [PATCH v4 11/33] fs: Add a function to set the filesystem type Date: Sun, 6 Mar 2022 05:49:54 -0700 Message-Id: <20220306125016.3133737-11-sjg@chromium.org> X-Mailer: git-send-email 2.35.1.616.g0bdcbb4464-goog In-Reply-To: <20220306125016.3133737-1-sjg@chromium.org> References: <20220306125016.3133737-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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 023f89cafe..611abd083c 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -34,6 +34,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 c8df3886ac..27b10134a5 100644 --- a/include/fs.h +++ b/include/fs.h @@ -55,6 +55,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 * -- 2.35.1.616.g0bdcbb4464-goog