Skip to contentSkip to conversation

: block: Small drive_init() improvements

PATCH Applied Luiz Capitulino 3 participants 5 messages Jul 1, 2011 – Jul 4, 2011

lore
Share & tools
lore
#0 lore raw

v2 cover : block: Small drive_init() improvements

Please, see individual patches for details.

v1 -> v2:
---------

o Drop indentation patch
o Use error message suggested by Markus

 blockdev.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)
#1 lore raw

PATCH v2 1/2 block: drive_init(): Simplify interface type setting

---
 blockdev.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)
blockdev.c +4 -8
index 7d579d6..470be71 100644
@@ -240,14 +240,6 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi)
     int ret;
 
     translation = BIOS_ATA_TRANSLATION_AUTO;
-
-    if (default_to_scsi) {
-        type = IF_SCSI;
-        pstrcpy(devname, sizeof(devname), "scsi");
-    } else {
-        type = IF_IDE;
-        pstrcpy(devname, sizeof(devname), "ide");
-    }
     media = MEDIA_DISK;
 
     /* extract parameters */
@@ -273,7 +265,11 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi)
             error_report("unsupported bus type '%s'", buf);
             return NULL;
 	}
+    } else {
+        type = default_to_scsi ? IF_SCSI : IF_IDE;
+        pstrcpy(devname, sizeof(devname), if_name[type]);
     }
+
     max_devs = if_max_devs[type];
 
     if (cyls || heads || secs) {
Signature · 1 line
1.7.6.49.g033c2
#2 lore raw

PATCH v2 2/2 block: drive_init(): Improve CHS setting error message

In reply to Luiz Capitulino

The current message doesn't clearly communicate the error cause.

---
 blockdev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
blockdev.c +1 -1
index 470be71..a97a801 100644
@@ -310,7 +310,7 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi)
 	    media = MEDIA_DISK;
 	} else if (!strcmp(buf, "cdrom")) {
             if (cyls || secs || heads) {
-                error_report("'%s' invalid physical CHS format", buf);
+                error_report("CHS can't be set with media=%s", buf);
 	        return NULL;
             }
 	    media = MEDIA_CDROM;
Signature · 1 line
1.7.6.49.g033c2
Applied
#4 lore raw
In reply to Luiz Capitulino

Am 01.07.2011 15:46, schrieb Luiz Capitulino:

Quoted 10 lines

Please, see individual patches for details.

v1 -> v2:
---------

o Drop indentation patch
o Use error message suggested by Markus

 blockdev.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)

Thanks, applied to the block branch.

Kevin