xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Chunyan Liu <cyliu@suse.com>, xen-devel@lists.xen.org
Cc: wei.liu2@citrix.com, ian.campbell@citrix.com,
	george.dunlap@eu.citrix.com, Ian.Jackson@eu.citrix.com,
	jfehlig@suse.com, Simon Cao <caobosimon@gmail.com>
Subject: Re: [PATCH V8 3/7] libxl: add pvusb API
Date: Tue, 27 Oct 2015 12:31:03 +0100	[thread overview]
Message-ID: <562F6077.7000209@suse.com> (raw)
In-Reply-To: <1445418510-19614-4-git-send-email-cyliu@suse.com>

On 10/21/2015 11:08 AM, Chunyan Liu wrote:
> Add pvusb APIs, including:
>   - attach/detach (create/destroy) virtual usb controller.
>   - attach/detach usb device
>   - list usb controller and usb devices
>   - some other helper functions
>
> Signed-off-by: Chunyan Liu <cyliu@suse.com>
> Signed-off-by: Simon Cao <caobosimon@gmail.com>
>
> ---
> changes:
>    - update COMPARE_USB to compare ctrl and port
>    - add check in usb_add/remove to disable non-Dom0 backend so that
>      not worring about codes which are effective on Dom0 but not
>      compatible on non-Dom0 backend.
>    - define READ_SUBPATH macro within functions
>    - do not initialize rc but give it value in each return case
>    - libxl__strdup gc or NOGC update, internal function using gc,
>      external using NOGC.
>    - address other comments from George and Ian J.
>
>   tools/libxl/Makefile                 |    2 +-
>   tools/libxl/libxl.c                  |   53 ++
>   tools/libxl/libxl.h                  |   74 ++
>   tools/libxl/libxl_device.c           |    5 +-
>   tools/libxl/libxl_internal.h         |   18 +
>   tools/libxl/libxl_osdeps.h           |   13 +
>   tools/libxl/libxl_pvusb.c            | 1451 ++++++++++++++++++++++++++++++++++
>   tools/libxl/libxl_types.idl          |   57 ++
>   tools/libxl/libxl_types_internal.idl |    1 +
>   tools/libxl/libxl_utils.c            |   16 +
>   tools/libxl/libxl_utils.h            |    5 +
>   11 files changed, 1693 insertions(+), 2 deletions(-)
>   create mode 100644 tools/libxl/libxl_pvusb.c

...

> diff --git a/tools/libxl/libxl_pvusb.c b/tools/libxl/libxl_pvusb.c
> new file mode 100644
> index 0000000..aa1a653
> --- /dev/null
> +++ b/tools/libxl/libxl_pvusb.c
> @@ -0,0 +1,1451 @@
> +/*
> + * Copyright (C) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.

Hmm, shouldn't this be just "SUSE LINUX GmbH, ..."?

> + * Author Chunyan Liu <cyliu@suse.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU Lesser General Public License as published
> + * by the Free Software Foundation; version 2.1 only. with the special
> + * exception on linking described in file LICENSE.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU Lesser General Public License for more details.
> + */

...

> +/* Encode usb interface so that it could be written to xenstore as a key.
> + *
> + * Since xenstore key cannot include '.' or ':', we'll change '.' to '_',
> + * change ':' to '-'. For example, 3-1:2.1 will be encoded to 3-1-2_1.
> + * This will be used to save original driver of USB device to xenstore.
> + */
> +static char *usb_interface_xenstore_encode(char *busid)
> +{
> +    char *str = strdup(busid);
> +    int i, len = strlen(str);
> +
> +    for (i = 0; i < len; i++) {
> +        if (str[i] == '.')
> +            str[i] = '_';
> +         if (str[i] == ':')

Indentation.

> +            str[i] = '-';
> +    }
> +    return str;
> +}

...

> diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
> index 9c5c4d0..706a0c1 100644
> --- a/tools/libxl/libxl_utils.c
> +++ b/tools/libxl/libxl_utils.c
> @@ -1270,6 +1270,22 @@ int libxl__random_bytes(libxl__gc *gc, uint8_t *buf, size_t len)
>       return ret;
>   }
>
> +void libxl_device_usbctrl_list_free(libxl_device_usbctrl *list, int nr)
> +{
> +   int i;

Blank line.

> +   for (i = 0; i < nr; i++)
> +       libxl_device_usbctrl_dispose(&list[i]);
> +   free(list);
> +}
> +
> +void libxl_device_usb_list_free(libxl_device_usb *list, int nr)
> +{
> +   int i;

Blank line.

> +   for (i = 0; i < nr; i++)
> +       libxl_device_usb_dispose(&list[i]);
> +   free(list);
> +}


Juergen

  reply	other threads:[~2015-10-27 11:31 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-21  9:08 [PATCH V8 0/7] xen pvusb toolstack work Chunyan Liu
2015-10-21  9:08 ` [PATCH V8 1/7] libxl: export some functions for pvusb use Chunyan Liu
2015-10-27 11:08   ` Juergen Gross
2015-10-21  9:08 ` [PATCH V8 2/7] libxl_read_file_contents: add new entry to read sysfs file Chunyan Liu
2015-10-27 11:31   ` Juergen Gross
2015-11-16 14:03   ` Ian Campbell
2015-11-16 18:15     ` Ian Jackson
2015-10-21  9:08 ` [PATCH V8 3/7] libxl: add pvusb API Chunyan Liu
2015-10-27 11:31   ` Juergen Gross [this message]
2015-11-04  6:31   ` Chun Yan Liu
2015-11-05 15:54     ` George Dunlap
2015-11-09 18:11   ` Ian Jackson
2015-11-10  8:41     ` Chun Yan Liu
2015-11-10 17:57       ` George Dunlap
2015-11-10 18:11         ` Ian Jackson
2015-11-11  7:21           ` Chun Yan Liu
2015-11-11  2:37         ` Chun Yan Liu
2015-11-12 17:00       ` Ian Jackson
2015-11-13  2:30         ` Chun Yan Liu
2015-11-16 18:06           ` Ian Jackson
2015-11-17  5:47             ` Chun Yan Liu
2015-11-12 11:32   ` Olaf Hering
2015-11-13  2:32     ` Chun Yan Liu
2015-11-12 17:27   ` George Dunlap
2015-11-13  2:56     ` Chun Yan Liu
2015-11-13 11:19   ` Olaf Hering
2015-11-16 10:01     ` George Dunlap
2015-11-18  5:48       ` Chun Yan Liu
2015-11-18  9:44         ` Olaf Hering
2015-11-18 10:03           ` Ian Campbell
2015-11-18 10:42             ` Olaf Hering
2015-11-19  1:33           ` Chun Yan Liu
2015-11-19  6:24             ` Chun Yan Liu
2015-11-23 17:24               ` George Dunlap
2015-10-21  9:08 ` [PATCH V8 4/7] libxl: add libxl_device_usb_assignable_list API Chunyan Liu
2015-10-27 11:32   ` Juergen Gross
2015-11-11 16:07   ` George Dunlap
2015-10-21  9:08 ` [PATCH V8 5/7] xl: add pvusb commands Chunyan Liu
2015-10-27 11:37   ` Juergen Gross
2015-11-12 11:38   ` George Dunlap
2015-11-12 11:39     ` George Dunlap
2015-11-13  2:43     ` Chun Yan Liu
2015-11-16 10:05       ` George Dunlap
2015-11-12 14:42   ` Olaf Hering
2015-11-12 14:49     ` George Dunlap
2015-11-13  2:49     ` Chun Yan Liu
2015-10-21  9:08 ` [PATCH V8 6/7] xl: add usb-assignable-list command Chunyan Liu
2015-10-27 11:38   ` Juergen Gross
2015-11-12 11:44   ` George Dunlap
2015-10-21  9:08 ` [PATCH V8 7/7] domcreate: support pvusb in configuration file Chunyan Liu
2015-10-27 11:41   ` Juergen Gross
2015-11-12 16:10   ` George Dunlap
2015-11-13  2:54     ` Chun Yan Liu

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=562F6077.7000209@suse.com \
    --to=jgross@suse.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=caobosimon@gmail.com \
    --cc=cyliu@suse.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=jfehlig@suse.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).