All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools/xl: Use %u for uint32_t domids
@ 2016-10-17  0:16 Ronald Rojas
  2016-10-17 12:15 ` Wei Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Ronald Rojas @ 2016-10-17  0:16 UTC (permalink / raw)
  To: xen-devel, ian.jackson, wei.liu2, george.dunlap; +Cc: Ronald Rojas

domid is normally represented by uint32_t, but many format
strings in xl_cmdimpl.c use %d when printing, which is signed.
Use %u instead to print the unsigned integer domid.

Signed-off-by: Ronald Rojas <ronladred@gmail.com>
---
 tools/libxl/xl_cmdimpl.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index cb43c00..b154e36 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -2674,7 +2674,7 @@ static int preserve_domain(uint32_t *r_domid, libxl_event *event,
 
     libxl_uuid_generate(&new_uuid);
 
-    LOG("Preserving domain %d %s with suffix%s",
+    LOG("Preserving domain %u %s with suffix%s",
         *r_domid, d_config->c_info.name, strtime);
     rc = libxl_domain_preserve(ctx, *r_domid, &d_config->c_info,
                                strtime, new_uuid);
@@ -2758,7 +2758,7 @@ static int domain_wait_event(uint32_t domid, libxl_event **event_r)
     for (;;) {
         ret = libxl_event_wait(ctx, event_r, LIBXL_EVENTMASK_ALL, 0,0);
         if (ret) {
-            LOG("Domain %d, failed to get event, quitting (rc=%d)", domid, ret);
+            LOG("Domain %u, failed to get event, quitting (rc=%d)", domid, ret);
             return ret;
         }
         if ((*event_r)->domid != domid) {
@@ -3108,7 +3108,7 @@ start:
         }
         need_daemon = 0;
     }
-    LOG("Waiting for domain %s (domid %d) to die [pid %ld]",
+    LOG("Waiting for domain %s (domid %u) to die [pid %ld]",
         d_config.c_info.name, domid, (long)getpid());
 
     ret = libxl_evenable_domain_death(ctx, domid, 0, &deathw);
@@ -3134,7 +3134,7 @@ start:
         switch (event->type) {
 
         case LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN:
-            LOG("Domain %d has shut down, reason code %d 0x%x", domid,
+            LOG("Domain %u has shut down, reason code %d 0x%x", domid,
                 event->u.domain_shutdown.shutdown_reason,
                 event->u.domain_shutdown.shutdown_reason);
             switch (handle_domain_death(&domid, event, &d_config)) {
@@ -3198,7 +3198,7 @@ start:
             }
 
         case LIBXL_EVENT_TYPE_DOMAIN_DEATH:
-            LOG("Domain %d has been destroyed.", domid);
+            LOG("Domain %u has been destroyed.", domid);
             libxl_event_free(ctx, event);
             ret = 0;
             goto out;
@@ -3442,7 +3442,7 @@ static int set_memory_max(uint32_t domid, const char *mem)
     }
 
     if (libxl_domain_setmaxmem(ctx, domid, memorykb)) {
-        fprintf(stderr, "cannot set domid %d static max memory to : %s\n", domid, mem);
+        fprintf(stderr, "cannot set domid %u static max memory to : %s\n", domid, mem);
         return EXIT_FAILURE;
     }
 
@@ -3476,7 +3476,7 @@ static int set_memory_target(uint32_t domid, const char *mem)
     }
 
     if (libxl_set_memory_target(ctx, domid, memorykb, 0, /* enforce */ 1)) {
-        fprintf(stderr, "cannot set domid %d dynamic max memory to : %s\n", domid, mem);
+        fprintf(stderr, "cannot set domid %u dynamic max memory to : %s\n", domid, mem);
         return EXIT_FAILURE;
     }
 
@@ -4133,7 +4133,7 @@ static void shutdown_domain(uint32_t domid,
 {
     int rc;
 
-    fprintf(stderr, "Shutting down domain %d\n", domid);
+    fprintf(stderr, "Shutting down domain %u\n", domid);
     rc=libxl_domain_shutdown(ctx, domid);
     if (rc == ERROR_NOPARAVIRT) {
         if (fallback_trigger) {
@@ -4165,7 +4165,7 @@ static void reboot_domain(uint32_t domid, libxl_evgen_domain_death **deathw,
 {
     int rc;
 
-    fprintf(stderr, "Rebooting domain %d\n", domid);
+    fprintf(stderr, "Rebooting domain %u\n", domid);
     rc=libxl_domain_reboot(ctx, domid);
     if (rc == ERROR_NOPARAVIRT) {
         if (fallback_trigger) {
@@ -5625,7 +5625,7 @@ int main_config_update(int argc, char **argv)
         printf_info(default_output_format, -1, &d_config, stdout);
 
     if (!dryrun_only) {
-        fprintf(stderr, "setting dom%d configuration\n", domid);
+        fprintf(stderr, "setting dom%u configuration\n", domid);
         rc = libxl_userdata_store(ctx, domid, "xl",
                                    config_data, config_len);
         if (rc) {
@@ -5951,7 +5951,7 @@ static int vcpuset(uint32_t domid, const char* nr_vcpus, int check_host)
     if (rc == ERROR_DOMAIN_NOTFOUND)
         fprintf(stderr, "Domain %u does not exist.\n", domid);
     else if (rc)
-        fprintf(stderr, "libxl_set_vcpuonline failed domid=%d max_vcpus=%d," \
+        fprintf(stderr, "libxl_set_vcpuonline failed domid=%u max_vcpus=%d," \
                 " rc: %d\n", domid, max_vcpus, rc);
 
     libxl_bitmap_dispose(&cpumap);
@@ -7113,7 +7113,7 @@ int main_domid(int argc, char **argv)
         return EXIT_FAILURE;
     }
 
-    printf("%d\n", domid);
+    printf("%u\n", domid);
 
     return EXIT_SUCCESS;
 }
@@ -7138,7 +7138,7 @@ int main_domname(int argc, char **argv)
 
     domname = libxl_domid_to_name(ctx, domid);
     if (!domname) {
-        fprintf(stderr, "Can't get domain name of domain id '%d', maybe this domain does not exist.\n", domid);
+        fprintf(stderr, "Can't get domain name of domain id '%u', maybe this domain does not exist.\n", domid);
         return EXIT_FAILURE;
     }
 
-- 
2.7.4


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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] tools/xl: Use %u for uint32_t domids
  2016-10-17  0:16 [PATCH] tools/xl: Use %u for uint32_t domids Ronald Rojas
@ 2016-10-17 12:15 ` Wei Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Wei Liu @ 2016-10-17 12:15 UTC (permalink / raw)
  To: Ronald Rojas; +Cc: wei.liu2, ian.jackson, george.dunlap, xen-devel

