All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] disk: part: sandbox support in dev_print()
@ 2021-01-25 11:57 Heinrich Schuchardt
  2021-01-25 11:57 ` [PATCH 1/2] sandbox: fill block device meta information Heinrich Schuchardt
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Heinrich Schuchardt @ 2021-01-25 11:57 UTC (permalink / raw)
  To: u-boot

Without the series the fatinfo command shows an error for host file
backed block devices:

    => host bind 0 ../sandbox.img
    => fatinfo host 0:1
    Interface:  Unknown
      Device 0: Unhandled device type: 9
    Filesystem: FAT16 "NO NAME    "
    =>

With the series reasonable information is shown:

    => host bind 0 ../sandbox.img
    => fatinfo host 0:1
    Interface:  Unknown
      Device 0: Vendor: U-Boot Rev: 1.0 Prod: hostfile
                Type: Removable Hard Disk
                Capacity: 128.9 MB = 0.1 GB (264190 x 512)
    Filesystem: FAT16 "NO NAME    "
    =>

The "Interface:" line is created in file_fat_detectfs() and still needs to
be fixed.

Heinrich Schuchardt (2):
  sandbox: fill block device meta information
  disk: part: sandbox support in dev_print()

 disk/part.c             |  1 +
 drivers/block/sandbox.c | 11 +++++++++++
 2 files changed, 12 insertions(+)

--
2.29.2

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

* [PATCH 1/2] sandbox: fill block device meta information
  2021-01-25 11:57 [PATCH 0/2] disk: part: sandbox support in dev_print() Heinrich Schuchardt
@ 2021-01-25 11:57 ` Heinrich Schuchardt
  2021-01-25 11:57 ` [PATCH 2/2] disk: part: sandbox support in dev_print() Heinrich Schuchardt
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Heinrich Schuchardt @ 2021-01-25 11:57 UTC (permalink / raw)
  To: u-boot

Provide information about host backed block device.

Mark the device created by 'host bind' as removable.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 drivers/block/sandbox.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/block/sandbox.c b/drivers/block/sandbox.c
index 34c26cda47..f57f690d3c 100644
--- a/drivers/block/sandbox.c
+++ b/drivers/block/sandbox.c
@@ -92,6 +92,7 @@ int host_dev_bind(int devnum, char *filename)
 {
 	struct host_block_dev *host_dev;
 	struct udevice *dev;
+	struct blk_desc *desc;
 	char dev_name[20], *str, *fname;
 	int ret, fd;

@@ -143,6 +144,12 @@ int host_dev_bind(int devnum, char *filename)
 		goto err_file;
 	}

+	desc = blk_get_devnum_by_type(IF_TYPE_HOST, devnum);
+	desc->removable = 1;
+	snprintf(desc->vendor, BLK_VEN_SIZE, "U-Boot");
+	snprintf(desc->product, BLK_PRD_SIZE, "hostfile");
+	snprintf(desc->revision, BLK_REV_SIZE, "1.0");
+
 	return 0;
 err_file:
 	os_close(fd);
@@ -187,6 +194,10 @@ int host_dev_bind(int dev, char *filename)
 	blk_dev->block_write = host_block_write;
 	blk_dev->devnum = dev;
 	blk_dev->part_type = PART_TYPE_UNKNOWN;
+	blk_dev->removable = 1;
+	snprintf(blk_dev->vendor, BLK_VEN_SIZE, "U-Boot");
+	snprintf(blk_dev->product, BLK_PRD_SIZE, "hostfile");
+	snprintf(blk_dev->revision, BLK_REV_SIZE, "1.0");
 	part_init(blk_dev);

 	return 0;
--
2.29.2

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

* [PATCH 2/2] disk: part: sandbox support in dev_print()
  2021-01-25 11:57 [PATCH 0/2] disk: part: sandbox support in dev_print() Heinrich Schuchardt
  2021-01-25 11:57 ` [PATCH 1/2] sandbox: fill block device meta information Heinrich Schuchardt
@ 2021-01-25 11:57 ` Heinrich Schuchardt
  2021-01-30 21:26 ` Simon Glass
  2021-01-30 21:26 ` [PATCH 1/2] sandbox: fill block device meta information Simon Glass
  3 siblings, 0 replies; 5+ messages in thread
From: Heinrich Schuchardt @ 2021-01-25 11:57 UTC (permalink / raw)
  To: u-boot

Commands like 'fatinfo' call dev_print() to print device information. If
the block device is created via 'host bind', we should print accurate
information.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 disk/part.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/disk/part.c b/disk/part.c
index b69fd345f3..85b1af55e2 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -150,6 +150,7 @@ void dev_print (struct blk_desc *dev_desc)
 	case IF_TYPE_USB:
 	case IF_TYPE_NVME:
 	case IF_TYPE_PVBLOCK:
+	case IF_TYPE_HOST:
 		printf ("Vendor: %s Rev: %s Prod: %s\n",
 			dev_desc->vendor,
 			dev_desc->revision,
--
2.29.2

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

* [PATCH 2/2] disk: part: sandbox support in dev_print()
  2021-01-25 11:57 [PATCH 0/2] disk: part: sandbox support in dev_print() Heinrich Schuchardt
  2021-01-25 11:57 ` [PATCH 1/2] sandbox: fill block device meta information Heinrich Schuchardt
  2021-01-25 11:57 ` [PATCH 2/2] disk: part: sandbox support in dev_print() Heinrich Schuchardt
@ 2021-01-30 21:26 ` Simon Glass
  2021-01-30 21:26 ` [PATCH 1/2] sandbox: fill block device meta information Simon Glass
  3 siblings, 0 replies; 5+ messages in thread
From: Simon Glass @ 2021-01-30 21:26 UTC (permalink / raw)
  To: u-boot

Commands like 'fatinfo' call dev_print() to print device information. If
the block device is created via 'host bind', we should print accurate
information.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 disk/part.c | 1 +
 1 file changed, 1 insertion(+)

Applied to u-boot-dm, thanks!

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

* [PATCH 1/2] sandbox: fill block device meta information
  2021-01-25 11:57 [PATCH 0/2] disk: part: sandbox support in dev_print() Heinrich Schuchardt
                   ` (2 preceding siblings ...)
  2021-01-30 21:26 ` Simon Glass
@ 2021-01-30 21:26 ` Simon Glass
  3 siblings, 0 replies; 5+ messages in thread
From: Simon Glass @ 2021-01-30 21:26 UTC (permalink / raw)
  To: u-boot

Provide information about host backed block device.

Mark the device created by 'host bind' as removable.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 drivers/block/sandbox.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Applied to u-boot-dm, thanks!

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

end of thread, other threads:[~2021-01-30 21:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-25 11:57 [PATCH 0/2] disk: part: sandbox support in dev_print() Heinrich Schuchardt
2021-01-25 11:57 ` [PATCH 1/2] sandbox: fill block device meta information Heinrich Schuchardt
2021-01-25 11:57 ` [PATCH 2/2] disk: part: sandbox support in dev_print() Heinrich Schuchardt
2021-01-30 21:26 ` Simon Glass
2021-01-30 21:26 ` [PATCH 1/2] sandbox: fill block device meta information Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.