mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Fabian Pflug <f.pflug@pengutronix.de>, barebox@lists.infradead.org
Subject: Re: [PATCH v3 2/4] fs: split rootargs into root and options
Date: Fri, 28 Nov 2025 11:01:48 +0100	[thread overview]
Message-ID: <d0d39130-aa0e-4822-ac87-31fe96a1653e@pengutronix.de> (raw)
In-Reply-To: <20251127143052.3114915-3-f.pflug@pengutronix.de>

Hi,

On 11/27/25 3:25 PM, Fabian Pflug wrote:
> The rootargs argument (root=/dev/etc rootwait) can be split into the
> root and options parts, which makes it easier to manipulate them both
> independently. This changes tries to be as backward compatible as
> possible and does not change the behaviour of the get functions, but
> introduces new ones to get both items seperatly.
> 
> Signed-off-by: Fabian Pflug <f.pflug@pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

with below syntax error fixed. Pointed out some nitpicks while at it.

> ---
>  .../migration-guides/migration-master.rst     | 15 +++++
>  common/block.c                                | 44 ++++++++------
>  fs/9p/vfs_super.c                             |  6 +-
>  fs/fs.c                                       | 58 ++++++++++++++-----
>  fs/nfs.c                                      |  4 +-
>  fs/squashfs/squashfs.c                        | 13 +++--
>  fs/ubifs/ubifs.c                              | 12 ++--
>  include/block.h                               |  5 ++
>  include/bootargs.h                            |  2 +
>  include/fs.h                                  |  6 +-
>  10 files changed, 117 insertions(+), 48 deletions(-)
>  create mode 100644 Documentation/migration-guides/migration-master.rst
> 
> diff --git a/Documentation/migration-guides/migration-master.rst b/Documentation/migration-guides/migration-master.rst
> new file mode 100644
> index 0000000000..0d6cfcad57
> --- /dev/null
> +++ b/Documentation/migration-guides/migration-master.rst
> @@ -0,0 +1,15 @@
> +Filesystems
> +-----------
> +
> +{linux.bootargs} is replaced with "root={linux.bootargs.root} {linux.bootargs.rootopts}"
> +
> +The variable linux.bootargs has been replaced by the two variables
> +linux.bootargs.root and linux.bootargs.rootopts, splitting the previous bootargs
> +into three parts. A nonexistent fixed "root=", then the root filesystem and then
> +additional optional params for this particular filesystem.
> +
> +for example the previous
> +    linux.bootargs="root=/dev/nfs nfsroot=192.168.1.1:/rootfs"
> +becomes
> +    linux.bootargs.root="/dev/nfs"
> +    linux.bootargs.rootopts="nfsroot=192.168.1.1:/rootfs"

That will look odd rendered to HTML without extra ReST formatting.
For inline literal code (e.g., ``{linux.booargs}``) and for the code
blocks, use ::, e.g.:

for example the previous::

    linux.bootargs="root=/dev/nfs nfsroot=192.168.1.1:/rootfs"


