[libvirt] [PATCH] python: make virDomainSetSchedulerParameters accpet integer argument

Guannan Ren gren at redhat.com
Tue Mar 20 07:46:23 UTC 2012


On 03/20/2012 02:11 AM, Eric Blake wrote:
> On 03/19/2012 12:03 PM, Eric Blake wrote:
>
>> Why are you doing this for just VIR_TYPED_PARAM_ULLONG?  I argue that we
>> should be doing it for all of the integral conversions.
> In fact, I'd argue that we want new helper functions in typewrappers.c,
> as counterparts to our libvirt_intWrap() and friends.  Perhaps:
>
> /* Return 0 if obj could be unwrapped into the corresponding C type, -1
> with python exception set otherwise.  */
> int libvirt_intUnwrap(PyObject *obj, int *val);
> int libvirt_uintUnwrap(PyObject *obj, unsigned int *val);
> int libvirt_longlongUnwrap(PyObject *obj, long long *val);

        About these three wrappers, we have implemented them in our code,
        the work here we gonna do is just to factor them from the codes 
to create
        wrappers for easier use in future.

> int libvirt_ulonglongUnwrap(PyObject *obj, unsigned long long *val);

        This wrapper will include the fix in it.
>
> Then the code in question simplifies to:
>
> case VIR_TYPED_PARAM_ULLONG:
> {
>      unsigned long long ullong_val;
>      if (libvirt_ulonglongUnwrap(value,&ullong_val)<  0)
>          goto cleanup;
>      temp->value.ul = ullong_val;
>

      Okay, I will do it soon

      Guannan Ren




More information about the libvir-list mailing list