|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2/4] libxl_get_scheduler() cannot return ERROR_FAIL
ERROR_FAIL (-3) is not a proper value for
libxl_scheduler enum.
Use LIBXL_SCHEDULER_UNKNOWN (0) instead.
Clang complains otherwise:
xl_cmdimpl.c:4824:44: error: comparison of unsigned enum expression < 0 is
always false [-Werror,-Wtautological-compare]
if ((sched = libxl_get_scheduler(ctx)) < 0) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
xl_cmdimpl.c:6705:48: error: comparison of unsigned enum expression < 0 is
always false [-Werror,-Wtautological-compare]
if ((sched = libxl_get_scheduler(ctx)) < 0) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
C99 does not guarantee that enums are ints (they
can be unsigned).
---
tools/libxl/libxl.c | 2 +-
tools/libxl/xl_cmdimpl.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index ad3495a..785a1e7 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -4957,7 +4957,7 @@ libxl_scheduler libxl_get_scheduler(libxl_ctx *ctx)
if ((ret = xc_sched_id(ctx->xch, (int *)&sched)) != 0) {
LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting domain info list");
- return ERROR_FAIL;
+ return LIBXL_SCHEDULER_UNKNOWN;
}
return sched;
}
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 8a38077..86daf8e 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -4821,7 +4821,7 @@ static void output_xeninfo(void)
return;
}
- if ((sched = libxl_get_scheduler(ctx)) < 0) {
+ if ((sched = libxl_get_scheduler(ctx)) == LIBXL_SCHEDULER_UNKNOWN) {
fprintf(stderr, "get_scheduler sysctl failed.\n");
return;
}
@@ -6702,7 +6702,7 @@ int main_cpupoolcreate(int argc, char **argv)
goto out_cfg;
}
} else {
- if ((sched = libxl_get_scheduler(ctx)) < 0) {
+ if ((sched = libxl_get_scheduler(ctx)) == LIBXL_SCHEDULER_UNKNOWN) {
fprintf(stderr, "get_scheduler sysctl failed.\n");
goto out_cfg;
}
--
2.0.2
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |