diff mbox

[v2,for-4.7,09/14] xl: fix usage of libxl_get_scheduler

Message ID 1461682343-20597-10-git-send-email-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roger Pau Monné April 26, 2016, 2:52 p.m. UTC
It returns an int, not a libxl_scheduler.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/xl_cmdimpl.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Douglas Goldstein April 26, 2016, 3:21 p.m. UTC | #1
On 4/26/16 9:52 AM, Roger Pau Monne wrote:
> It returns an int, not a libxl_scheduler.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
Wei Liu April 26, 2016, 3:24 p.m. UTC | #2
On Tue, Apr 26, 2016 at 04:52:18PM +0200, Roger Pau Monne wrote:
> It returns an int, not a libxl_scheduler.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Wei Liu <wei.liu2@citrix.com>

At the risk of nitpicking too much, I think we should enforce more
consistent style, especially in xl which is already quite messy at the
moment.

> ---
>  tools/libxl/xl_cmdimpl.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index 8ff54e1..2ebca0a 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -5894,16 +5894,18 @@ static void output_xeninfo(void)
>  {
>      const libxl_version_info *info;
>      libxl_scheduler sched;
> +    int sched_rc;
>  

CODING_STYLE says that variable holds return value of libxl API should
be rc, so sched_rc should be rc.

>      if (!(info = libxl_get_version_info(ctx))) {
>          fprintf(stderr, "libxl_get_version_info failed.\n");
>          return;
>      }
>  
> -    if ((sched = libxl_get_scheduler(ctx)) < 0) {
> +    if ((sched_rc = libxl_get_scheduler(ctx)) < 0) {
>          fprintf(stderr, "get_scheduler sysctl failed.\n");
>          return;
>      }
> +    sched = sched_rc;
>  
>      printf("xen_major              : %d\n", info->xen_version_major);
>      printf("xen_minor              : %d\n", info->xen_version_minor);
> @@ -7991,7 +7993,7 @@ int main_cpupoolcreate(int argc, char **argv)
>      libxl_scheduler sched = 0;
>      XLU_ConfigList *cpus;
>      XLU_ConfigList *nodes;
> -    int n_cpus, n_nodes, i, n;
> +    int n_cpus, n_nodes, i, n, sched_rc;

Same here.

The code itself is fine.

Let me know if changing sched_rc to rc would cause a lot of troubles...

Wei.

>      libxl_bitmap freemap;
>      libxl_bitmap cpumap;
>      libxl_uuid uuid;
> @@ -8084,10 +8086,12 @@ int main_cpupoolcreate(int argc, char **argv)
>              goto out_cfg;
>          }
>      } else {
> -        if ((sched = libxl_get_scheduler(ctx)) < 0) {
> +        if ((sched_rc = libxl_get_scheduler(ctx)) < 0) {
>              fprintf(stderr, "get_scheduler sysctl failed.\n");
> +            rc = EXIT_FAILURE;
>              goto out_cfg;
>          }
> +        sched = sched_rc;
>      }
>  
>      if (libxl_get_freecpus(ctx, &freemap)) {
> -- 
> 2.6.4 (Apple Git-63)
>
diff mbox

Patch

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 8ff54e1..2ebca0a 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -5894,16 +5894,18 @@  static void output_xeninfo(void)
 {
     const libxl_version_info *info;
     libxl_scheduler sched;
+    int sched_rc;
 
     if (!(info = libxl_get_version_info(ctx))) {
         fprintf(stderr, "libxl_get_version_info failed.\n");
         return;
     }
 
-    if ((sched = libxl_get_scheduler(ctx)) < 0) {
+    if ((sched_rc = libxl_get_scheduler(ctx)) < 0) {
         fprintf(stderr, "get_scheduler sysctl failed.\n");
         return;
     }
+    sched = sched_rc;
 
     printf("xen_major              : %d\n", info->xen_version_major);
     printf("xen_minor              : %d\n", info->xen_version_minor);
@@ -7991,7 +7993,7 @@  int main_cpupoolcreate(int argc, char **argv)
     libxl_scheduler sched = 0;
     XLU_ConfigList *cpus;
     XLU_ConfigList *nodes;
-    int n_cpus, n_nodes, i, n;
+    int n_cpus, n_nodes, i, n, sched_rc;
     libxl_bitmap freemap;
     libxl_bitmap cpumap;
     libxl_uuid uuid;
@@ -8084,10 +8086,12 @@  int main_cpupoolcreate(int argc, char **argv)
             goto out_cfg;
         }
     } else {
-        if ((sched = libxl_get_scheduler(ctx)) < 0) {
+        if ((sched_rc = libxl_get_scheduler(ctx)) < 0) {
             fprintf(stderr, "get_scheduler sysctl failed.\n");
+            rc = EXIT_FAILURE;
             goto out_cfg;
         }
+        sched = sched_rc;
     }
 
     if (libxl_get_freecpus(ctx, &freemap)) {