Skip to contentSkip to conversation

block/raw: Add create_options for host_device

PATCH In review Kevin Wolf 2 participants 3 messages Oct 1, 2009 – Oct 2, 2009 Block layer

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 block/raw: Add create_options for host_device

Today host_devices have a create function, so they also need a create_options field to prevent qemu-img from complaining.

---
 block/raw-posix.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
block/raw-posix.c +10 -6
index f612340..20b37a7 100644
@@ -1005,13 +1005,14 @@ static int hdev_create(const char *filename, QEMUOptionParameter *options)
 }
 
 static BlockDriver bdrv_host_device = {
-    .format_name	= "host_device",
-    .instance_size	= sizeof(BDRVRawState),
-    .bdrv_probe_device	= hdev_probe_device,
-    .bdrv_open		= hdev_open,
-    .bdrv_close		= raw_close,
+    .format_name        = "host_device",
+    .instance_size      = sizeof(BDRVRawState),
+    .bdrv_probe_device  = hdev_probe_device,
+    .bdrv_open          = hdev_open,
+    .bdrv_close         = raw_close,
     .bdrv_create        = hdev_create,
-    .bdrv_flush		= raw_flush,
+    .create_options     = raw_create_options,
+    .bdrv_flush         = raw_flush,
 
     .bdrv_aio_readv	= raw_aio_readv,
     .bdrv_aio_writev	= raw_aio_writev,
@@ -1106,6 +1107,7 @@ static BlockDriver bdrv_host_floppy = {
     .bdrv_open          = floppy_open,
     .bdrv_close         = raw_close,
     .bdrv_create        = hdev_create,
+    .create_options     = raw_create_options,
     .bdrv_flush         = raw_flush,
 
     .bdrv_aio_readv     = raw_aio_readv,
@@ -1187,6 +1189,7 @@ static BlockDriver bdrv_host_cdrom = {
     .bdrv_open          = cdrom_open,
     .bdrv_close         = raw_close,
     .bdrv_create        = hdev_create,
+    .create_options     = raw_create_options,
     .bdrv_flush         = raw_flush,
 
     .bdrv_aio_readv     = raw_aio_readv,
@@ -1307,6 +1310,7 @@ static BlockDriver bdrv_host_cdrom = {
     .bdrv_open          = cdrom_open,
     .bdrv_close         = raw_close,
     .bdrv_create        = hdev_create,
+    .create_options     = raw_create_options,
     .bdrv_flush         = raw_flush,
 
     .bdrv_aio_readv     = raw_aio_readv,
Signature · 1 line
1.6.2.5
#1 lore raw
Quoted 2 lines · Kevin Wolf

Today host_devices have a create function, so they also need a create_options field to prevent qemu-img from complaining.

Yeah. But looking deeper does the size argument actually make any sense for the host devices? What we do right now is to seek to the total_size * 512 as some sort of tests, but it's not actually in any way encoded in the image, we'll always get the normal raw_getlength return value when quering for the size later.

author
#2 lore raw

Am 01.10.2009 19:13, schrieb Christoph Hellwig:

Quoted 9 lines · Kevin Wolf
Quoted 2 lines

Today host_devices have a create function, so they also need a create_options field to prevent qemu-img from complaining.

Yeah. But looking deeper does the size argument actually make any sense for the host devices? What we do right now is to seek to the total_size * 512 as some sort of tests, but it's not actually in any way encoded in the image, we'll always get the normal raw_getlength return value when quering for the size later.

Well, I do think that it makes sense to check if the device is at least not too small for the data that we are going to write (we could also check if it's an exact match, but I'm not sure if this is helpful). But other than this there is probably little use for it, yes.

What would you suggest? Drop the check completely and change qemu-img to deal with formats that don't support sizes?

Kevin