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

Re: [Libguestfs] [PATCH libguestfs 02/23] * daemon/daemon.h (RESOLVE_DEVICE): Rename from IS_DEVICE.



On Wed, Aug 12, 2009 at 06:52:38PM +0200, Jim Meyering wrote:
> From: Jim Meyering <meyering redhat com>
> 
> Change parameter from "errcode" (which would be returned) to "fail_stmt"
> so that a caller can specify e.g., "goto done" upon failure.
> ---
>  daemon/daemon.h |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/daemon/daemon.h b/daemon/daemon.h
> index a6bbb73..166f3bf 100644
> --- a/daemon/daemon.h
> +++ b/daemon/daemon.h
> @@ -151,14 +151,14 @@ extern void reply (xdrproc_t xdrp, char *ret);
>   *
>   * NB. Cannot be used for FileIn functions.
>   */
> -#define IS_DEVICE(path,errcode)						\
> +#define RESOLVE_DEVICE(path,fail_stmt)					\
>    do {									\
>      if (strncmp ((path), "/dev/", 5) != 0) {				\
>        reply_with_error ("%s: %s: expecting a device name", __func__, (path)); \
> -      return (errcode);							\
> +      fail_stmt;							\
>      }									\
>      if (device_name_translation ((path), __func__) == -1)		\
> -      return (errcode);							\
> +      fail_stmt;							\
>    } while (0)
> 
>  /* Helper for functions which need either an absolute path in the
> -- 
> 1.6.4.337.g5420e

ACK.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://et.redhat.com/~rjones/libguestfs/
See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html


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