From patchwork Fri Sep 22 11:38:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Grytsov X-Patchwork-Id: 9965831 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8D0226035E for ; Fri, 22 Sep 2017 11:40:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95CC429892 for ; Fri, 22 Sep 2017 11:40:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A46729896; Fri, 22 Sep 2017 11:40:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 55C8729890 for ; Fri, 22 Sep 2017 11:40:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvMHo-0001Ta-Ko; Fri, 22 Sep 2017 11:38:24 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvMHn-0001TE-84 for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 11:38:23 +0000 Received: from [85.158.137.68] by server-17.bemta-3.messagelabs.com id 4A/92-01911-E26F4C95; Fri, 22 Sep 2017 11:38:22 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrJIsWRWlGSWpSXmKPExsVyMfS6o67utyO RBudvalh83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBkfGjIKHpdW7JxW0MC4O6SLkYtDSGAao0T3 8oNsIA6LwEsWia/f3jGDOBIC/awSZ9dPZupi5ARysiQmT53MCGGnSaxcdY8Nwi6X2HbkIZgtJ CAvcbDlMjvE2KlMEr0TJoI1swloSdy/vQKsSERASeLeKoihzAIpEnvXtYENFRZwkrh+7yxYnE VAVWLl3K3MIDavgIPE5N9foZbJSdw81wkW5xRwlPjSvZ4FYrGDxI2rs5gnMAouYGRYxahRnFp Ullqka2Sql1SUmZ5RkpuYmaNraGCsl5taXJyYnpqTmFSsl5yfu4kRGHD1DAyMOxhbT/gdYpTk YFIS5c39fCRSiC8pP6UyI7E4I76oNCe1+BCjBgeHwM+nf1sYpVjy8vNSlSR4H3wBqhMsSk1Pr UjLzAHGBEypBAePkgivzlegNG9xQWJucWY6ROoUoz3HhTuX/jBxHNt0GUge2HMLSHbcvPuHSQ hsqpQ4ryFImwBIW0ZpHtxQWAxfYpSVEuZlZGBgEOIpSC3KzSxBlX/FKM7BqCTMywAyhSczrwR u9yugs5iAzipfDXZWSSJCSqqBUei2y8cMnq13Yxa89Z9zQ6hJp3mf58NiMaXrel/m9sXMW/U7 YIHqiYkSr1P3at86fJptauj6CLm3n17fVzm5WXRF+Kv/CYkb1lY6id/siIgtfbF6kwVT+6Mtn HcOrD13aub/nVo70lnXxwfZVBdc/2Gbd/3i6ULTe4lPlj0KnVotov7Exvzw4aVKLMUZiYZazE XFiQC+C0Go3AIAAA== X-Env-Sender: al1img@gmail.com X-Msg-Ref: server-9.tower-31.messagelabs.com!1506080301!60569156!1 X-Originating-IP: [209.85.215.65] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 48772 invoked from network); 22 Sep 2017 11:38:21 -0000 Received: from mail-lf0-f65.google.com (HELO mail-lf0-f65.google.com) (209.85.215.65) by server-9.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 11:38:21 -0000 Received: by mail-lf0-f65.google.com with SMTP id h80so478039lfe.1 for ; Fri, 22 Sep 2017 04:38:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+/u7nqdHH+HmrvkfcRGbPb2x1M1VxJMgwBQLOKY0epc=; b=bJqh05A4ptJUGfx5csHKh5tldnMDfQ0AdNIpx2e5HOE4xe9FP+lsG0p24Pawf4zSqg lC9d6M4bQ4I2vvr//s0JNsZImOtivsPK/8qMrYB7UO7v6vRIwcO0Lbe4nPBJqmHJ8oQK 7gVxZdMZnwoJU9OCyQQjEGXweYxh5LgI3DhTQq+rWpXI2nlY2Cl4dLNopC29M1B8eznw aHXKrrZPTTsAFe3YyNb0P1Wb5wqfDOSFC9UjiitgihQ5ymGZ8uZMxbJXaD8Douxwm8MI SzLFAOKT42koZcmInHr2biODDvzFi9/MocMZAw/jCq1AnLuyOVEiFEDlA6hcMMjIK3ol QE0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+/u7nqdHH+HmrvkfcRGbPb2x1M1VxJMgwBQLOKY0epc=; b=ow/kNiGsxs4OFLVJcbUxqo0ZM+lRSNm20ixA6zVpHlJqm/XG98CcvPLuq5aDcpGauA dlg0HT0No/97UgQ12nhS8NEKaqVgkuHcBG3LOFkpPs7mxAVJOfUlqUIUkvis4WirZkdU dzBukaELXTDC58oaUPTelklsXKSaEL3T0udjvIn3PkKBr6FY08/DEXEb3QR0eu2Lq+p+ RfvsR5RsRsKIpucmaJ8c22PJYzXDO4ZxciXPVnWUb9RcOCFG7agK+UpjAmhMBI7IvYH1 BJfYdCezlZlhq4/VnlbMYzMO9cpbDR7n09XhuaQqQFMwfMVVdXtL2AYrUBOdx7vQ81dk yh7g== X-Gm-Message-State: AHPjjUi4CnrXkpZC79Tb9OF7mlhY/YMVRdlOR6DSrOBp+e+4TzxoMurW vsDE+D2060W2PyXuB+pCOCI6QA== X-Google-Smtp-Source: AOwi7QCj4jHIXhH0GZsvIM3Mh+mMtKBVNMfYpBjzmiMPzjagIu+wa9DlqOGyvw6OJcoRBmy1xdQmHQ== X-Received: by 10.46.80.17 with SMTP id e17mr2429118ljb.78.1506080300690; Fri, 22 Sep 2017 04:38:20 -0700 (PDT) Received: from al1-pc.kyiv.epam.com (ll-52.209.223.85.sovam.net.ua. [85.223.209.52]) by smtp.gmail.com with ESMTPSA id g20sm578463lfh.31.2017.09.22.04.38.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 04:38:20 -0700 (PDT) From: Oleksandr Grytsov To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 14:38:08 +0300 Message-Id: <1506080288-20502-2-git-send-email-al1img@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506080288-20502-1-git-send-email-al1img@gmail.com> References: <1506080288-20502-1-git-send-email-al1img@gmail.com> Cc: ian.jackson@eu.citrix.com, wei.liu2@citrix.com, Oleksandr Grytsov Subject: [Xen-devel] [PATCH] libxl: remove list callback from device framework X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Oleksandr Grytsov As we have generic functions to get device list (libxl__device_list) no need to have callback in the framework. To resolve issue when XS entry doesn't match device name, device type is extended with field "entry" which keeps XS entry. Signed-off-by: Oleksandr Grytsov --- tools/libxl/libxl_checkpoint_device.c | 4 ++-- tools/libxl/libxl_colo_save.c | 2 +- tools/libxl/libxl_device.c | 4 ++-- tools/libxl/libxl_disk.c | 24 ++++-------------------- tools/libxl/libxl_domain.c | 4 ++-- tools/libxl/libxl_internal.h | 30 ++++++++++++++++++++++++------ tools/libxl/libxl_nic.c | 6 +++--- tools/libxl/libxl_pci.c | 2 +- tools/libxl/libxl_vdispl.c | 23 ++--------------------- tools/libxl/libxl_vtpm.c | 23 +++-------------------- 10 files changed, 44 insertions(+), 78 deletions(-) diff --git a/tools/libxl/libxl_checkpoint_device.c b/tools/libxl/libxl_checkpoint_device.c index ef212e4..f6395dc 100644 --- a/tools/libxl/libxl_checkpoint_device.c +++ b/tools/libxl/libxl_checkpoint_device.c @@ -64,11 +64,11 @@ void libxl__checkpoint_devices_setup(libxl__egc *egc, if (cds->device_kind_flags & (1 << LIBXL__DEVICE_KIND_VIF)) cds->nics = libxl__device_list(gc, &libxl__nic_devtype, cds->domid, - "vif", &cds->num_nics); + &cds->num_nics); if (cds->device_kind_flags & (1 << LIBXL__DEVICE_KIND_VBD)) cds->disks = libxl__device_list(gc, &libxl__disk_devtype, cds->domid, - "vbd", &cds->num_disks); + &cds->num_disks); if (cds->num_nics == 0 && cds->num_disks == 0) goto out; diff --git a/tools/libxl/libxl_colo_save.c b/tools/libxl/libxl_colo_save.c index 43f7dbe..3247cce 100644 --- a/tools/libxl/libxl_colo_save.c +++ b/tools/libxl/libxl_colo_save.c @@ -122,7 +122,7 @@ void libxl__colo_save_setup(libxl__egc *egc, libxl__colo_save_state *css) /* Use this args we can connect to qemu colo-compare */ cds->nics = libxl__device_list(gc, &libxl__nic_devtype, - cds->domid, "vif", &cds->num_nics); + cds->domid, &cds->num_nics); if (cds->num_nics > 0) { css->cps.checkpoint_host = cds->nics[0].colo_checkpoint_host; css->cps.checkpoint_port = cds->nics[0].colo_checkpoint_port; diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c index 67b7afb..46ca5a4 100644 --- a/tools/libxl/libxl_device.c +++ b/tools/libxl/libxl_device.c @@ -1989,7 +1989,7 @@ out: } void *libxl__device_list(libxl__gc *gc, const struct libxl_device_type *dt, - uint32_t domid, const char* name, int *num) + uint32_t domid, int *num) { void *r = NULL; void *list = NULL; @@ -2002,7 +2002,7 @@ void *libxl__device_list(libxl__gc *gc, const struct libxl_device_type *dt, *num = 0; libxl_path = GCSPRINTF("%s/device/%s", - libxl__xs_libxl_path(gc, domid), name); + libxl__xs_libxl_path(gc, domid), dt->entry); dir = libxl__xs_directory(gc, XBT_NULL, libxl_path, &ndirs); diff --git a/tools/libxl/libxl_disk.c b/tools/libxl/libxl_disk.c index 06dd4d3..246227b 100644 --- a/tools/libxl/libxl_disk.c +++ b/tools/libxl/libxl_disk.c @@ -622,24 +622,6 @@ out: return rc; } -libxl_device_disk *libxl_device_disk_list(libxl_ctx *ctx, uint32_t domid, int *num) -{ - libxl_device_disk *r; - - GC_INIT(ctx); - - r = libxl__device_list(gc, &libxl__disk_devtype, domid, "vbd", num); - - GC_FREE; - - return r; -} - -void libxl_device_disk_list_free(libxl_device_disk *list, int num) -{ - libxl__device_list_free(&libxl__disk_devtype, list, num); -} - int libxl_device_disk_getinfo(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk, libxl_diskinfo *diskinfo) { @@ -741,7 +723,7 @@ int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk, goto out; } - disks = libxl__device_list(gc, &libxl__disk_devtype, domid, "vbd", &num); + disks = libxl__device_list(gc, &libxl__disk_devtype, domid, &num); for (i = 0; i < num; i++) { if (disks[i].is_cdrom && !strcmp(disk->vdev, disks[i].vdev)) { @@ -1201,9 +1183,11 @@ static int libxl_device_disk_dm_needed(void *e, unsigned domid) elem->backend_domid == domid; } +LIBXL_DEFINE_DEVICE_LIST(disk) + #define libxl__device_disk_update_devid NULL -DEFINE_DEVICE_TYPE_STRUCT(disk, +DEFINE_DEVICE_TYPE_STRUCT_X(disk, disk, vbd, .merge = libxl_device_disk_merge, .dm_needed = libxl_device_disk_dm_needed, .from_xenstore = (int (*)(libxl__gc *, const char *, libxl_devid, void *)) diff --git a/tools/libxl/libxl_domain.c b/tools/libxl/libxl_domain.c index 08eccd0..0434ab9 100644 --- a/tools/libxl/libxl_domain.c +++ b/tools/libxl/libxl_domain.c @@ -1679,11 +1679,11 @@ int libxl_retrieve_domain_configuration(libxl_ctx *ctx, uint32_t domid, if (!dt) break; - if (!dt->list || !dt->compare) + if (!dt->compare) continue; num_dev = libxl__device_type_get_num(dt, d_config); - p = dt->list(CTX, domid, &num); + p = libxl__device_list(gc, dt, domid, &num); if (p == NULL) { LOGD(DEBUG, domid, "No %s from xenstore", dt->type); diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 81e87ae..4a08842 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -3461,15 +3461,34 @@ _hidden void libxl__bootloader_run(libxl__egc*, libxl__bootloader_state *st); LIBXL_DEFINE_DEVICE_REMOVE_EXT(type, type, remove, 0) \ LIBXL_DEFINE_DEVICE_REMOVE_EXT(type, type, destroy, 1) +#define LIBXL_DEFINE_DEVICE_LIST(type) \ + libxl_device_##type *libxl_device_##type##_list(libxl_ctx *ctx, \ + uint32_t domid, \ + int *num) \ + { \ + libxl_device_##type *r; \ + GC_INIT(ctx); \ + r = libxl__device_list(gc, &libxl__##type##_devtype, \ + domid, num); \ + GC_FREE; \ + return r; \ + } \ + \ + void libxl_device_##type##_list_free(libxl_device_##type *list, \ + int num) \ + { \ + libxl__device_list_free(&libxl__##type##_devtype, list, num); \ + } + struct libxl_device_type { char *type; + char *entry; int skip_attach; /* Skip entry in domcreate_attach_devices() if 1 */ int ptr_offset; /* Offset of device array ptr in libxl_domain_config */ int num_offset; /* Offset of # of devices in libxl_domain_config */ int dev_elem_size; /* Size of one device element in array */ void (*add)(libxl__egc *, libxl__ao *, uint32_t, libxl_domain_config *, libxl__multidev *); - void *(*list)(libxl_ctx *, uint32_t, int *); int (*set_default)(libxl__gc *, uint32_t, void *, bool); int (*to_device)(libxl__gc *, uint32_t, void *, libxl__device *); void (*init)(void *); @@ -3485,15 +3504,14 @@ struct libxl_device_type { flexarray_t *, flexarray_t *); }; -#define DEFINE_DEVICE_TYPE_STRUCT_X(name, sname, ...) \ +#define DEFINE_DEVICE_TYPE_STRUCT_X(name, sname, sentry, ...) \ const struct libxl_device_type libxl__ ## name ## _devtype = { \ .type = #sname, \ + .entry = #sentry, \ .ptr_offset = offsetof(libxl_domain_config, name ## s), \ .num_offset = offsetof(libxl_domain_config, num_ ## name ## s), \ .dev_elem_size = sizeof(libxl_device_ ## sname), \ .add = libxl__add_ ## name ## s, \ - .list = (void *(*)(libxl_ctx *, uint32_t, int *)) \ - libxl_device_ ## sname ## _list, \ .set_default = (int (*)(libxl__gc *, uint32_t, void *, bool))\ libxl__device_ ## sname ## _setdefault, \ .to_device = (int (*)(libxl__gc *, uint32_t, \ @@ -3511,7 +3529,7 @@ struct libxl_device_type { } #define DEFINE_DEVICE_TYPE_STRUCT(name, ...) \ - DEFINE_DEVICE_TYPE_STRUCT_X(name, name, __VA_ARGS__) + DEFINE_DEVICE_TYPE_STRUCT_X(name, name, name, __VA_ARGS__) static inline void **libxl__device_type_get_ptr( const struct libxl_device_type *dt, const libxl_domain_config *d_config) @@ -4323,7 +4341,7 @@ int libxl__device_add(libxl__gc *gc, uint32_t domid, * libxl__device_list_free */ void* libxl__device_list(libxl__gc *gc, const struct libxl_device_type *dt, - uint32_t domid, const char* name, int *num); + uint32_t domid, int *num); void libxl__device_list_free(const struct libxl_device_type *dt, void *list, int num); #endif diff --git a/tools/libxl/libxl_nic.c b/tools/libxl/libxl_nic.c index d81b95b..078c40b 100644 --- a/tools/libxl/libxl_nic.c +++ b/tools/libxl/libxl_nic.c @@ -29,7 +29,7 @@ int libxl_mac_to_device_nic(libxl_ctx *ctx, uint32_t domid, if (rc) return rc; - nics = libxl__device_list(gc, &libxl__nic_devtype, domid, "vif", &nb); + nics = libxl__device_list(gc, &libxl__nic_devtype, domid, &nb); if (!nics) return ERROR_FAIL; @@ -426,7 +426,7 @@ libxl_device_nic *libxl_device_nic_list(libxl_ctx *ctx, uint32_t domid, int *num GC_INIT(ctx); - r = libxl__device_list(gc, &libxl__nic_devtype, domid, "vif", num); + r = libxl__device_list(gc, &libxl__nic_devtype, domid, num); GC_FREE; @@ -540,7 +540,7 @@ LIBXL_DEFINE_DEVICE_ADD(nic) LIBXL_DEFINE_DEVICES_ADD(nic) LIBXL_DEFINE_DEVICE_REMOVE(nic) -DEFINE_DEVICE_TYPE_STRUCT(nic, +DEFINE_DEVICE_TYPE_STRUCT_X(nic, nic, vif, .update_config = libxl_device_nic_update_config, .from_xenstore = (int (*)(libxl__gc *, const char *, libxl_devid, void *)) libxl__nic_from_xenstore, diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c index f929e5a..88a55ce 100644 --- a/tools/libxl/libxl_pci.c +++ b/tools/libxl/libxl_pci.c @@ -1682,7 +1682,7 @@ static int libxl_device_pci_compare(libxl_device_pci *d1, #define libxl__device_pci_update_devid NULL -DEFINE_DEVICE_TYPE_STRUCT_X(pcidev, pci); +DEFINE_DEVICE_TYPE_STRUCT_X(pcidev, pci, pci); /* * Local variables: diff --git a/tools/libxl/libxl_vdispl.c b/tools/libxl/libxl_vdispl.c index befc56b..3237b9f 100644 --- a/tools/libxl/libxl_vdispl.c +++ b/tools/libxl/libxl_vdispl.c @@ -94,25 +94,6 @@ static int libxl__set_xenstore_vdispl(libxl__gc *gc, uint32_t domid, return 0; } -libxl_device_vdispl *libxl_device_vdispl_list(libxl_ctx *ctx, uint32_t domid, - int *num) -{ - libxl_device_vdispl *r; - - GC_INIT(ctx); - - r = libxl__device_list(gc, &libxl__vdispl_devtype, domid, "vdispl", num); - - GC_FREE; - - return r; -} - -void libxl_device_vdispl_list_free(libxl_device_vdispl* list, int num) -{ - libxl__device_list_free(&libxl__vdispl_devtype, list, num); -} - static int libxl__device_vdispl_getconnectors(libxl_ctx *ctx, const char *path, libxl_vdisplinfo *info) @@ -239,8 +220,7 @@ int libxl_devid_to_device_vdispl(libxl_ctx *ctx, uint32_t domid, libxl_device_vdispl_init(vdispl); - vdispls = libxl__device_list(gc, &libxl__vdispl_devtype, - domid, "vdispl", &n); + vdispls = libxl__device_list(gc, &libxl__vdispl_devtype, domid, &n); if (!vdispls) { rc = ERROR_NOTFOUND; goto out; } @@ -267,6 +247,7 @@ LIBXL_DEFINE_DEVICE_ADD(vdispl) static LIBXL_DEFINE_DEVICES_ADD(vdispl) LIBXL_DEFINE_DEVICE_REMOVE(vdispl) static LIBXL_DEFINE_UPDATE_DEVID(vdispl, "vdispl") +LIBXL_DEFINE_DEVICE_LIST(vdispl) DEFINE_DEVICE_TYPE_STRUCT(vdispl, .update_config = (void (*)(libxl__gc *, void *, void *)) diff --git a/tools/libxl/libxl_vtpm.c b/tools/libxl/libxl_vtpm.c index 6182cfc..c52b4b1 100644 --- a/tools/libxl/libxl_vtpm.c +++ b/tools/libxl/libxl_vtpm.c @@ -104,24 +104,6 @@ static int libxl__vtpm_from_xenstore(libxl__gc *gc, const char *libxl_path, return 0; } -libxl_device_vtpm *libxl_device_vtpm_list(libxl_ctx *ctx, uint32_t domid, int *num) -{ - libxl_device_vtpm *r; - - GC_INIT(ctx); - - r = libxl__device_list(gc, &libxl__vtpm_devtype, domid, "vtpm", num); - - GC_FREE; - - return r; -} - -void libxl_device_vtpm_list_free(libxl_device_vtpm* list, int num) -{ - libxl__device_list_free(&libxl__vtpm_devtype, list, num); -} - int libxl_device_vtpm_getinfo(libxl_ctx *ctx, uint32_t domid, libxl_device_vtpm *vtpm, @@ -196,7 +178,7 @@ int libxl_devid_to_device_vtpm(libxl_ctx *ctx, int nb, i; int rc; - vtpms = libxl__device_list(gc, &libxl__vtpm_devtype, domid, "vtpm", &nb); + vtpms = libxl__device_list(gc, &libxl__vtpm_devtype, domid, &nb); if (!vtpms) return ERROR_FAIL; @@ -231,7 +213,7 @@ int libxl_uuid_to_device_vtpm(libxl_ctx *ctx, uint32_t domid, int nb, i; int rc; - vtpms = libxl__device_list(gc, &libxl__vtpm_devtype, domid, "vtpm", &nb); + vtpms = libxl__device_list(gc, &libxl__vtpm_devtype, domid, &nb); if (!vtpms) return ERROR_FAIL; @@ -260,6 +242,7 @@ static void libxl_device_vtpm_update_config(libxl__gc *gc, void *d, void *s) LIBXL_DEFINE_DEVICE_ADD(vtpm) static LIBXL_DEFINE_DEVICES_ADD(vtpm) LIBXL_DEFINE_DEVICE_REMOVE(vtpm) +LIBXL_DEFINE_DEVICE_LIST(vtpm) DEFINE_DEVICE_TYPE_STRUCT(vtpm, .update_config = libxl_device_vtpm_update_config,