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

Re: [Xen-devel] [PATCH v2 03/15] libxl: add libxl__xs_path_cleanup

Roger Pau Monne writes ("[PATCH v2 03/15] libxl: add libxl__xs_path_cleanup"):
> Add a function which behaves like "xenstore-rm -t", and which will be
> used to clean xenstore after unplug since we will be no longer
> executing xen-hotplug-cleanup script, that used to do that for us.
> Changes since v5:
>  * Abort if no transaction or user_path supplied.


Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

> diff --git a/tools/libxl/libxl_xshelp.c b/tools/libxl/libxl_xshelp.c
> index 6ca1afe..c5b5364 100644
> --- a/tools/libxl/libxl_xshelp.c
> +++ b/tools/libxl/libxl_xshelp.c
> @@ -135,6 +135,44 @@ char *libxl__xs_libxl_path(libxl__gc *gc, uint32_t domid)
>      return s;
>  }
> +int libxl__xs_path_cleanup(libxl__gc *gc, xs_transaction_t t, char 
> *user_path)
> +    /* A path and transaction must be provided by the caller */
> +    assert(user_path && t);

Personally I wouldn't bother asserting user_path here.

> +    path = libxl__strdup(gc, user_path);

After all this will tidily dereference null anyway.  In general we
don't bother asserting that function arguments we are going to
dereference are non-0, since the crash is debuggable either way.

But I don't particularly object, especially as you do need to assert
that t is non-0 as this function is not safe outside a transaction.


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.