|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 07/19] libxl: provide libxl__xs_*_checked and libxl__xs_transaction_*
On Fri, 2012-06-08 at 18:34 +0100, Ian Jackson wrote:
> These useful utility functions make dealing with xenstore a little
> less painful.
>
> Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
(minor observation and a typo below)
[...]
> +/* On success, *result_out came from the gc.
> + * On error, *result_out is undefined.
> + * ENOENT counts as success but sets *result_out=0
> + */
> +int libxl__xs_read_checked(libxl__gc *gc, xs_transaction_t t,
> + const char *path, const char **result_out);
> +
> +/* Does not include a trailing null.
> + * May usefully be combined with GCSPRINTF if the format string
> + * behaviour of libxl__xs_write is desirable. */
> +int libxl__xs_write_checked(libxl__gc *gc, xs_transaction_t t,
> + const char *path, const char *string);
I suppose in the future we might consider merging this with
libxl__xs_write -- there's no reason not to always log a failed write,
is there?
> +
> +/* ENOENT is not an error (even if the parent directories don't exist) */
> +int libxl__xs_rm_checked(libxl__gc *gc, xs_transaction_t t, const char
> *path);
> +
> +/* Transaction functions, best used together.
> + * The caller should initialise *t to 0 (XBT_NULL) before calling start.
> + * Each function leaves *t!=0 iff the transaction needs cleaning up.
> + *
> + * libxl__xs_transaction_commit returns:
> + * <0 failure - a libxl error code
> + * +1 commit conflict; transaction has been destroyed and caller
> + * must go round again (call _start again and retry)
> + * 0 commited successfully
committed
> + */
> +int libxl__xs_transaction_start(libxl__gc *gc, xs_transaction_t *t);
> +int libxl__xs_transaction_commit(libxl__gc *gc, xs_transaction_t *t);
> +void libxl__xs_transaction_abort(libxl__gc *gc, xs_transaction_t *t);
> +
> +
> +
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |