[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH V6 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 | 27 +++++++++++++++++++++++++++ tools/libxl/xl_cmdtable.c | 4 ++++ 3 files changed, 32 insertions(+) diff --git a/tools/libxl/xl.h b/tools/libxl/xl.h index e136fdf..e579ecc 100644 --- a/tools/libxl/xl.h +++ b/tools/libxl/xl.h @@ -85,6 +85,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 3e4d93a..e33871c 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -3322,6 +3322,33 @@ int main_cd_insert(int argc, char **argv) return 0; } +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++) { + printf("%d.%d\n", usbs[i].u.hostdev.hostbus, + usbs[i].u.hostdev.hostaddr); + } + + 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 46f276e..ba51331 100644 --- a/tools/libxl/xl_cmdtable.c +++ b/tools/libxl/xl_cmdtable.c @@ -576,6 +576,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 |