[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen staging] libxl_pci: Constify arg `pcidev' of libxl__device_pci_add_xenstore



commit dbe92a588c429324fb2b7c02eb1e1cc7027ef8e3
Author:     Anthony PERARD <anthony.perard@xxxxxxxxxx>
AuthorDate: Thu May 9 15:04:33 2019 +0100
Commit:     Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
CommitDate: Fri Sep 20 10:41:01 2019 +0100

    libxl_pci: Constify arg `pcidev' of libxl__device_pci_add_xenstore
    
    libxl__device_pci_add_xenstore doesn't modify `pcidev', so it can be
    constified. Also, we don't need pcidev_saved anymore, so remove the
    saved copy. (device_add_domain_config is going to make it's own copy
    anyway.)
    
    To achieve this, constify pcidev in all functions that
    libxl__device_pci_add_xenstore calls.
    
    No functional changes.
    
    Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl_pci.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
index 12262a040b..cef20a839e 100644
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -47,7 +47,10 @@ static void pcidev_struct_fill(libxl_device_pci *pcidev, 
unsigned int domain,
     pcidev->vdevfn = vdevfn;
 }
 
-static void libxl_create_pci_backend_device(libxl__gc *gc, flexarray_t *back, 
int num, libxl_device_pci *pcidev)
+static void libxl_create_pci_backend_device(libxl__gc *gc,
+                                            flexarray_t *back,
+                                            int num,
+                                            const libxl_device_pci *pcidev)
 {
     flexarray_append(back, GCSPRINTF("key-%d", num));
     flexarray_append(back, GCSPRINTF(PCI_BDF, pcidev->domain, pcidev->bus, 
pcidev->dev, pcidev->func));
@@ -64,7 +67,7 @@ static void libxl_create_pci_backend_device(libxl__gc *gc, 
flexarray_t *back, in
 }
 
 static void libxl__device_from_pcidev(libxl__gc *gc, uint32_t domid,
-                                      libxl_device_pci *pcidev,
+                                      const libxl_device_pci *pcidev,
                                       libxl__device *device)
 {
     device->backend_devid = 0;
@@ -76,7 +79,8 @@ static void libxl__device_from_pcidev(libxl__gc *gc, uint32_t 
domid,
 }
 
 static int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid,
-                                     libxl_device_pci *pcidev, int num)
+                                     const libxl_device_pci *pcidev,
+                                     int num)
 {
     flexarray_t *front = NULL;
     flexarray_t *back = NULL;
@@ -109,7 +113,10 @@ static int libxl__create_pci_backend(libxl__gc *gc, 
uint32_t domid,
                                      NULL);
 }
 
-static int libxl__device_pci_add_xenstore(libxl__gc *gc, uint32_t domid, 
libxl_device_pci *pcidev, int starting)
+static int libxl__device_pci_add_xenstore(libxl__gc *gc,
+                                          uint32_t domid,
+                                          const libxl_device_pci *pcidev,
+                                          int starting)
 {
     flexarray_t *back;
     char *num_devs, *be_path;
@@ -117,12 +124,9 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc, 
uint32_t domid, libxl_d
     xs_transaction_t t = XBT_NULL;
     int rc;
     libxl_domain_config d_config;
-    libxl_device_pci pcidev_saved;
     libxl__domain_userdata_lock *lock = NULL;
 
     libxl_domain_config_init(&d_config);
-    libxl_device_pci_init(&pcidev_saved);
-    libxl_device_pci_copy(CTX, &pcidev_saved, pcidev);
 
     be_path = libxl__domain_device_backend_path(gc, 0, domid, 0,
                                                 LIBXL__DEVICE_KIND_PCI);
@@ -158,7 +162,7 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc, 
uint32_t domid, libxl_d
     if (rc) goto out;
 
     device_add_domain_config(gc, &d_config, &libxl__pcidev_devtype,
-                             &pcidev_saved);
+                             pcidev);
 
     rc = libxl__dm_check_start(gc, &d_config, domid);
     if (rc) goto out;
@@ -180,7 +184,6 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc, 
uint32_t domid, libxl_d
 out:
     libxl__xs_transaction_abort(gc, &t);
     if (lock) libxl__unlock_domain_userdata(lock);
-    libxl_device_pci_dispose(&pcidev_saved);
     libxl_domain_config_dispose(&d_config);
     return rc;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.