mount: Fix the printing of device name
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> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
21d6ca2092
commit
84b222987e
|
@ -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);
|
||||
}
|
||||
|
|
7
fs/fs.c
7
fs/fs.c
|
@ -743,6 +743,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);
|
||||
|
||||
|
@ -808,6 +809,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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue