xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Oleksandr Grytsov <al1img@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: ian.jackson@eu.citrix.com, wei.liu2@citrix.com,
	Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Subject: [PATCH v4 13/13] libxl: make pci and usb setdefault function generic
Date: Tue, 18 Jul 2017 17:25:30 +0300	[thread overview]
Message-ID: <1500387930-16317-14-git-send-email-al1img@gmail.com> (raw)
In-Reply-To: <1500387930-16317-1-git-send-email-al1img@gmail.com>

From: Oleksandr Grytsov <oleksandr_grytsov@epam.com>

Due to changes in device framework setdefault function
should have same format. Otherwise calling devicetype
set_default causes segfault.

Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
---
 tools/libxl/libxl_internal.h | 1 -
 tools/libxl/libxl_pci.c      | 5 +++--
 tools/libxl/libxl_usb.c      | 7 ++++---
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 5fd0356..e4799eb 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -1242,7 +1242,6 @@ _hidden int libxl__domain_create_info_setdefault(libxl__gc *gc,
                                         libxl_domain_create_info *c_info);
 _hidden int libxl__domain_build_info_setdefault(libxl__gc *gc,
                                         libxl_domain_build_info *b_info);
-_hidden int libxl__device_pci_setdefault(libxl__gc *gc, libxl_device_pci *pci);
 _hidden void libxl__rdm_setdefault(libxl__gc *gc,
                                    libxl_domain_build_info *b_info);
 
diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
index 159d046..fa86bcf 100644
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -1158,7 +1158,8 @@ static int libxl__device_pci_reset(libxl__gc *gc, unsigned int domain, unsigned
     return -1;
 }
 
-int libxl__device_pci_setdefault(libxl__gc *gc, libxl_device_pci *pci)
+static int libxl__device_pci_setdefault(libxl__gc *gc, uint32_t domid,
+                                 libxl_device_pci *pci, bool hotplug)
 {
     /* We'd like to force reserve rdm specific to a device by default.*/
     if (pci->rdm_policy == LIBXL_RDM_RESERVE_POLICY_INVALID)
@@ -1214,7 +1215,7 @@ int libxl__device_pci_add(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcide
         }
     }
 
