[13/15] libxl: Constify libxl_device_* param of *_getinfo
diff mbox series

Message ID 20190614112444.29980-14-anthony.perard@citrix.com
State New, archived
Headers show
Series
  • Some cleanup of libxl
Related show

Commit Message

Anthony PERARD June 14, 2019, 11:24 a.m. UTC
The libxl_device_TYPE parameter of all the libxl_device_TYPE_getinfo
function seems to be only used as input to find more information to bi
stored in the libxl_TYPEinfo parameter.

Make sure this is always true and constify the input parameter to avoid
further mistake.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libxl/libxl.h         | 14 +++++++-------
 tools/libxl/libxl_console.c |  2 +-
 tools/libxl/libxl_disk.c    |  3 ++-
 tools/libxl/libxl_nic.c     |  3 ++-
 tools/libxl/libxl_vdispl.c  |  2 +-
 tools/libxl/libxl_vkb.c     |  2 +-
 tools/libxl/libxl_vsnd.c    |  4 ++--
 tools/libxl/libxl_vtpm.c    |  2 +-
 8 files changed, 17 insertions(+), 15 deletions(-)

Comments

Ian Jackson Sept. 17, 2019, 4:45 p.m. UTC | #1
Anthony PERARD writes ("[PATCH 13/15] libxl: Constify libxl_device_* param of *_getinfo"):
> The libxl_device_TYPE parameter of all the libxl_device_TYPE_getinfo
> function seems to be only used as input to find more information to bi
> stored in the libxl_TYPEinfo parameter.
> 
> Make sure this is always true and constify the input parameter to avoid
> further mistake.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

Patch
diff mbox series

diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 750ef1b7d0..e40546c23a 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -1888,7 +1888,7 @@  libxl_device_disk *libxl_device_disk_list(libxl_ctx *ctx,
 void libxl_device_disk_list_free(libxl_device_disk* list, int num)
                                  LIBXL_EXTERNAL_CALLERS_ONLY;
 int libxl_device_disk_getinfo(libxl_ctx *ctx, uint32_t domid,
-                              libxl_device_disk *disk, libxl_diskinfo *diskinfo)
+                              const libxl_device_disk *disk, libxl_diskinfo *diskinfo)
                               LIBXL_EXTERNAL_CALLERS_ONLY;
 
 /*
@@ -1989,7 +1989,7 @@  libxl_device_nic *libxl_device_nic_list(libxl_ctx *ctx,
 void libxl_device_nic_list_free(libxl_device_nic* list, int num)
                                 LIBXL_EXTERNAL_CALLERS_ONLY;
 int libxl_device_nic_getinfo(libxl_ctx *ctx, uint32_t domid,
-                             libxl_device_nic *nic, libxl_nicinfo *nicinfo)
+                             const libxl_device_nic *nic, libxl_nicinfo *nicinfo)
                              LIBXL_EXTERNAL_CALLERS_ONLY;
 
 /*
@@ -2000,7 +2000,7 @@  libxl_device_channel *libxl_device_channel_list(libxl_ctx *ctx,
                                                 uint32_t domid,
                                                 int *num);
 int libxl_device_channel_getinfo(libxl_ctx *ctx, uint32_t domid,
-                                 libxl_device_channel *channel,
+                                 const libxl_device_channel *channel,
                                  libxl_channelinfo *channelinfo);
 
 /* Virtual TPMs */
@@ -2022,7 +2022,7 @@  libxl_device_vtpm *libxl_device_vtpm_list(libxl_ctx *ctx,
 void libxl_device_vtpm_list_free(libxl_device_vtpm*, int num)
                                  LIBXL_EXTERNAL_CALLERS_ONLY;
 int libxl_device_vtpm_getinfo(libxl_ctx *ctx, uint32_t domid,
-                              libxl_device_vtpm *vtpm, libxl_vtpminfo *vtpminfo)
+                              const libxl_device_vtpm *vtpm, libxl_vtpminfo *vtpminfo)
                               LIBXL_EXTERNAL_CALLERS_ONLY;
 
 /* Virtual displays */
