Il 27/09/2012 15:41, Kevin Wolf ha scritto:
>> > +BlockErrorAction block_job_error_action(BlockJob *job, BlockDriverState
>> > *bs,
>> > + BlockdevOnError on_err,
>> > + int is_read, int error)
>> > +{
>> > + BlockErrorAction action;
>> > +
>> > + switch (on_err) {
>> > + case BLOCKDEV_ON_ERROR_ENOSPC:
>> > + action = (error == ENOSPC) ? BDRV_ACTION_STOP :
>> > BDRV_ACTION_REPORT;
>> > + break;
>> > + case BLOCKDEV_ON_ERROR_STOP:
>> > + action = BDRV_ACTION_STOP;
>> > + break;
>> > + case BLOCKDEV_ON_ERROR_REPORT:
>> > + action = BDRV_ACTION_REPORT;
>> > + break;
>> > + case BLOCKDEV_ON_ERROR_IGNORE:
>> > + action = BDRV_ACTION_IGNORE;
>> > + break;
>> > + default:
>> > + abort();
>> > + }
> Isn't this a duplication of bdrv_get_error_action()?
bdrv_get_error_action() has this:
BlockdevOnError on_err = is_read ? bs->on_read_error : bs->on_write_error;
It can use some refactoring to commonize the switch statement, but
it's not a direct replacement.
Paolo