-    rc = libxl__device_pci_setdefault(gc, pcidev);
+    rc = libxl__device_pci_setdefault(gc, domid, pcidev, false);
     if (rc) goto out;
 
     if (pcidev->seize && !pciback_dev_is_assigned(gc, pcidev)) {
diff --git a/tools/libxl/libxl_usb.c b/tools/libxl/libxl_usb.c
index e526c08..9fdb284 100644
--- a/tools/libxl/libxl_usb.c
+++ b/tools/libxl/libxl_usb.c
@@ -39,7 +39,8 @@ static int usbback_is_loaded(libxl__gc *gc)
 }
 
 static int libxl__device_usbctrl_setdefault(libxl__gc *gc, uint32_t domid,
-                                            libxl_device_usbctrl *usbctrl)
+                                            libxl_device_usbctrl *usbctrl,
+                                            bool update_json)
 {
     int rc;
     libxl_domain_type domtype = libxl__domain_type(gc, domid);
@@ -449,7 +450,7 @@ static void libxl__device_usbctrl_add(libxl__egc *egc, uint32_t domid,
     libxl__device *device;
     int rc;
 
-    rc = libxl__device_usbctrl_setdefault(gc, domid, usbctrl);
+    rc = libxl__device_usbctrl_setdefault(gc, domid, usbctrl, false);
     if (rc < 0) goto out;
 
     if (usbctrl->devid == -1) {
@@ -1079,7 +1080,7 @@ static int libxl__device_usbdev_setdefault(libxl__gc *gc,
 
             GCNEW(usbctrl);
             libxl_device_usbctrl_init(usbctrl);
-            rc = libxl__device_usbctrl_setdefault(gc, domid, usbctrl);
+            rc = libxl__device_usbctrl_setdefault(gc, domid, usbctrl, update_json);
             if (rc < 0) goto out;
 
             if (usbctrl->devid == -1) {
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2017-07-18 14:25 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-18 14:25 [PATCH v4 00/13] libxl: add PV display device driver interface Oleksandr Grytsov
2017-07-18 14:25 ` [PATCH v4 01/13] libxl: add generic function to add device Oleksandr Grytsov
2017-09-05 11:47   ` Wei Liu
2017-09-05 16:44     ` Oleksandr Grytsov
2017-09-06  9:36       ` Wei Liu
2017-09-06 12:08         ` Oleksandr Grytsov
2017-07-18 14:25 ` [PATCH v4 02/13] libxl: add generic functions to get and free device list Oleksandr Grytsov
2017-09-05 11:51   ` Wei Liu
2017-09-06 12:31     ` Oleksandr Grytsov
2017-07-18 14:25 ` [PATCH v4 03/13] libxl: add vdispl device Oleksandr Grytsov
2017-09-05 12:52   ` Wei Liu
2017-09-05 12:58     ` Ian Jackson
2017-09-05 13:04       ` Wei Liu
2017-09-06 13:02         ` Oleksandr Grytsov
2017-09-06 13:39           ` Wei Liu
2017-07-18 14:25 ` [PATCH v4 04/13] xl: add PV display device commands Oleksandr Grytsov
2017-07-28 14:11   ` Wei Liu
2017-07-18 14:25 ` [PATCH v4 05/13] docs: add PV display driver information Oleksandr Grytsov
2017-07-28 14:11   ` Wei Liu
2017-07-18 14:25 ` [PATCH v4 06/13] libxl: change p9 to use generec add function Oleksandr Grytsov
2017-07-28 14:11   ` Wei Liu
2017-07-28 16:23     ` Wei Liu
2017-07-30 18:42       ` Oleksandr Grytsov
2017-07-31 14:36         ` Wei Liu
2017-08-01 11:58           ` Oleksandr Grytsov
2017-08-01 13:00             ` Wei Liu
2017-08-02 11:37               ` Oleksandr Grytsov
2017-08-04 11:53                 ` Wei Liu
2017-08-08 12:39                   ` Oleksandr Grytsov
2017-08-08 15:05                     ` Wei Liu
2017-09-05 12:53   ` Wei Liu
2017-07-18 14:25 ` [PATCH v4 07/13] libxl: change vkb " Oleksandr Grytsov
2017-09-05 12:54   ` Wei Liu
2017-07-18 14:25 ` [PATCH v4 08/13] libxl: change vfb " Oleksandr Grytsov
2017-09-05 12:55   ` Wei Liu
2017-07-18 14:25 ` [PATCH v4 09/13] libxl: change disk to use generic getting list functions Oleksandr Grytsov
2017-09-05 12:58   ` Wei Liu
2017-07-18 14:25 ` [PATCH v4 10/13] libxl: change nic to use generec add function Oleksandr Grytsov
2017-09-05 13:03   ` Wei Liu
2017-09-06 15:39     ` Oleksandr Grytsov
2017-07-18 14:25 ` [PATCH v4 11/13] libxl: change vtpm " Oleksandr Grytsov
2017-09-05 13:05   ` Wei Liu
2017-07-18 14:25 ` [PATCH v4 12/13] libxl: remove unneeded DEVICE_ADD macro Oleksandr Grytsov
2017-09-05 13:05   ` Wei Liu
2017-07-18 14:25 ` Oleksandr Grytsov [this message]
2017-09-05 13:06   ` [PATCH v4 13/13] libxl: make pci and usb setdefault function generic Wei Liu
2017-09-06 15:53     ` Oleksandr Grytsov
2017-09-07  9:05       ` Wei Liu
2017-07-27 11:30 ` [PATCH v4 00/13] libxl: add PV display device driver interface Oleksandr Andrushchenko
2017-07-27 14:49   ` Wei Liu
2017-07-28 14:13 ` Wei Liu
2017-08-17 10:13   ` Oleksandr Grytsov
2017-08-17 11:11     ` Wei Liu
2017-08-30 15:49       ` Oleksandr Grytsov
2017-08-30 15:52         ` Ian Jackson
2017-08-31  9:01           ` Oleksandr Grytsov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1500387930-16317-14-git-send-email-al1img@gmail.com \
    --to=al1img@gmail.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=oleksandr_grytsov@epam.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).