WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Re: [PATCH] libxl: initialize domid to 0 in libxl__creat

Stefano Stabellini writes ("Re: [Xen-devel] Re: [PATCH] libxl: initialize domid 
to 0 in libxl__create_stubdom"):
> I understand what you mean, but in that case I would rather have the
> check right before allocate:
> 
> assert(!libxl_domid_valid_guest(*domid));
> something = allocate();
>
> in the outer function.

What?  Are you proposing this:

    char *something = NULL;
    uint32_t domid = -1;
 
    ...
    assert(!libxl_domid_valid_guest(*domid));
    assert(!something);
    ...

    something = allocate();
    if (!something) goto error_exit;
    ...
    ret = libxl__domain_make(&domid);
    if (ret) goto error_exit;
    ...
 
    return successfully somehow;
 
   error_exit:
    free(something);
    if (libxl_domid_valid_guest(domid))
        libxl_domain_destroy(domid);

What would be the point of that ?

> Because libxl__domain_make doesn't have any business in checking for the
> validity of an output parameter, it is a layering violation.

I'm proposing that this should be an update parameter.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel