Re: [Xen-devel] [RESEND][PATCH V9 3/7] libxl: add pvusb API
Any comments? >>> On 11/25/2015 at 05:46 PM, in message <1448444775-6974-4-git-send-email-cy...@suse.com>, 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 > Signed-off-by: Simon Cao > > --- > changes: > - update naming, all places indicating usb controller named > as usbctrl, all places indicating usb device named as usbdev > - update DEFINE_DEVICE_REMOVE instead of creating a new > DEFINE_DEVICE_REMOVE_EXT > - use libxl__xs_read_checked instead of libxl__xs_read > - update local READ_SUBPATH(_INT) macros to include more common codes > - save drvpath before unbind > - get_assigned_devices: call libxl__device_usbdev_list_for_ctrl > instead of doing all things from scratch > - usb_interface_xenstore_encode: use special char to avoid confusion > - usb readdir_r instead of readdir > - check syscall errno > - remove usbinfo definition > - address other comments except: > libxl__device_usbdev_add/remove and do_usbdev_add/remove, in previous > discussion, we'd like to get usbctrlinfo once and pass usbctrlinfo to > do_usbdev_add/remove. However, during update, adding usbdev process > still needs to try twice to get usbctrlinfo. (Before set_default, > if usbctrl doesn't exist it doesn't doing getting usbctrlinfo actually; > after set_default, needs to get usbctrlinfo then). So, finally, just > change codes to make adding/removing process symmetrical. > > tools/libxl/Makefile |2 +- > tools/libxl/libxl.c | 50 +- > tools/libxl/libxl.h | 77 ++ > tools/libxl/libxl_device.c |5 +- > tools/libxl/libxl_internal.h | 18 + > tools/libxl/libxl_osdeps.h | 13 + > tools/libxl/libxl_pvusb.c| 1534 > ++ > tools/libxl/libxl_types.idl | 46 + > tools/libxl/libxl_types_internal.idl |1 + > tools/libxl/libxl_utils.c| 18 + > tools/libxl/libxl_utils.h|5 + > 11 files changed, 1766 insertions(+), 3 deletions(-) > create mode 100644 tools/libxl/libxl_pvusb.c > > diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile > index 6ff5bee..a36145a 100644 > --- a/tools/libxl/Makefile > +++ b/tools/libxl/Makefile > @@ -103,7 +103,7 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_create.o > libxl_dm.o libxl_pci.o \ > libxl_stream_read.o libxl_stream_write.o \ > libxl_save_callout.o _libxl_save_msgs_callout.o \ > libxl_qmp.o libxl_event.o libxl_fork.o \ > - libxl_dom_suspend.o $(LIBXL_OBJS-y) > + libxl_dom_suspend.o libxl_pvusb.o $(LIBXL_OBJS-y) > LIBXL_OBJS += libxl_genid.o > LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o > > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > index eaa7d75..a479465 100644 > --- a/tools/libxl/libxl.c > +++ b/tools/libxl/libxl.c > @@ -4144,6 +4144,36 @@ out: > return rc; > } > > +static void libxl__initiate_device_disk_remove(libxl__egc *egc, > + libxl__ao_device *aodev) > +{ > +return libxl__initiate_device_remove(egc, aodev); > +} > + > +static void libxl__initiate_device_nic_remove(libxl__egc *egc, > + libxl__ao_device *aodev) > +{ > +return libxl__initiate_device_remove(egc, aodev); > +} > + > +static void libxl__initiate_device_vtpm_remove(libxl__egc *egc, > + libxl__ao_device *aodev) > +{ > +return libxl__initiate_device_remove(egc, aodev); > +} > + > +static void libxl__initiate_device_vkb_remove(libxl__egc *egc, > + libxl__ao_device *aodev) > +{ > +return libxl__initiate_device_remove(egc, aodev); > +} > + > +static void libxl__initiate_device_vfb_remove(libxl__egc *egc, > + libxl__ao_device *aodev) > +{ > +return libxl__initiate_device_remove(egc, aodev); > +} > + > > / > **/ > > /* Macro for defining device remove/destroy functions in a compact way */ > @@ -4158,6 +4188,8 @@ out: > * libxl_device_vkb_destroy > * libxl_device_vfb_remove > * libxl_device_vfb_destroy > + * libxl_device_usbctrl_remove > + * libxl_device_usbctrl_destroy > */ > #define DEFINE_DEVICE_REMOVE(type, removedestroy, f)\ > int libxl_device_##type##_##removedestroy(libxl_ctx *ctx, \ > @@ -4179,7 +4211,7 @@ out: > aodev->dev = device;
Re: [Xen-devel] [RESEND][PATCH V9 3/7] libxl: add pvusb API
On 08/12/15 05:50, Chun Yan Liu wrote: > Any comments? I'd just started looking at this yesterday. :-) One comment for future reference: This series doesn't apply to staging, nor to staging the date which you sent it (25 November); I had to apply it to a commit before 5 November before it would apply cleanly. In the future please be sure when you send a series to rebase it to staging. (No need to rebase it now until you have some comments to address.) -George > On 11/25/2015 at 05:46 PM, in message > <1448444775-6974-4-git-send-email-cy...@suse.com>, 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 >> Signed-off-by: Simon Cao >> >> --- >> changes: >> - update naming, all places indicating usb controller named >> as usbctrl, all places indicating usb device named as usbdev >> - update DEFINE_DEVICE_REMOVE instead of creating a new >> DEFINE_DEVICE_REMOVE_EXT >> - use libxl__xs_read_checked instead of libxl__xs_read >> - update local READ_SUBPATH(_INT) macros to include more common codes >> - save drvpath before unbind >> - get_assigned_devices: call libxl__device_usbdev_list_for_ctrl >> instead of doing all things from scratch >> - usb_interface_xenstore_encode: use special char to avoid confusion >> - usb readdir_r instead of readdir >> - check syscall errno >> - remove usbinfo definition >> - address other comments except: >> libxl__device_usbdev_add/remove and do_usbdev_add/remove, in previous >> discussion, we'd like to get usbctrlinfo once and pass usbctrlinfo to >> do_usbdev_add/remove. However, during update, adding usbdev process >> still needs to try twice to get usbctrlinfo. (Before set_default, >> if usbctrl doesn't exist it doesn't doing getting usbctrlinfo actually; >> after set_default, needs to get usbctrlinfo then). So, finally, just >> change codes to make adding/removing process symmetrical. >> >> tools/libxl/Makefile |2 +- >> tools/libxl/libxl.c | 50 +- >> tools/libxl/libxl.h | 77 ++ >> tools/libxl/libxl_device.c |5 +- >> tools/libxl/libxl_internal.h | 18 + >> tools/libxl/libxl_osdeps.h | 13 + >> tools/libxl/libxl_pvusb.c| 1534 >> ++ >> tools/libxl/libxl_types.idl | 46 + >> tools/libxl/libxl_types_internal.idl |1 + >> tools/libxl/libxl_utils.c| 18 + >> tools/libxl/libxl_utils.h|5 + >> 11 files changed, 1766 insertions(+), 3 deletions(-) >> create mode 100644 tools/libxl/libxl_pvusb.c >> >> diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile >> index 6ff5bee..a36145a 100644 >> --- a/tools/libxl/Makefile >> +++ b/tools/libxl/Makefile >> @@ -103,7 +103,7 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_create.o >> libxl_dm.o libxl_pci.o \ >> libxl_stream_read.o libxl_stream_write.o \ >> libxl_save_callout.o _libxl_save_msgs_callout.o \ >> libxl_qmp.o libxl_event.o libxl_fork.o \ >> -libxl_dom_suspend.o $(LIBXL_OBJS-y) >> +libxl_dom_suspend.o libxl_pvusb.o $(LIBXL_OBJS-y) >> LIBXL_OBJS += libxl_genid.o >> LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o >> >> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c >> index eaa7d75..a479465 100644 >> --- a/tools/libxl/libxl.c >> +++ b/tools/libxl/libxl.c >> @@ -4144,6 +4144,36 @@ out: >> return rc; >> } >> >> +static void libxl__initiate_device_disk_remove(libxl__egc *egc, >> + libxl__ao_device *aodev) >> +{ >> +return libxl__initiate_device_remove(egc, aodev); >> +} >> + >> +static void libxl__initiate_device_nic_remove(libxl__egc *egc, >> + libxl__ao_device *aodev) >> +{ >> +return libxl__initiate_device_remove(egc, aodev); >> +} >> + >> +static void libxl__initiate_device_vtpm_remove(libxl__egc *egc, >> + libxl__ao_device *aodev) >> +{ >> +return libxl__initiate_device_remove(egc, aodev); >> +} >> + >> +static void libxl__initiate_device_vkb_remove(libxl__egc *egc, >> + libxl__ao_device *aodev) >> +{ >> +return libxl__initiate_device_remove(egc, aodev); >> +} >> + >> +static void libxl__initiate_device_vfb_remove(libxl__egc *egc, >> + libxl__ao_device *aodev) >> +{ >> +return libxl__initiate_device_remove(egc, aodev); >> +} >> + >> >> /*