@@ -2045,7 +2045,7 @@  libxl_device_vdispl *libxl_device_vdispl_list(libxl_ctx *ctx,
 void libxl_device_vdispl_list_free(libxl_device_vdispl* list, int num)
                                    LIBXL_EXTERNAL_CALLERS_ONLY;
 int libxl_device_vdispl_getinfo(libxl_ctx *ctx, uint32_t domid,
-                                libxl_device_vdispl *vdispl,
+                                const libxl_device_vdispl *vdispl,
                                 libxl_vdisplinfo *vdisplinfo)
                                 LIBXL_EXTERNAL_CALLERS_ONLY;
 
@@ -2069,7 +2069,7 @@  libxl_device_vsnd *libxl_device_vsnd_list(libxl_ctx *ctx,
 void libxl_device_vsnd_list_free(libxl_device_vsnd* list, int num)
                                  LIBXL_EXTERNAL_CALLERS_ONLY;
 int libxl_device_vsnd_getinfo(libxl_ctx *ctx, uint32_t domid,
-                              libxl_device_vsnd *vsnd,
+                              const libxl_device_vsnd *vsnd,
                               libxl_vsndinfo *vsndlinfo)
                               LIBXL_EXTERNAL_CALLERS_ONLY;
 
@@ -2092,7 +2092,7 @@  libxl_device_vkb *libxl_device_vkb_list(libxl_ctx *ctx,
 void libxl_device_vkb_list_free(libxl_device_vkb* list, int num)
                                 LIBXL_EXTERNAL_CALLERS_ONLY;
 int libxl_device_vkb_getinfo(libxl_ctx *ctx, uint32_t domid,
-                             libxl_device_vkb *vkb,
+                             const libxl_device_vkb *vkb,
                              libxl_vkbinfo *vkbinfo)
                              LIBXL_EXTERNAL_CALLERS_ONLY;
 
diff --git a/tools/libxl/libxl_console.c b/tools/libxl/libxl_console.c
index 36d79f5adc..088a455b52 100644
--- a/tools/libxl/libxl_console.c
+++ b/tools/libxl/libxl_console.c
@@ -566,7 +566,7 @@  libxl_device_channel *libxl_device_channel_list(libxl_ctx *ctx,
 }
 
 int libxl_device_channel_getinfo(libxl_ctx *ctx, uint32_t domid,
-                                 libxl_device_channel *channel,
+                                 const libxl_device_channel *channel,
                                  libxl_channelinfo *channelinfo)
 {
     GC_INIT(ctx);
diff --git a/tools/libxl/libxl_disk.c b/tools/libxl/libxl_disk.c
index bc9e2d5a74..d46e78a75c 100644
--- a/tools/libxl/libxl_disk.c
+++ b/tools/libxl/libxl_disk.c
@@ -598,7 +598,8 @@  int libxl_vdev_to_device_disk(libxl_ctx *ctx, uint32_t domid,
 }
 
 int libxl_device_disk_getinfo(libxl_ctx *ctx, uint32_t domid,
-                              libxl_device_disk *disk, libxl_diskinfo *diskinfo)
+                              const libxl_device_disk *disk,
+                              libxl_diskinfo *diskinfo)
 {
     GC_INIT(ctx);
     char *fe_path, *libxl_path;
diff --git a/tools/libxl/libxl_nic.c b/tools/libxl/libxl_nic.c
index f2b5e02285..07880b39e1 100644
--- a/tools/libxl/libxl_nic.c
+++ b/tools/libxl/libxl_nic.c
@@ -399,7 +399,8 @@  void libxl_device_nic_list_free(libxl_device_nic* list, int num)
 }
 
 int libxl_device_nic_getinfo(libxl_ctx *ctx, uint32_t domid,
-                              libxl_device_nic *nic, libxl_nicinfo *nicinfo)
+                              const libxl_device_nic *nic,
+                              libxl_nicinfo *nicinfo)
 {
     GC_INIT(ctx);
     char *nicpath, *libxl_path;
diff --git a/tools/libxl/libxl_vdispl.c b/tools/libxl/libxl_vdispl.c
index c9cc455176..8ddc8940e9 100644
--- a/tools/libxl/libxl_vdispl.c
+++ b/tools/libxl/libxl_vdispl.c
@@ -152,7 +152,7 @@  static int libxl__device_vdispl_getconnectors(libxl_ctx *ctx,
 }
 
 int libxl_device_vdispl_getinfo(libxl_ctx *ctx, uint32_t domid,
-                                libxl_device_vdispl *vdispl,
+                                const libxl_device_vdispl *vdispl,
                                 libxl_vdisplinfo *info)
 {
     GC_INIT(ctx);
diff --git a/tools/libxl/libxl_vkb.c b/tools/libxl/libxl_vkb.c
index 64e20b772a..26376a7eef 100644
--- a/tools/libxl/libxl_vkb.c
+++ b/tools/libxl/libxl_vkb.c
@@ -270,7 +270,7 @@  int libxl_devid_to_device_vkb(libxl_ctx *ctx, uint32_t domid,
 }
 
 int libxl_device_vkb_getinfo(libxl_ctx *ctx, uint32_t domid,
-                             libxl_device_vkb *vkb,
+                             const libxl_device_vkb *vkb,
                              libxl_vkbinfo *info)
 {
     GC_INIT(ctx);
diff --git a/tools/libxl/libxl_vsnd.c b/tools/libxl/libxl_vsnd.c
index 1151cbc567..0bc5f6dbb1 100644
--- a/tools/libxl/libxl_vsnd.c
+++ b/tools/libxl/libxl_vsnd.c
@@ -563,7 +563,7 @@  static int libxl__device_stream_getinfo(libxl__gc *gc, const char *path,
 }
 
 static int libxl__device_pcm_getinfo(libxl__gc *gc, const char *path,
-                                     libxl_device_vsnd *vsnd,
+                                     const libxl_device_vsnd *vsnd,
                                      libxl_vsndinfo *info)
 {
     int i;
@@ -588,7 +588,7 @@  static int libxl__device_pcm_getinfo(libxl__gc *gc, const char *path,
 }
 
 int libxl_device_vsnd_getinfo(libxl_ctx *ctx, uint32_t domid,
-                              libxl_device_vsnd *vsnd,
+                              const libxl_device_vsnd *vsnd,
                               libxl_vsndinfo *info)
 {
     GC_INIT(ctx);
diff --git a/tools/libxl/libxl_vtpm.c b/tools/libxl/libxl_vtpm.c
index f750395f6f..dd00b267bb 100644
--- a/tools/libxl/libxl_vtpm.c
+++ b/tools/libxl/libxl_vtpm.c
@@ -90,7 +90,7 @@  static int libxl__vtpm_from_xenstore(libxl__gc *gc, const char *libxl_path,
 
 int libxl_device_vtpm_getinfo(libxl_ctx *ctx,
                               uint32_t domid,
-                              libxl_device_vtpm *vtpm,
+                              const libxl_device_vtpm *vtpm,
                               libxl_vtpminfo *vtpminfo)
 {
     GC_INIT(ctx);