[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH V5 6/7] xl: add usb-assignable-list command
Add xl usb-assignable-list command to list assignable USB devices. Assignable USB device means the USB device type is assignable and it's not assigned to any guest yet. Signed-off-by: Chunyan Liu <cyliu@xxxxxxxx> --- Same as "libxl: add libxl_device_usb_assignable_list API" patch, this patch could be sqaushed to previous one. Split because of some dispute. Could be squashed if acceptable, otherwise could be removed. tools/libxl/xl.h | 1 + tools/libxl/xl_cmdimpl.c | 25 +++++++++++++++++++++++++ tools/libxl/xl_cmdtable.c | 4 ++++ 3 files changed, 30 insertions(+) diff --git a/tools/libxl/xl.h b/tools/libxl/xl.h index 2d57ee3..f37a99f 100644 --- a/tools/libxl/xl.h +++ b/tools/libxl/xl.h @@ -86,6 +86,7 @@ int main_blockdetach(int argc, char **argv); int main_vtpmattach(int argc, char **argv); int main_vtpmlist(int argc, char **argv); int main_vtpmdetach(int argc, char **argv); +int main_usbassignable_list(int argc, char **argv); int main_usbctrl_attach(int argc, char **argv); int main_usbctrl_detach(int argc, char **argv); int main_usbattach(int argc, char **argv); diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 82a92a1..005d1c2 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -3236,6 +3236,31 @@ static void usbinfo_print(libxl_device_usb *usb) libxl_usbinfo_dispose(&usbinfo); } +static void usb_assignable_list(void) +{ + libxl_device_usb *usbs; + int num, i; + + usbs = libxl_device_usb_assignable_list(ctx, &num); + + for (i = 0; i < num; i++) + usbinfo_print(&usbs[i]); + + libxl_device_usb_list_free(usbs, num); +} + +int main_usbassignable_list(int argc, char **argv) +{ + int opt; + + SWITCH_FOREACH_OPT(opt, "", NULL, "usb-assignable-list", 0) { + /* No options */ + } + + usb_assignable_list(); + return 0; +} + int main_usbctrl_attach(int argc, char **argv) { uint32_t domid; diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c index 8f1c93d..d5eb8df 100644 --- a/tools/libxl/xl_cmdtable.c +++ b/tools/libxl/xl_cmdtable.c @@ -570,6 +570,10 @@ struct cmd_spec cmd_table[] = { "List information about USB devices for a domain", "<Domain>", }, + { "usb-assignable-list", + &main_usbassignable_list, 0, 0, + "List all assignable USB devices", + }, }; int cmdtable_len = sizeof(cmd_table)/sizeof(struct cmd_spec); -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |