[libvirt] [PATCH v2 3/5] storage: Handle readflags errors

Ján Tomko jtomko at redhat.com
Fri Dec 4 13:46:27 UTC 2015


On Tue, Nov 24, 2015 at 03:57:14PM -0500, John Ferlan wrote:
> Similar to the openflags VIR_STORAGE_VOL_OPEN_NOERROR processing, if some
> read processing operation fails, check the readflags for the corresponding
> error flag being set. If so, rather then causing an error - use VIR_WARN
> to flag the error, but return -2 which some callers can use to perform
> specific actions.
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/storage/storage_backend.c | 107 +++++++++++++++++++++++++++++++-----------
>  src/storage/storage_backend.h |  11 +++++
>  2 files changed, 90 insertions(+), 28 deletions(-)
> 
> diff --git a/src/storage/storage_backend.h b/src/storage/storage_backend.h
> index aa9008e..e3ff306 100644
> --- a/src/storage/storage_backend.h
> +++ b/src/storage/storage_backend.h
> @@ -179,6 +179,17 @@ enum {
>      VIR_STORAGE_VOL_OPEN_DIR     = 1 << 4, /* directories okay */
>  };
>  
> +/* VolReadErrorMode flags
> + * If flag is present, then operation won't cause fatal error for
> + * specified operation, rather a VIR_WARN will be issued and a -2 returned
> + * for function call
> + */
> +enum {
> +    VIR_STORAGE_VOL_SEEK_ERROR    = 1 << 0, /* don't error on (l)seek */

> +    VIR_STORAGE_VOL_READ_ERROR    = 1 << 1, /* don't error on *read */

This is the only flag used in this series.

Also, naming it VIR_STORAGE_VOL_READ_NOERROR or VIR_STORAGE_VOL_READ_IGNORE_ERROR
would make its meaning more obvious.

ACK with the unused flags dropped.

Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20151204/6eac9383/attachment-0001.sig>


More information about the libvir-list mailing list