qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/2] ISCSI: Force scsi-generic for MMC with blan


From: Blue Swirl
Subject: Re: [Qemu-devel] [PATCH 2/2] ISCSI: Force scsi-generic for MMC with blank disks
Date: Sat, 18 Aug 2012 14:23:20 +0000

On Fri, Aug 17, 2012 at 2:36 AM, Ronnie Sahlberg
<address@hidden> wrote:
> There is no bdrv_* API for the commands for burning a blank MMC disk
> so when iSCSI LUNs are specified and the LUN is a MMC device with
> 0 available blocks. This is a blank disk so force scsi generic.
>
> This allows the guest to talk directly to the target to burn data on
> the disk.
>
> Signed-off-by: Ronnie Sahlberg <address@hidden>
> ---
>  block/iscsi.c |   13 +++++++++++--
>  1 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/block/iscsi.c b/block/iscsi.c
> index fb420ea..ca53afa 100644
> --- a/block/iscsi.c
> +++ b/block/iscsi.c
> @@ -1017,10 +1017,19 @@ static int iscsi_open(BlockDriverState *bs, const 
> char *filename, int flags)
>      /* Medium changer or tape. We dont have any emulation for this so this 
> must
>       * be sg ioctl compatible. We force it to be sg, otherwise qemu will try
>       * to read from the device to guess the image format.
> +     * MMC device with no blocks contain a blank disk so force them to use sg
> +     * too.
>       */
> -    if (iscsilun->type == TYPE_MEDIUM_CHANGER ||
> -        iscsilun->type == TYPE_TAPE) {
> +    switch (iscsilun->type) {
> +    case TYPE_ROM:
> +        if (iscsilun->num_blocks > 0) {
> +            break;
> +        }

Please don't fall through without a comment.

> +    case TYPE_MEDIUM_CHANGER:
> +    case TYPE_TAPE:
>          bs->sg = 1;

Also here, but I'd add 'break' instead.

> +    default:
> +        break;
>      }
>
>      ret = 0;
> --
> 1.7.3.1
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]