On Sun, Oct 16, 2016 at 08:16:32PM -0400, Ronald Rojas wrote:
> domid is normally represented by uint32_t, but many format
> strings in xl_cmdimpl.c use %d when printing, which is signed.
> Use %u instead to print the unsigned integer domid.
> 
> Signed-off-by: Ronald Rojas <ronladred@gmail.com>

Acked + applied.

Congratulations on getting your first contribution into Xen.

Wei. 

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tools/xl: Use %u for uint32_t domids
  2016-10-16 23:31 Ronald Rojas
@ 2016-10-17  9:07 ` George Dunlap
  0 siblings, 0 replies; 4+ messages in thread
From: George Dunlap @ 2016-10-17  9:07 UTC (permalink / raw)
  To: Ronald Rojas; +Cc: Wei Liu, xen-devel

On Mon, Oct 17, 2016 at 12:31 AM, Ronald Rojas <ronladred@gmail.com> wrote:
> domid is normally represented by uint32_t, but many format
> strings in xl_cmdimpl.c use %d when printing, which is signed.
> Use %u instead to print the unsigned integer domid.
>
> Signed-off-by: Ronald Rojas <ronladred@gmail.com>
> ---

Hey Ronald!  Just to answer the question you asked on IRC about
mis-typing the e-mail address:

Sending it again is fine, but something which would have been simpler
would be to reply to the original message, including all the current
recipients, and adding in the person whom you meant to CC in the first
place.  All the maintainers are actually on the mailing list, and will
have received the original e-mail -- the CC is just to make it easier
for them to spot that there's something they need to look at. :-)

While we're at it, there's another tip for sending mail:

1. If anywhere in your commit message you have a line starting with
"CC:", `git send-email` will automatically CC that person.  e.g.:

CC: Ian Jackson <ian.jackson@eu.citrix.com>

2. If you put it below a line starting with `---` (as just above),
then those lines will automatically be removed when the person
committing it imports it into git.

So if you structure your commit message like this in git:

tools/xl: Do foo

Slightly longer description here

Signed-off-by: xxx
---
CC: George Dunlap <george.dunlap@citrix.com>
CC: ...

Then you don't need to re-type the e-mail addresses every time you
re-send a new version of the patch.

Peace,
 -George


>  tools/libxl/xl_cmdimpl.c | 26 +++++++++++++-------------
>  1 file changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index cb43c00..b154e36 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -2674,7 +2674,7 @@ static int preserve_domain(uint32_t *r_domid, libxl_event *event,
>
>      libxl_uuid_generate(&new_uuid);
>
> -    LOG("Preserving domain %d %s with suffix%s",
> +    LOG("Preserving domain %u %s with suffix%s",
>          *r_domid, d_config->c_info.name, strtime);
>      rc = libxl_domain_preserve(ctx, *r_domid, &d_config->c_info,
>                                 strtime, new_uuid);
> @@ -2758,7 +2758,7 @@ static int domain_wait_event(uint32_t domid, libxl_event **event_r)
>      for (;;) {
>          ret = libxl_event_wait(ctx, event_r, LIBXL_EVENTMASK_ALL, 0,0);
>          if (ret) {
> -            LOG("Domain %d, failed to get event, quitting (rc=%d)", domid, ret);
> +            LOG("Domain %u, failed to get event, quitting (rc=%d)", domid, ret);
>              return ret;
>          }
>          if ((*event_r)->domid != domid) {
> @@ -3108,7 +3108,7 @@ start:
>          }
>          need_daemon = 0;
>      }
> -    LOG("Waiting for domain %s (domid %d) to die [pid %ld]",
> +    LOG("Waiting for domain %s (domid %u) to die [pid %ld]",
>          d_config.c_info.name, domid, (long)getpid());
>
>      ret = libxl_evenable_domain_death(ctx, domid, 0, &deathw);
> @@ -3134,7 +3134,7 @@ start:
>          switch (event->type) {
>
>          case LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN:
> -            LOG("Domain %d has shut down, reason code %d 0x%x", domid,
> +            LOG("Domain %u has shut down, reason code %d 0x%x", domid,
>                  event->u.domain_shutdown.shutdown_reason,
>                  event->u.domain_shutdown.shutdown_reason);
>              switch (handle_domain_death(&domid, event, &d_config)) {
> @@ -3198,7 +3198,7 @@ start:
>              }
>
>          case LIBXL_EVENT_TYPE_DOMAIN_DEATH:
> -            LOG("Domain %d has been destroyed.", domid);
> +            LOG("Domain %u has been destroyed.", domid);
>              libxl_event_free(ctx, event);
>              ret = 0;
>              goto out;
> @@ -3442,7 +3442,7 @@ static int set_memory_max(uint32_t domid, const char *mem)
>      }
>
>      if (libxl_domain_setmaxmem(ctx, domid, memorykb)) {
> -        fprintf(stderr, "cannot set domid %d static max memory to : %s\n", domid, mem);
> +        fprintf(stderr, "cannot set domid %u static max memory to : %s\n", domid, mem);
>          return EXIT_FAILURE;
>      }
>
> @@ -3476,7 +3476,7 @@ static int set_memory_target(uint32_t domid, const char *mem)
>      }
>
>      if (libxl_set_memory_target(ctx, domid, memorykb, 0, /* enforce */ 1)) {
> -        fprintf(stderr, "cannot set domid %d dynamic max memory to : %s\n", domid, mem);
> +        fprintf(stderr, "cannot set domid %u dynamic max memory to : %s\n", domid, mem);
>          return EXIT_FAILURE;
>      }
>
> @@ -4133,7 +4133,7 @@ static void shutdown_domain(uint32_t domid,
>  {
>      int rc;
>
> -    fprintf(stderr, "Shutting down domain %d\n", domid);
> +    fprintf(stderr, "Shutting down domain %u\n", domid);
>      rc=libxl_domain_shutdown(ctx, domid);
>      if (rc == ERROR_NOPARAVIRT) {
>          if (fallback_trigger) {
> @@ -4165,7 +4165,7 @@ static void reboot_domain(uint32_t domid, libxl_evgen_domain_death **deathw,
>  {
>      int rc;
>
> -    fprintf(stderr, "Rebooting domain %d\n", domid);
> +    fprintf(stderr, "Rebooting domain %u\n", domid);
>      rc=libxl_domain_reboot(ctx, domid);
>      if (rc == ERROR_NOPARAVIRT) {
>          if (fallback_trigger) {
> @@ -5625,7 +5625,7 @@ int main_config_update(int argc, char **argv)
>          printf_info(default_output_format, -1, &d_config, stdout);
>
>      if (!dryrun_only) {
> -        fprintf(stderr, "setting dom%d configuration\n", domid);
> +        fprintf(stderr, "setting dom%u configuration\n", domid);
>          rc = libxl_userdata_store(ctx, domid, "xl",
>                                     config_data, config_len);
>          if (rc) {
> @@ -5951,7 +5951,7 @@ static int vcpuset(uint32_t domid, const char* nr_vcpus, int check_host)
>      if (rc == ERROR_DOMAIN_NOTFOUND)
>          fprintf(stderr, "Domain %u does not exist.\n", domid);
>      else if (rc)
> -        fprintf(stderr, "libxl_set_vcpuonline failed domid=%d max_vcpus=%d," \
> +        fprintf(stderr, "libxl_set_vcpuonline failed domid=%u max_vcpus=%d," \
>                  " rc: %d\n", domid, max_vcpus, rc);
>
>      libxl_bitmap_dispose(&cpumap);
> @@ -7113,7 +7113,7 @@ int main_domid(int argc, char **argv)
>          return EXIT_FAILURE;
>      }
>
> -    printf("%d\n", domid);
> +    printf("%u\n", domid);
>
>      return EXIT_SUCCESS;
>  }
> @@ -7138,7 +7138,7 @@ int main_domname(int argc, char **argv)
>
>      domname = libxl_domid_to_name(ctx, domid);
>      if (!domname) {
> -        fprintf(stderr, "Can't get domain name of domain id '%d', maybe this domain does not exist.\n", domid);
> +        fprintf(stderr, "Can't get domain name of domain id '%u', maybe this domain does not exist.\n", domid);
>          return EXIT_FAILURE;
>      }
>
> --
> 2.7.4
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] tools/xl: Use %u for uint32_t domids
@ 2016-10-16 23:31 Ronald Rojas
  2016-10-17  9:07 ` George Dunlap
  0 siblings, 1 reply; 4+ messages in thread
From: Ronald Rojas @ 2016-10-16 23:31 UTC (permalink / raw)
  To: xen-devel, ian.jackson, wei.liu2, george.dunlap; +Cc: Ronald Rojas

domid is normally represented by uint32_t, but many format
strings in xl_cmdimpl.c use %d when printing, which is signed.
Use %u instead to print the unsigned integer domid.

Signed-off-by: Ronald Rojas <ronladred@gmail.com>
---
 tools/libxl/xl_cmdimpl.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index cb43c00..b154e36 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -2674,7 +2674,7 @@ static int preserve_domain(uint32_t *r_domid, libxl_event *event,
 
     libxl_uuid_generate(&new_uuid);
 
-    LOG("Preserving domain %d %s with suffix%s",
+    LOG("Preserving domain %u %s with suffix%s",
         *r_domid, d_config->c_info.name, strtime);
     rc = libxl_domain_preserve(ctx, *r_domid, &d_config->c_info,
                                strtime, new_uuid);
@@ -2758,7 +2758,7 @@ static int domain_wait_event(uint32_t domid, libxl_event **event_r)
     for (;;) {
         ret = libxl_event_wait(ctx, event_r, LIBXL_EVENTMASK_ALL, 0,0);
         if (ret) {
-            LOG("Domain %d, failed to get event, quitting (rc=%d)", domid, ret);
+            LOG("Domain %u, failed to get event, quitting (rc=%d)", domid, ret);
             return ret;
         }
         if ((*event_r)->domid != domid) {
@@ -3108,7 +3108,7 @@ start:
         }
         need_daemon = 0;
     }
-    LOG("Waiting for domain %s (domid %d) to die [pid %ld]",
+    LOG("Waiting for domain %s (domid %u) to die [pid %ld]",
         d_config.c_info.name, domid, (long)getpid());
 
     ret = libxl_evenable_domain_death(ctx, domid, 0, &deathw);
@@ -3134,7 +3134,7 @@ start:
         switch (event->type) {
 
         case LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN:
-            LOG("Domain %d has shut down, reason code %d 0x%x", domid,
+            LOG("Domain %u has shut down, reason code %d 0x%x", domid,
                 event->u.domain_shutdown.shutdown_reason,
                 event->u.domain_shutdown.shutdown_reason);
             switch (handle_domain_death(&domid, event, &d_config)) {
@@ -3198,7 +3198,7 @@ start:
             }
 
         case LIBXL_EVENT_TYPE_DOMAIN_DEATH:
-            LOG("Domain %d has been destroyed.", domid);
+            LOG("Domain %u has been destroyed.", domid);
             libxl_event_free(ctx, event);
             ret = 0;
             goto out;
@@ -3442,7 +3442,7 @@ static int set_memory_max(uint32_t domid, const char *mem)
     }
 
     if (libxl_domain_setmaxmem(ctx, domid, memorykb)) {
-        fprintf(stderr, "cannot set domid %d static max memory to : %s\n", domid, mem);
+        fprintf(stderr, "cannot set domid %u static max memory to : %s\n", domid, mem);
         return EXIT_FAILURE;
     }
 
@@ -3476,7 +3476,7 @@ static int set_memory_target(uint32_t domid, const char *mem)
     }
 
     if (libxl_set_memory_target(ctx, domid, memorykb, 0, /* enforce */ 1)) {
-        fprintf(stderr, "cannot set domid %d dynamic max memory to : %s\n", domid, mem);
+        fprintf(stderr, "cannot set domid %u dynamic max memory to : %s\n", domid, mem);
         return EXIT_FAILURE;
     }
 
@@ -4133,7 +4133,7 @@ static void shutdown_domain(uint32_t domid,
 {
     int rc;
 
-    fprintf(stderr, "Shutting down domain %d\n", domid);
+    fprintf(stderr, "Shutting down domain %u\n", domid);
     rc=libxl_domain_shutdown(ctx, domid);
     if (rc == ERROR_NOPARAVIRT) {
         if (fallback_trigger) {
@@ -4165,7 +4165,7 @@ static void reboot_domain(uint32_t domid, libxl_evgen_domain_death **deathw,
 {
     int rc;
 
-    fprintf(stderr, "Rebooting domain %d\n", domid);
+    fprintf(stderr, "Rebooting domain %u\n", domid);
     rc=libxl_domain_reboot(ctx, domid);
     if (rc == ERROR_NOPARAVIRT) {
         if (fallback_trigger) {
@@ -5625,7 +5625,7 @@ int main_config_update(int argc, char **argv)
         printf_info(default_output_format, -1, &d_config, stdout);
 
     if (!dryrun_only) {
-        fprintf(stderr, "setting dom%d configuration\n", domid);
+        fprintf(stderr, "setting dom%u configuration\n", domid);
         rc = libxl_userdata_store(ctx, domid, "xl",
                                    config_data, config_len);
         if (rc) {
@@ -5951,7 +5951,7 @@ static int vcpuset(uint32_t domid, const char* nr_vcpus, int check_host)
     if (rc == ERROR_DOMAIN_NOTFOUND)
         fprintf(stderr, "Domain %u does not exist.\n", domid);
     else if (rc)
-        fprintf(stderr, "libxl_set_vcpuonline failed domid=%d max_vcpus=%d," \
+        fprintf(stderr, "libxl_set_vcpuonline failed domid=%u max_vcpus=%d," \
                 " rc: %d\n", domid, max_vcpus, rc);
 
     libxl_bitmap_dispose(&cpumap);
@@ -7113,7 +7113,7 @@ int main_domid(int argc, char **argv)
         return EXIT_FAILURE;
     }
 
-    printf("%d\n", domid);
+    printf("%u\n", domid);
 
     return EXIT_SUCCESS;
 }
@@ -7138,7 +7138,7 @@ int main_domname(int argc, char **argv)
 
     domname = libxl_domid_to_name(ctx, domid);
     if (!domname) {
-        fprintf(stderr, "Can't get domain name of domain id '%d', maybe this domain does not exist.\n", domid);
+        fprintf(stderr, "Can't get domain name of domain id '%u', maybe this domain does not exist.\n", domid);
         return EXIT_FAILURE;
     }
 
-- 
2.7.4


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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-17 12:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-17  0:16 [PATCH] tools/xl: Use %u for uint32_t domids Ronald Rojas
2016-10-17 12:15 ` Wei Liu
  -- strict thread matches above, loose matches on Subject: below --
2016-10-16 23:31 Ronald Rojas
2016-10-17  9:07 ` George Dunlap

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.