xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Anthony PERARD <anthony.perard@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>
Subject: [PATCH 3/3] libxl: Document device_add_domain_config
Date: Fri, 5 Apr 2019 18:58:11 +0100	[thread overview]
Message-ID: <20190405175811.7446-4-anthony.perard@citrix.com> (raw)
In-Reply-To: <20190405175811.7446-1-anthony.perard@citrix.com>

Commit 03e1a56d81c16eece735e4d0ef74bfb10eaaba07 replaced DEVICE_ADD()
calls by device_add_domain_config() calls but also removed the comment
of DEVICE_ADD(). Copy the useful part of that comment to
device_add_domain_config().

Also, rename the parameter `type` to `dev`, because that parameter isn't
used as a type but as the device we want to add/update to d_config.

Also, constify `dev` because it isn't modified.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libxl/libxl_device.c   |  6 +++---
 tools/libxl/libxl_internal.h | 15 ++++++++++++++-
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index a4a8e9ac32..87ddfc3ac7 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -1852,7 +1852,7 @@ int libxl_device_events_handler(libxl_ctx *ctx,
 }
 
 void device_add_domain_config(libxl__gc *gc, libxl_domain_config *d_config,
-                              const struct libxl_device_type *dt, void *type)
+                              const struct libxl_device_type *dt, const void *dev)
 {
     int *num_dev;
     unsigned int i;
@@ -1862,7 +1862,7 @@ void device_add_domain_config(libxl__gc *gc, libxl_domain_config *d_config,
 
     /* Check for existing device */
     for (i = 0; i < *num_dev; i++) {
-        if (dt->compare(libxl__device_type_get_elem(dt, d_config, i), type)) {
+        if (dt->compare(libxl__device_type_get_elem(dt, d_config, i), dev)) {
             item = libxl__device_type_get_elem(dt, d_config, i);
         }
     }
@@ -1878,7 +1878,7 @@ void device_add_domain_config(libxl__gc *gc, libxl_domain_config *d_config,
     }
 
     dt->init(item);
-    dt->copy(CTX, item, type);
+    dt->copy(CTX, item, dev);
 }
 
 void libxl__device_add_async(libxl__egc *egc, uint32_t domid,
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 34dc886505..44e0221284 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -4581,8 +4581,21 @@ static inline bool libxl__acpi_defbool_val(const libxl_domain_build_info *b_info
            libxl_defbool_val(b_info->u.hvm.acpi);
 }
 
+/*
+ * Add a device in libxl_domain_config structure
+ *
+ * If there is already a device with the same identifier in d_config,
+ * that entry is updated.
+ *
+ * parameters:
+ *  d_config: pointer to template domain config
+ *  dt:       type of `dev'
+ *  dev:      the device that is to be added / removed / updated
+ *            (a copy of `dev' will be made)
+ */
 void device_add_domain_config(libxl__gc *gc, libxl_domain_config *d_config,
-                              const struct libxl_device_type *dt, void *type);
+                              const struct libxl_device_type *dt,
+                              const void *dev);
 
 void libxl__device_add_async(libxl__egc *egc, uint32_t domid,
                              const struct libxl_device_type *dt, void *type,
-- 
Anthony PERARD


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

WARNING: multiple messages have this Message-ID (diff)
From: Anthony PERARD <anthony.perard@citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>
Subject: [Xen-devel] [PATCH 3/3] libxl: Document device_add_domain_config
Date: Fri, 5 Apr 2019 18:58:11 +0100	[thread overview]
Message-ID: <20190405175811.7446-4-anthony.perard@citrix.com> (raw)
Message-ID: <20190405175811.5pWKwXEBqcYp6-r4XrFQfzrRhaFEz35YpJNqyO88EiY@z> (raw)
In-Reply-To: <20190405175811.7446-1-anthony.perard@citrix.com>

Commit 03e1a56d81c16eece735e4d0ef74bfb10eaaba07 replaced DEVICE_ADD()
calls by device_add_domain_config() calls but also removed the comment
of DEVICE_ADD(). Copy the useful part of that comment to
device_add_domain_config().

Also, rename the parameter `type` to `dev`, because that parameter isn't
used as a type but as the device we want to add/update to d_config.

Also, constify `dev` because it isn't modified.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libxl/libxl_device.c   |  6 +++---
 tools/libxl/libxl_internal.h | 15 ++++++++++++++-
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index a4a8e9ac32..87ddfc3ac7 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -1852,7 +1852,7 @@ int libxl_device_events_handler(libxl_ctx *ctx,
 }
 
 void device_add_domain_config(libxl__gc *gc, libxl_domain_config *d_config,
-                              const struct libxl_device_type *dt, void *type)
+                              const struct libxl_device_type *dt, const void *dev)
 {
     int *num_dev;
     unsigned int i;
@@ -1862,7 +1862,7 @@ void device_add_domain_config(libxl__gc *gc, libxl_domain_config *d_config,
 
     /* Check for existing device */
     for (i = 0; i < *num_dev; i++) {
-        if (dt->compare(libxl__device_type_get_elem(dt, d_config, i), type)) {
+        if (dt->compare(libxl__device_type_get_elem(dt, d_config, i), dev)) {
             item = libxl__device_type_get_elem(dt, d_config, i);
         }
     }
@@ -1878,7 +1878,7 @@ void device_add_domain_config(libxl__gc *gc, libxl_domain_config *d_config,
     }
 
     dt->init(item);
-    dt->copy(CTX, item, type);
+    dt->copy(CTX, item, dev);
 }
 
 void libxl__device_add_async(libxl__egc *egc, uint32_t domid,
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 34dc886505..44e0221284 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -4581,8 +4581,21 @@ static inline bool libxl__acpi_defbool_val(const libxl_domain_build_info *b_info
            libxl_defbool_val(b_info->u.hvm.acpi);
 }
 
+/*
+ * Add a device in libxl_domain_config structure
+ *
+ * If there is already a device with the same identifier in d_config,
+ * that entry is updated.
+ *
+ * parameters:
+ *  d_config: pointer to template domain config
+ *  dt:       type of `dev'
+ *  dev:      the device that is to be added / removed / updated
+ *            (a copy of `dev' will be made)
+ */
 void device_add_domain_config(libxl__gc *gc, libxl_domain_config *d_config,
-                              const struct libxl_device_type *dt, void *type);
+                              const struct libxl_device_type *dt,
+                              const void *dev);
 
 void libxl__device_add_async(libxl__egc *egc, uint32_t domid,
                              const struct libxl_device_type *dt, void *type,
-- 
Anthony PERARD


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

  parent reply	other threads:[~2019-04-05 17:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-05 17:58 [PATCH 0/3] Some cleanup of device_add_domain_config Anthony PERARD
2019-04-05 17:58 ` [Xen-devel] " Anthony PERARD
2019-04-05 17:58 ` [PATCH 1/3] libxl: Constify libxl_device_*_compare functions Anthony PERARD
2019-04-05 17:58   ` [Xen-devel] " Anthony PERARD
2019-04-09 12:38   ` Wei Liu
2019-04-09 12:38     ` [Xen-devel] " Wei Liu
2019-04-05 17:58 ` [PATCH 2/3] libxl: Constify src of device_compare_fn_t Anthony PERARD
2019-04-05 17:58   ` [Xen-devel] " Anthony PERARD
2019-04-09 12:38   ` Wei Liu
2019-04-09 12:38     ` [Xen-devel] " Wei Liu
2019-04-05 17:58 ` Anthony PERARD [this message]
2019-04-05 17:58   ` [Xen-devel] [PATCH 3/3] libxl: Document device_add_domain_config Anthony PERARD
2019-04-09 12:46   ` Wei Liu
2019-04-09 12:46     ` [Xen-devel] " Wei Liu

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=20190405175811.7446-4-anthony.perard@citrix.com \
    --to=anthony.perard@citrix.com \
    --cc=ian.jackson@eu.citrix.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).