xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Chun Yan Liu <cyliu@suse.com>, xen-devel@lists.xen.org
Cc: George.Dunlap@eu.citrix.com, ian.jackson@eu.citrix.com,
	wei.liu2@citrix.com, stefano.stabellini@eu.citrix.com
Subject: Re: [PATCH v3 2/5] libxl: add new pvusb backend "qusb" provided by qemu
Date: Fri, 25 Mar 2016 07:29:50 +0100	[thread overview]
Message-ID: <56F4DADE.4040200@suse.com> (raw)
In-Reply-To: <56F5119C02000066000C0F24@suse.com>

On 25/03/16 03:23, Chun Yan Liu wrote:
> 
> 
>>>> On 3/23/2016 at 08:24 PM, in message
> <1458735847-9448-3-git-send-email-jgross@suse.com>, Juergen Gross
> <jgross@suse.com> wrote: 
>> Add a new pvusb backend type "qusb" which is provided by qemu. It can 
>> be selected either by specifying the type directly in the configuration 
>> or it is selected automatically by libxl in case there is no "usbback" 
>> driver loaded. 
>>  
>> Signed-off-by: Juergen Gross <jgross@suse.com> 
>> --- 
>>  docs/man/xl.cfg.pod.5                |  11 +++- 
>>  tools/libxl/libxl_device.c           |   3 +- 
>>  tools/libxl/libxl_dm.c               |   8 +++ 
>>  tools/libxl/libxl_internal.h         |   1 + 
>>  tools/libxl/libxl_pvusb.c            | 102 +++++++++++++++++++++++++++-------- 
>>  tools/libxl/libxl_types.idl          |   1 + 
>>  tools/libxl/libxl_types_internal.idl |   1 + 
>>  7 files changed, 101 insertions(+), 26 deletions(-) 
>>  
>> diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h 
>> index fc7bdab..2db8b1b 100644 
>> --- a/tools/libxl/libxl_internal.h 
>> +++ b/tools/libxl/libxl_internal.h 
>> @@ -22,6 +22,21 @@ 
>>   
>>  #define USBHUB_CLASS_CODE 9 
>>   
>> +static int usbback_is_loaded(libxl__gc *gc) 
>> +{ 
>> +    int r; 
>> +    struct stat st; 
>> + 
>> +    r = lstat(SYSFS_USBBACK_DRIVER, &st); 
>> + 
>> +    if (r == 0) 
>> +        return 1; 
>> +    if (r < 0 && errno == ENOENT) 
>> +        return 0; 
>> +    LOGE(ERROR, "Accessing %s", SYSFS_USBBACK_DRIVER); 
>> +    return -1; 
>> +} 
>> + 
>>  static int libxl__device_usbctrl_setdefault(libxl__gc *gc, uint32_t domid, 
>>                                              libxl_device_usbctrl *usbctrl) 
>>  { 
>> @@ -36,7 +51,8 @@ static int libxl__device_usbctrl_setdefault(libxl__gc *gc,  
>> uint32_t domid, 
>>   
>>      if (usbctrl->type == LIBXL_USBCTRL_TYPE_AUTO) { 
>>          if (domtype == LIBXL_DOMAIN_TYPE_PV) { 
>> -            usbctrl->type = LIBXL_USBCTRL_TYPE_PV; 
>> +            usbctrl->type = usbback_is_loaded(gc) ? LIBXL_USBCTRL_TYPE_PV 
> The condition should be (usbback_is_loaded(gc) > 0)?
> usbback_is_loaded(gc) < 0 means lstat error, cannot determine if the
> usbback driver is loaded.

Good point. I think in error case I should rather abort the operation.

Thoughts?


Juergen

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-03-25  6:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-23 12:24 [PATCH v3 0/5] libxl: add support for qemu base pvusb backend Juergen Gross
2016-03-23 12:24 ` [PATCH v3 1/5] libxl: make libxl__need_xenpv_qemu() operate on domain config Juergen Gross
2016-03-24 20:28   ` Wei Liu
2016-03-25  6:13     ` Juergen Gross
2016-03-23 12:24 ` [PATCH v3 2/5] libxl: add new pvusb backend "qusb" provided by qemu Juergen Gross
2016-03-25  2:23   ` Chun Yan Liu
     [not found]   ` <56F5119C02000066000C0F24@suse.com>
2016-03-25  6:29     ` Juergen Gross [this message]
2016-03-25  6:38       ` Chun Yan Liu
2016-03-23 12:24 ` [PATCH v3 3/5] libxl: add service function to check whether device model is running Juergen Gross
2016-03-24 20:28   ` Wei Liu
2016-03-23 12:24 ` [PATCH v3 4/5] libxl: check for dynamic device model start required Juergen Gross
2016-03-25  2:06   ` Chun Yan Liu
     [not found]   ` <56F50DC102000066000C0EF4@suse.com>
2016-03-25  6:25     ` Juergen Gross
2016-03-25  6:29       ` Chun Yan Liu
2016-03-23 12:24 ` [PATCH v3 5/5] libxl: add domain config parameter to force start of qemu Juergen Gross
2016-03-24 20:28   ` Wei Liu
2016-03-24 20:35     ` Wei Liu
2016-03-25  6:20       ` Juergen Gross
2016-03-25  6:16     ` Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56F4DADE.4040200@suse.com \
    --to=jgross@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=cyliu@suse.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).