public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/4] fs: Add command to retrieve the filesystem type
Date: Mon, 05 Jan 2015 13:18:25 -0700	[thread overview]
Message-ID: <54AAF191.1000002@wwwdotorg.org> (raw)
In-Reply-To: <1420478019-18877-2-git-send-email-sjoerd.simons@collabora.co.uk>

On 01/05/2015 10:13 AM, Sjoerd Simons wrote:
> New command to determine the filesystem type of a given partition.
> Optionally stores the filesystem type in a environment variable.

> diff --git a/common/cmd_fs.c b/common/cmd_fs.c

> +U_BOOT_CMD(
> +	fstype, 4, 1, do_fstype_wrapper,
> +	"Look up a filesystem type",
> +	"<interface> <dev>:<part>\n"

Should this line ...

> +	"- print filesystem type\n"
> +	"fstype <interface> <dev>:<part> <varname>\n"

... be consistent with this one - namely either both or neither include 
"fstype" at the start?

> diff --git a/fs/fs.c b/fs/fs.c

> +int do_fs_type(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> +{
> +	struct fstype_info *info;
> +
> +	if (argc < 3 || argc > 4)
> +		return CMD_RET_USAGE;
> +
> +	if (fs_set_blk_dev(argv[1], argv[2], FS_TYPE_ANY))
> +		return 1;
> +
> +	info = fs_get_info(fs_type);
> +
> +	if (argc == 4)
> +		setenv(argv[3], info->name);
> +	else
> +		printf("%s\n", info->name);
> +
> +	return CMD_RET_SUCCESS;
> +}

That function has both the cmdline interface and implementation logic in 
one place. Many of the other features (read, write, ls, ...) separate 
them out into two functions so that U-Boot code can call the 
implementation, and shell code can call the cmdline parsing wrapper. 
Should we do the same here? Admittedly, the implementation would be 
pretty simple, but perhaps it's still useful?

I don't feel that strongly though, and we can easily refactor that later 
if required.

  reply	other threads:[~2015-01-05 20:18 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-05 17:13 [U-Boot] [PATCH 0/4] Let the distro boot command scan all partitions Sjoerd Simons
2015-01-05 17:13 ` [U-Boot] [PATCH 1/4] fs: Add command to retrieve the filesystem type Sjoerd Simons
2015-01-05 20:18   ` Stephen Warren [this message]
2015-01-06 16:40     ` Sjoerd Simons
2015-01-06 17:05       ` Stephen Warren
2015-02-02 18:57   ` [U-Boot] [U-Boot, " Tom Rini
2015-01-05 17:13 ` [U-Boot] [PATCH 2/4] part: let list put the list in an environment variable Sjoerd Simons
2015-01-05 20:21   ` Stephen Warren
2015-02-02 18:57   ` [U-Boot] [U-Boot, " Tom Rini
2015-01-05 17:13 ` [U-Boot] [PATCH 3/4] config_distro_bootcmd: Scan all partitions for boot files Sjoerd Simons
2015-01-05 20:24   ` Stephen Warren
2015-01-06 17:07     ` Sjoerd Simons
2015-01-07  0:43       ` Stephen Warren
2015-01-07 10:10         ` Sjoerd Simons
2015-01-07 10:22           ` Ian Campbell
2015-01-07 11:01             ` Sjoerd Simons
2015-01-07 11:17               ` Ian Campbell
2015-01-07 11:46                 ` Sjoerd Simons
2015-01-07 12:47                   ` Ian Campbell
2015-01-10 18:34                   ` Dennis Gilmore
2015-01-07 20:22                 ` Stephen Warren
2015-01-08  9:24                   ` Sjoerd Simons
2015-01-07 20:19           ` Stephen Warren
2015-01-10 18:27         ` Dennis Gilmore
2015-01-12 17:42           ` Stephen Warren
2015-01-12 18:44             ` Dennis Gilmore
2015-01-13  8:40               ` Sjoerd Simons
2015-01-13 20:52                 ` Stephen Warren
2015-02-02 18:57   ` [U-Boot] [U-Boot, " Tom Rini
2015-01-05 17:13 ` [U-Boot] [PATCH 4/4] distro_distro_bootcmd: use CONFIG_BOOTCOMMAND instead of setting bootcmd= Sjoerd Simons
2015-01-05 20:31   ` Stephen Warren
2015-01-06 16:26     ` Sjoerd Simons
2015-02-02 18:57   ` [U-Boot] [U-Boot, " Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54AAF191.1000002@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox