mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* Try to fix mount display of a disk
@ 2011-11-09 11:29 franck.jullien
  2011-11-09 11:29 ` [PATCH 1/2] ata: Add dev ref to blockdevice during probe franck.jullien
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: franck.jullien @ 2011-11-09 11:29 UTC (permalink / raw)
  To: barebox

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

This is the second try for fixing the display of the mount command.
I'm doing some test with a sd card over spi (path to come).
This is what I get:

barebox@generic:/ devinfo
devices:
`---- altera_serial0
     `---- cs0
`---- ramfs0
`---- devfs0
`---- mem0
     `---- 0x00000000-0x00001c8c: /dev/defaultenv
`---- mem1
     `---- 0x00000000-0xfffffffe: /dev/mem
`---- mem2
     `---- 0x00000000-0x007fffff: /dev/ram0
`---- altera_spi0
     `---- m25p0
`---- altera_spi1
     `---- spi_mci0
`---- mci0
     `---- disk0
          `---- 0x00000000-0x00e37fff: /dev/disk0
          `---- 0x00007200-0x00e37fff: /dev/disk0.0
          `---- fat0

barebox@generic:/ mount
none on / type ramfs
none on /dev type devfs
disk0 on /mnt type fat

Seems good to me....

Franck Jullien (2):
  ata: Add dev ref to blockdevice during probe
  [RFC v2] mount: Fix the printing of device name

 commands/mount.c         |    2 +-
 drivers/ata/disk_drive.c |    1 +
 fs/fs.c                  |    7 +++++++
 3 files changed, 9 insertions(+), 1 deletions(-)

-- 
1.7.7


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] ata: Add dev ref to blockdevice during probe
  2011-11-09 11:29 Try to fix mount display of a disk franck.jullien
@ 2011-11-09 11:29 ` franck.jullien
  2011-11-09 11:29 ` [PATCH 2/2] [RFC v2] mount: Fix the printing of device name franck.jullien
  2011-11-11 11:15 ` Try to fix mount display of a disk Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: franck.jullien @ 2011-11-09 11:29 UTC (permalink / raw)
  To: barebox

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

Add missing reference to dev when register the blockdevice.
This prevent the creation of a cdev with a NULL reference to dev in
blockdevice_register.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
---
 drivers/ata/disk_drive.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/ata/disk_drive.c b/drivers/ata/disk_drive.c
index 6a5dc87..a9d0dee 100644
--- a/drivers/ata/disk_drive.c
+++ b/drivers/ata/disk_drive.c
@@ -205,6 +205,7 @@ static int disk_probe(struct device_d *dev)
 	atablk->blk.num_blocks = dev->resource[0].size / SECTOR_SIZE;
 	atablk->blk.ops = &ataops;
 	atablk->blk.blockbits = 9;
+	atablk->blk.dev = dev;
 	atablk->dev = dev;
 	atablk->intf = intf;
 	blockdevice_register(&atablk->blk);
-- 
1.7.7


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] [RFC v2] mount: Fix the printing of device name
  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
  2011-11-11 11:15 ` Try to fix mount display of a disk Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: franck.jullien @ 2011-11-09 11:29 UTC (permalink / raw)
  To: barebox

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Try to fix mount display of a disk
  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 ` [PATCH 2/2] [RFC v2] mount: Fix the printing of device name franck.jullien
@ 2011-11-11 11:15 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2011-11-11 11:15 UTC (permalink / raw)
  To: franck.jullien; +Cc: barebox

On Wed, Nov 09, 2011 at 12:29:19PM +0100, franck.jullien@gmail.com wrote:
> From: Franck Jullien <franck.jullien@gmail.com>
> 
> This is the second try for fixing the display of the mount command.
> I'm doing some test with a sd card over spi (path to come).
> This is what I get:
> 
> barebox@generic:/ devinfo
> devices:
> `---- altera_serial0
>      `---- cs0
> `---- ramfs0
> `---- devfs0
> `---- mem0
>      `---- 0x00000000-0x00001c8c: /dev/defaultenv
> `---- mem1
>      `---- 0x00000000-0xfffffffe: /dev/mem
> `---- mem2
>      `---- 0x00000000-0x007fffff: /dev/ram0
> `---- altera_spi0
>      `---- m25p0
> `---- altera_spi1
>      `---- spi_mci0
> `---- mci0
>      `---- disk0
>           `---- 0x00000000-0x00e37fff: /dev/disk0
>           `---- 0x00007200-0x00e37fff: /dev/disk0.0
>           `---- fat0
> 
> barebox@generic:/ mount
> none on / type ramfs
> none on /dev type devfs
> disk0 on /mnt type fat
> 
> Seems good to me....
> 
> Franck Jullien (2):
>   ata: Add dev ref to blockdevice during probe
>   [RFC v2] mount: Fix the printing of device name
> 
>  commands/mount.c         |    2 +-
>  drivers/ata/disk_drive.c |    1 +
>  fs/fs.c                  |    7 +++++++
>  3 files changed, 9 insertions(+), 1 deletions(-)

Looks good, applied.

Thanks
 Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-11-11 11:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 2/2] [RFC v2] mount: Fix the printing of device name franck.jullien
2011-11-11 11:15 ` Try to fix mount display of a disk Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox