All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: David Vrabel <david.vrabel@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH 4/8] libxl: const-ify libxl_uuid_*() API
Date: Tue, 10 Jun 2014 19:07:30 +0100	[thread overview]
Message-ID: <1402423654-2721-5-git-send-email-david.vrabel@citrix.com> (raw)
In-Reply-To: <1402423654-2721-1-git-send-email-david.vrabel@citrix.com>

Add const to parameters of libxl_uuid_*() calls where it does not
change the API.

Add libxl_uuid_byte_array_const() to return a const array.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
---
 tools/libxl/libxl_uuid.c |   18 ++++++++++++++----
 tools/libxl/libxl_uuid.h |    5 +++--
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/tools/libxl/libxl_uuid.c b/tools/libxl/libxl_uuid.c
index ecc29c7..6591cb7 100644
--- a/tools/libxl/libxl_uuid.c
+++ b/tools/libxl/libxl_uuid.c
@@ -20,7 +20,7 @@
 
 #if defined(__linux__)
 
-int libxl_uuid_is_nil(libxl_uuid *uuid)
+int libxl_uuid_is_nil(const libxl_uuid *uuid)
 {
      return uuid_is_null(uuid->uuid);
 }
@@ -45,11 +45,16 @@ void libxl_uuid_clear(libxl_uuid *uuid)
      uuid_clear(uuid->uuid);
 }
 
-int libxl_uuid_compare(libxl_uuid *uuid1, libxl_uuid *uuid2)
+int libxl_uuid_compare(const libxl_uuid *uuid1, const libxl_uuid *uuid2)
 {
      return uuid_compare(uuid1->uuid, uuid2->uuid);
 }
 
+const uint8_t *libxl_uuid_bytearray_const(const libxl_uuid *uuid)
+{
+    return uuid->uuid;
+}
+
 uint8_t *libxl_uuid_bytearray(libxl_uuid *uuid)
 {
     return uuid->uuid;
@@ -57,7 +62,7 @@ uint8_t *libxl_uuid_bytearray(libxl_uuid *uuid)
 
 #elif defined(__NetBSD__)
 
-int libxl_uuid_is_nil(libxl_uuid *uuid)
+int libxl_uuid_is_nil(const libxl_uuid *uuid)
 {
     uint32_t status;
     return uuid_is_nil((uuid_t *)uuid->uuid, &status);
@@ -92,11 +97,16 @@ void libxl_uuid_clear(libxl_uuid *uuid)
      memset(uuid->uuid, 0, sizeof(uuid->uuid));
 }
 
-int libxl_uuid_compare(libxl_uuid *uuid1, libxl_uuid *uuid2)
+int libxl_uuid_compare(const libxl_uuid *uuid1, const libxl_uuid *uuid2)
 {
      return memcmp(uuid1->uuid, uuid2->uuid, sizeof(uuid1->uuid));
 }
 
+const uint8_t *libxl_uuid_bytearray_const(const libxl_uuid *uuid)
+{
+    return uuid->uuid;
+}
+
 uint8_t *libxl_uuid_bytearray(libxl_uuid *uuid)
 {
     return uuid->uuid;
diff --git a/tools/libxl/libxl_uuid.h b/tools/libxl/libxl_uuid.h
index 93c65a7..fbde7b6 100644
--- a/tools/libxl/libxl_uuid.h
+++ b/tools/libxl/libxl_uuid.h
@@ -53,12 +53,13 @@ typedef struct {
 
 #endif
 
-int libxl_uuid_is_nil(libxl_uuid *uuid);
+int libxl_uuid_is_nil(const libxl_uuid *uuid);
 void libxl_uuid_generate(libxl_uuid *uuid);
 int libxl_uuid_from_string(libxl_uuid *uuid, const char *in);
 void libxl_uuid_copy(libxl_uuid *dst, const libxl_uuid *src);
 void libxl_uuid_clear(libxl_uuid *uuid);
-int libxl_uuid_compare(libxl_uuid *uuid1, libxl_uuid *uuid2);
+int libxl_uuid_compare(const libxl_uuid *uuid1, const libxl_uuid *uuid2);
+const uint8_t *libxl_uuid_bytearray_const(const libxl_uuid *uuid);
 uint8_t *libxl_uuid_bytearray(libxl_uuid *uuid);
 
 #endif /* __LIBXL_UUID_H__ */
-- 
1.7.10.4

  parent reply	other threads:[~2014-06-10 18:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-10 18:07 [PATCHv4 0/8] tools: rework VM Generation ID David Vrabel
2014-06-10 18:07 ` [PATCH 1/8] docs: update docs for the ~/platform/generation-id key David Vrabel
2014-06-10 18:07 ` [PATCH 2/8] hvm: add HVM_PARAM_VM_GENERATION_ID_ADDR David Vrabel
2014-06-12  9:19   ` Ian Campbell
2014-06-10 18:07 ` [PATCH 3/8] libxc: allow xc_get/set_hvm_param() to get/set 64-bit values David Vrabel
2014-06-12 10:01   ` Ian Campbell
2014-06-12 11:05     ` David Vrabel
2014-06-12 11:21       ` Ian Campbell
2014-06-12 11:31         ` David Vrabel
2014-06-10 18:07 ` David Vrabel [this message]
2014-06-12 10:31   ` [PATCH 4/8] libxl: const-ify libxl_uuid_*() API Ian Campbell
2014-06-10 18:07 ` [PATCH 5/8] hvmloader: add helper functions to get/set HVM params David Vrabel
2014-06-10 18:07 ` [PATCH 6/8] libxc, libxl, hvmloader: strip out outdated VM generation ID implementation David Vrabel
2014-06-10 18:07 ` [PATCH 7/8] libxl: allow a generation ID to be specified at domain creation David Vrabel
2014-06-10 18:07 ` [PATCH 8/8] xl: generate a new random VM generation ID if requested David Vrabel

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=1402423654-2721-5-git-send-email-david.vrabel@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.