mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Depoire--Ferrer <greg.depoire@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Greg Depoire--Ferrer <greg.depoire@gmail.com>
Subject: [PATCH] init: add rootopts=%d for rootfs mount flags
Date: Wed, 30 Jun 2021 13:51:28 +0200	[thread overview]
Message-ID: <20210630115128.3878-2-greg.depoire@gmail.com> (raw)
In-Reply-To: <20210630115128.3878-1-greg.depoire@gmail.com>

Add the rootopts command line parameter to specify mount flags for the
root filesystem.

The kernel provides the rootflags parameter to specify filesystem
dependent options when mouting the root filesystem but did not provide
any way to set the filesystem independent flags.

This is not an issue on systems using an initrd because on these
systems, the rootflags parameter is passed to the /sbin/mount binary
which understands filesystem independent flags in the option string,
such as noatime (MS_NOATIME) or nodev (MS_NODEV).

Signed-off-by: Greg Depoire--Ferrer <greg.depoire@gmail.com>
---
 Documentation/admin-guide/kernel-parameters.txt |  2 ++
 init/do_mounts.c                                | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 26453f250683..01e1217583f5 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -4851,6 +4851,8 @@
 
 	rootfstype=	[KNL] Set root filesystem type
 
+	rootopts=	[KNL] Set root filesystem mount flags bitmap
+
 	rootwait	[KNL] Wait (indefinitely) for root device to show up.
 			Useful for devices that are detected asynchronously
 			(e.g. USB and MMC devices).
diff --git a/init/do_mounts.c b/init/do_mounts.c
index a78e44ee6adb..ebe51fc7cf86 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -326,6 +326,16 @@ static int __init root_data_setup(char *str)
 	return 1;
 }
 
+static int __init root_flags_setup(char *str)
+{
+	int flags;
+
+	if (kstrtoint(str, 0, &flags))
+		return 0;
+	root_mountflags |= flags;
+	return 1;
+}
+
 static char * __initdata root_fs_names;
 static int __init fs_names_setup(char *str)
 {
@@ -341,6 +351,7 @@ static int __init root_delay_setup(char *str)
 }
 
 __setup("rootflags=", root_data_setup);
+__setup("rootopts=", root_flags_setup);
 __setup("rootfstype=", fs_names_setup);
 __setup("rootdelay=", root_delay_setup);
 
-- 
2.31.1


  reply	other threads:[~2021-06-30 11:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-30 11:51 No way to set FS independent mount flags for rootfs Greg Depoire--Ferrer
2021-06-30 11:51 ` Greg Depoire--Ferrer [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-08-13 19:44 2.6.0-test3-mm1 and rootflags Valdis.Kletnieks
2021-06-29 17:20 ` [PATCH] init: add rootopts=%d for rootfs mount flags Greg Depoire--Ferrer

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=20210630115128.3878-2-greg.depoire@gmail.com \
    --to=greg.depoire@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®