On (Fri) 03 Jun 2011 [16:03:57], Luiz Capitulino wrote:

> +static int tray_open(const char *device, int remove, int force)
> +{
> +    BlockDriverState *bs;
> +
> +    bs = bdrv_removable_find(device);
> +    if (!bs) {
> +        return -1;
> +    }
> +
> +    if (bdrv_eject(bs, 1, force) < 0) {
> +        /* FIXME: will report undefined error in QMP */
> +        return -1;
> +    }
> +
> +    if (remove) {
> +        bdrv_close(bs);
> +    }
> +
> +    return 0;
> +}

What's the reason to tie the 'remove' with tray open?  Won't it be
simpler to have it separated out, perhaps a 'change' event instead of
'insert' that can accept NULL which means just remove medium?

                Amit

Reply via email to