public inbox for linux-next@vger.kernel.org
 help / color / mirror / Atom feed
From: William Hubbs <w.d.hubbs@gmail.com>
To: linux-next@vger.kernel.org
Cc: mpagano@gentoo.org, William Hubbs <w.d.hubbs@gmail.com>
Subject: [PATCH] init: fix name of root device in /proc/mounts
Date: Tue,  5 Feb 2013 14:07:47 -0600	[thread overview]
Message-ID: <1360094867-28009-1-git-send-email-w.d.hubbs@gmail.com> (raw)

On a system that does not use an initramfs, /dev/root is always
listed in /proc/mounts. This breaks software which scans /proc/mounts to
determine which file systems are mounted since /dev/root is not a valid
device name.

This changes that processing so that "/dev/root" is only added to
/proc/mounts if a root device is not specified with the root= option on
the kernel command line.

Signed-off-by: William Hubbs <w.d.hubbs@gmail.com>
---
 init/do_mounts.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/init/do_mounts.c b/init/do_mounts.c
index 1d1b634..efc37d2 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -480,7 +480,10 @@ void __init change_floppy(char *fmt, ...)
 	va_start(args, fmt);
 	vsprintf(buf, fmt, args);
 	va_end(args);
-	fd = sys_open("/dev/root", O_RDWR | O_NDELAY, 0);
+	if (saved_root_name[0])
+		fd = sys_open(saved_root_name, O_RDWR | O_NDELAY, 0);
+	else
+		fd = sys_open("/dev/root", O_RDWR | O_NDELAY, 0);
 	if (fd >= 0) {
 		sys_ioctl(fd, FDEJECT, 0);
 		sys_close(fd);
@@ -523,8 +526,13 @@ void __init mount_root(void)
 	}
 #endif
 #ifdef CONFIG_BLOCK
-	create_dev("/dev/root", ROOT_DEV);
-	mount_block_root("/dev/root", root_mountflags);
+	if (saved_root_name[0]) {
+		create_dev(saved_root_name, ROOT_DEV);
+		mount_block_root(saved_root_name, root_mountflags);
+	} else {
+		create_dev("/dev/root", ROOT_DEV);
+		mount_block_root("/dev/root", root_mountflags);
+	}
 #endif
 }
 
-- 
1.7.12.4

             reply	other threads:[~2013-02-05 20:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-05 20:07 William Hubbs [this message]
2013-02-05 20:10 ` [PATCH] init: fix name of root device in /proc/mounts William Hubbs
2013-02-05 21:45   ` Stephen Rothwell
2013-02-05 23:36     ` William Hubbs

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=1360094867-28009-1-git-send-email-w.d.hubbs@gmail.com \
    --to=w.d.hubbs@gmail.com \
    --cc=linux-next@vger.kernel.org \
    --cc=mpagano@gentoo.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