Skip to contentSkip to conversation

libxl: tidy libxl_get_scheduler() according to CODING_STYLE

PATCH Applied Chester Lin 2 participants 3 messages Jan 25, 2016 – Jan 26, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/5 libxl: tidy libxl_get_scheduler() according to CODING_STYLE

To more closely follow the guidelines in CODING_STYLE, store the result of xc_sched_id() in the local variable r, and the check the result of the call in a separate statement. Change the type of the output parameter given to xc_sched_id() from libxl_scheduler to int to match the libxc interface.

Additionally, change the error log statement to more accurately reflect the failure. This is the only functional change introduced by this patch.

---
Now storing the return of xc_sched_id in an int as per

Quoted 2 lines · Ian Campbell

Safer (and cleaner looking even if I'm wrong) would be to use a temporary int for the function call and turn it into an enum implicitly in the return

---
 tools/libxl/libxl.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
tools/libxl/libxl.c +5 -3
index 9207621..7f28af8 100644
@@ -5585,10 +5585,12 @@ out:
 
 libxl_scheduler libxl_get_scheduler(libxl_ctx *ctx)
 {
-    libxl_scheduler sched, ret;
+    int r, sched;
+
     GC_INIT(ctx);
-    if ((ret = xc_sched_id(ctx->xch, (int *)&sched)) != 0) {
-        LOGE(ERROR, "getting domain info list");
+    r = xc_sched_id(ctx->xch, &sched);
+    if (r != 0) {
+        LOGE(ERROR, "getting current scheduler id");
         return ERROR_FAIL;
         GC_FREE;
     }
Signature · 1 line
1.9.5.msysgit.0
Acked-by on v3 1/5
#1 lore raw
Quoted 6 lines · Chester Lin

To more closely follow the guidelines in CODING_STYLE, store the result of xc_sched_id() in the local variable r, and the check the result of the call in a separate statement.  Change the type of the output parameter given to xc_sched_id() from libxl_scheduler to int to match the libxc interface.

Quoted 7 lines

Additionally, change the error log statement to more accurately reflect the failure.  This is the only functional change introduced by this patch.

Quoted 24 lines

---
Now storing the return of xc_sched_id in an int as per
  On Mon, 2016-01-04 at 16:23 +0000, Ian Campbell wrote:
  >Safer (and cleaner looking even if I'm wrong) would be to use a temporary
  >int for the function call and turn it into an enum implicitly in the return
---
 tools/libxl/libxl.c | 8 +++++---

 1 file changed, 5 insertions(+), 3 deletions(-)
tools/libxl/libxl.c +0 -0
index 9207621..7f28af8 100644
@@ -5585,10 +5585,12 @@ out:


 libxl_scheduler libxl_get_scheduler(libxl_ctx *ctx) {
-    libxl_scheduler sched, ret;
+    int r, sched;
+
     GC_INIT(ctx);

Quoted 8 lines

-    if ((ret = xc_sched_id(ctx->xch, (int *)&sched)) != 0) { -        LOGE(ERROR, "getting domain info list");
+    r = xc_sched_id(ctx->xch, &sched);
+    if (r != 0) {
+        LOGE(ERROR, "getting current scheduler id"); return ERROR_FAIL;
         GC_FREE;
     }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Applied
#2 lore raw
Quoted 11 lines · Ian Campbell
Quoted 10 lines · Chester Lin

To more closely follow the guidelines in CODING_STYLE, store the result of xc_sched_id() in the local variable r, and the check the result of the call in a separate statement.  Change the type of the output parameter given to xc_sched_id() from libxl_scheduler to int to match the libxc interface.

Additionally, change the error log statement to more accurately reflect the failure.  This is the only functional change introduced by this patch.

Quoted 5 lines
Quoted 3 lines

Applied, thanks.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel