: block: Small drive_init() improvements
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(-)
PATCH v2 1/2 block: drive_init(): Simplify interface type setting
Signed-off-by Luiz Capitulino <[email protected]>
--- blockdev.c | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-)
blockdev.c +4 -8
@@ -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
PATCH v2 2/2 block: drive_init(): Improve CHS setting error message
In reply to Luiz CapitulinoThe current message doesn't clearly communicate the error cause.
Signed-off-by Luiz Capitulino <[email protected]>
--- blockdev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
blockdev.c +1 -1
@@ -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
Quoted 10 lines · Luiz Capitulino
Please, see individual patches for details.
v1 -> v2:
---------o Drop indentation patch
o Use error message suggested by Markusblockdev.c | 14 +++++--------- 1 files changed, 5 insertions(+), 9 deletions(-)
Reviewed-by Markus Armbruster <[email protected]>
Kevin Wolf
AppliedAm 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 Markusblockdev.c | 14 +++++--------- 1 files changed, 5 insertions(+), 9 deletions(-)
Thanks, applied to the block branch.
Kevin