> +char *cdev_get_linux_rootarg(const struct cdev *partcdev)
> +{
> +	int err;
> +	char* root = NULL;
> +	char* rootopts = NULL;

Asterisks next to identifier.

> +char *format_root_bootarg(const char *root_arg, char *root, char *rootopts) {

Newline before brace.

> -	str = dev_get_param(&fsdev->dev, "linux.bootargs");
> -	if (!str)
> -		return ERR_PTR(-ENOSYS);
> +	fsdev_get_linux_root_options(fsdev, &root, &rootopts);
>  
> -	return xstrdup(str);
> +	if (!root)
> +		return ERR_PTR(-EINVAL);

-ENOSYS would have been the better return type here, which is also what
we had before.

> -		str = cdev_get_linux_rootarg(fsdev->cdev);
> -		if (str)
> -			fsdev_set_linux_rootarg(fsdev, str);
> +		cdev_get_linux_root_and_opts(fsdev->cdev, &root, &rootopts);
> +		if (root) {
> +			fsdev_set_linux_root_options(fsdev, root, rootopts);
> +			free(root);
> +			if(rootopts)
> +				free(rootopts);

Coding style is spaces after if, but you can drop the check anyway, as
mentioned previously.

> +		}
>  	}

>  static int ubifs_probe(struct device *dev)
> diff --git a/include/block.h b/include/block.h
> index b277f590e4..ff18dcded0 100644
> --- a/include/block.h
> +++ b/include/block.h
> @@ -85,6 +85,7 @@ static inline int block_flush(struct block_device *blk)
>  #ifdef CONFIG_BLOCK
>  unsigned file_list_add_blockdevs(struct file_list *files);
>  char *cdev_get_linux_rootarg(const struct cdev *partcdev);
> +int cdev_get_linux_root_and_opts(const struct cdev *partcdev, char** root, char** rootopts);
>  #else
>  static inline unsigned file_list_add_blockdevs(struct file_list *files)
>  {
> @@ -94,6 +95,10 @@ static inline char *cdev_get_linux_rootarg(const struct cdev *partcdev)
>  {
>  	return NULL;
>  }
> +static inline void cdev_get_linux_root_and_opts(const struct cdev *partcdev, char** root, char** rootopts)
> +{
> +	return -ENOSYS;
> +}

Here's the actual issue: a void function can't return a value. Would
break in CI for platforms without CONFIG_BLOCK.

Cheers,
Ahmad

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




  reply	other threads:[~2025-11-28 10:02 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-24 10:16 [PATCH] common: setting the root= command line parameter Fabian Pflug
2025-11-24 12:00 ` Ahmad Fatoum
2025-11-25 10:22   ` Fabian Pflug
2025-11-25 19:13     ` Ahmad Fatoum
2025-11-26  6:42   ` [PATCH 0/4] make the root= command line parameter variable Fabian Pflug
2025-11-26  6:42     ` [PATCH 1/4] block.h: renamed get_rootargs to get_root Fabian Pflug
2025-11-26  9:50       ` Ahmad Fatoum
2025-11-26  6:42     ` [PATCH 2/4] fs: split rootargs into root and options Fabian Pflug
2025-11-26 10:13       ` Ahmad Fatoum
2025-11-26 10:31       ` Ahmad Fatoum
2025-11-26  6:42     ` [PATCH 3/4] bootm: use new api to get kernel command line params Fabian Pflug
2025-11-26 10:25       ` Ahmad Fatoum
2025-11-26 11:29         ` Fabian Pflug
2025-11-26 11:33           ` Ahmad Fatoum
2025-11-26  6:42     ` [PATCH 4/4] bootm: introduce bootm.root_arg variable Fabian Pflug
2025-11-26 10:28       ` Ahmad Fatoum
2025-11-27 10:57     ` [PATCH v2 0/4] make the root= command line parameter variable Fabian Pflug
2025-11-27 10:57       ` [PATCH v2 1/4] block.h: renamed get_rootargs to get_root Fabian Pflug
2025-11-27 11:08         ` Ahmad Fatoum
2025-11-27 10:57       ` [PATCH v2 2/4] fs: split rootargs into root and options Fabian Pflug
2025-11-27 10:57       ` [PATCH v2 3/4] bootm: use new api to get kernel command line params Fabian Pflug
2025-11-27 10:57       ` [PATCH v2 4/4] bootm: introduce bootm.root_arg variable Fabian Pflug
2025-11-27 14:25       ` [PATCH v3 0/4] make the root= command line parameter variable Fabian Pflug
2025-11-27 14:25         ` [PATCH v3 1/4] block.h: renamed get_rootargs to get_root Fabian Pflug
2025-11-28  9:45           ` Ahmad Fatoum
2025-11-27 14:25         ` [PATCH v3 2/4] fs: split rootargs into root and options Fabian Pflug
2025-11-28 10:01           ` Ahmad Fatoum [this message]
2025-11-27 14:25         ` [PATCH v3 3/4] bootm: use new api to get kernel command line params Fabian Pflug
2025-11-28 10:04           ` Ahmad Fatoum
2025-11-27 14:25         ` [PATCH v3 4/4] bootm: introduce bootm.root_arg variable Fabian Pflug
2025-11-28 10:07           ` Ahmad Fatoum
2025-11-28 14:58         ` [PATCH v4 0/4] make the root= command line parameter variable Fabian Pflug
2025-11-28 14:59           ` [PATCH v4 1/4] block.h: renamed get_rootargs to get_root Fabian Pflug
2025-11-28 14:59           ` [PATCH 2/4] fs: split rootargs into root and options Fabian Pflug
2025-11-28 14:59           ` [PATCH v4 3/4] bootm: use new api to get kernel command line params Fabian Pflug
2025-11-28 14:59           ` [PATCH v4 4/4] bootm: introduce bootm.root_arg variable Fabian Pflug
2025-12-01  7:20           ` [PATCH v5 0/4] make the root= command line parameter variable Fabian Pflug
2025-12-01  7:20             ` [PATCH v5 1/4] block.h: renamed get_rootargs to get_root Fabian Pflug
2025-12-01  7:20             ` [PATCH v5 2/4] fs: split rootargs into root and options Fabian Pflug
2025-12-01  7:20             ` [PATCH v5 3/4] bootm: use new api to get kernel command line params Fabian Pflug
2025-12-01  7:21             ` [PATCH v5 4/4] bootm: introduce bootm.root_param variable Fabian Pflug

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=d0d39130-aa0e-4822-ac87-31fe96a1653e@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=f.pflug@pengutronix.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