mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: franck.jullien@gmail.com
To: barebox@lists.infradead.org
Subject: [PATCH 2/2] [RFC v2] mount: Fix the printing of device name
Date: Wed,  9 Nov 2011 12:29:21 +0100	[thread overview]
Message-ID: <1320838161-29653-3-git-send-email-franck.jullien@gmail.com> (raw)
In-Reply-To: <1320838161-29653-1-git-send-email-franck.jullien@gmail.com>

From: Franck Jullien <franck.jullien@gmail.com>

Mount without argument always print a "none" as device name mounted
because entry->parent_device is always NULL.

The problem is the mount function in fs/fs.c. parent_device is
initialized to NULL and never updated. With this patch,
parent_device is set with the mounted device name.

Moreover, the mount function has been modified to print the device
name plus device id using the dev_name function.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
---
 commands/mount.c |    2 +-
 fs/fs.c          |    7 +++++++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/commands/mount.c b/commands/mount.c
index 52d1700..7cefdbe 100644
--- a/commands/mount.c
+++ b/commands/mount.c
@@ -40,7 +40,7 @@ static int do_mount(struct command *cmdtp, int argc, char *argv[])
 			entry = mtab_next_entry(entry);
 			if (entry) {
 				printf("%s on %s type %s\n",
-					entry->parent_device ? entry->parent_device->name : "none",
+					entry->parent_device ? dev_name(entry->parent_device) : "none",
 					entry->path,
 					entry->dev->name);
 			}
diff --git a/fs/fs.c b/fs/fs.c
index 51a7411..c70b691 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -739,6 +739,7 @@ int mount(const char *device, const char *fsname, const char *_path)
 	struct mtab_entry *entry;
 	struct fs_device_d *fsdev;
 	struct device_d *dev, *parent_device = NULL;
+	struct cdev *cdev = NULL;
 	int ret;
 	char *path = normalise_path(_path);
 
@@ -804,6 +805,12 @@ int mount(const char *device, const char *fsname, const char *_path)
 		goto out2;
 	}
 
+	if (!strncmp(device, "/dev/", 5)) {
+		cdev = cdev_by_name(device + 5);
+		if(cdev)
+			parent_device = cdev->dev;
+	}
+
 	if (parent_device)
 		dev_add_child(parent_device, &fsdev->dev);
 
-- 
1.7.7


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2011-11-09 11:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-09 11:29 Try to fix mount display of a disk franck.jullien
2011-11-09 11:29 ` [PATCH 1/2] ata: Add dev ref to blockdevice during probe franck.jullien
2011-11-09 11:29 ` franck.jullien [this message]
2011-11-11 11:15 ` Try to fix mount display of a disk Sascha Hauer

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=1320838161-29653-3-git-send-email-franck.jullien@gmail.com \
    --to=franck.jullien@gmail.com \
    --cc=barebox@lists.infradead.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