Skip to contentSkip to conversation

libxl: format fd flags with 0x since they are hex.

PATCH In review Ian Campbell 3 participants 5 messages Sep 11, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: format fd flags with 0x since they are hex.

Commit 93f5194e7270 "libxl: clear O_NONBLOCK|O_NDELAY on migration fd and reinstate afterwards" added some logging of fcntl.F_GETFL at all as %x without a 0x prefix to make it clear they numbers are hex. Fix this alongwith an inadvertent logging of the fd itself as hex.

---
 tools/libxl/libxl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/libxl/libxl.c +4 -4
index d6efdd8..0ea7d9c 100644
@@ -6530,7 +6530,7 @@ int libxl__fd_flags_modify_save(libxl__gc *gc, int fd,
         goto out_err;
     }
 
-    LOG(DEBUG, "fnctl F_GETFL flags for fd %d are %x", fd, fdfl);
+    LOG(DEBUG, "fnctl F_GETFL flags for fd %d are 0x%x", fd, fdfl);
 
     if (r_oldflags)
         *r_oldflags = fdfl;
@@ -6538,7 +6538,7 @@ int libxl__fd_flags_modify_save(libxl__gc *gc, int fd,
     fdfl &= mask;
     fdfl |= val;
 
-    LOG(DEBUG, "fnctl F_SETFL of fd %d to %x", fd, fdfl);
+    LOG(DEBUG, "fnctl F_SETFL of fd %d to 0x%x", fd, fdfl);
 
     ret = fcntl(fd, F_SETFL, fdfl);
     if (ret < 0) {
@@ -6557,11 +6557,11 @@ int libxl__fd_flags_restore(libxl__gc *gc, int fd, int fdfl)
 {
     int ret, rc;
 
-    LOG(DEBUG, "fnctl F_SETFL of fd %d to %x", fd, fdfl);
+    LOG(DEBUG, "fnctl F_SETFL of fd %d to 0x%x", fd, fdfl);
 
     ret = fcntl(fd, F_SETFL, fdfl);
     if (ret < 0) {
-        LOGE(ERROR, "failed to fcntl.F_SETFL for fd %x", fd);
+        LOGE(ERROR, "failed to fcntl.F_SETFL for fd %d", fd);
         rc = ERROR_FAIL;
         goto out_err;
     }
Signature · 1 line
2.1.4
#1 lore raw
Quoted 7 lines · Ian Campbell

Commit 93f5194e7270 "libxl: clear O_NONBLOCK|O_NDELAY on migration fd and reinstate afterwards" added some logging of fcntl.F_GETFL at all as %x without a 0x prefix to make it clear they numbers are hex. Fix this alongwith an inadvertent logging of the fd itself as hex.

---

Forgot: for 4.6 because the patch which added the incorrect formatting was.

Quoted 42 lines
 tools/libxl/libxl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/libxl/libxl.c +1 -1
index d6efdd8..0ea7d9c 100644
@@ -6530,7 +6530,7 @@ int libxl__fd_flags_modify_save(libxl__gc *gc, int
 fd,
         goto out_err;
     }
 
-    LOG(DEBUG, "fnctl F_GETFL flags for fd %d are %x", fd, fdfl);
+    LOG(DEBUG, "fnctl F_GETFL flags for fd %d are 0x%x", fd, fdfl);
 
     if (r_oldflags)
         *r_oldflags = fdfl;
tools/libxl/libxl.c +1 -1
@@ -6538,7 +6538,7 @@ int libxl__fd_flags_modify_save(libxl__gc *gc, int
 fd,
     fdfl &= mask;
     fdfl |= val;
 
-    LOG(DEBUG, "fnctl F_SETFL of fd %d to %x", fd, fdfl);
+    LOG(DEBUG, "fnctl F_SETFL of fd %d to 0x%x", fd, fdfl);
 
     ret = fcntl(fd, F_SETFL, fdfl);
     if (ret < 0) {
tools/libxl/libxl.c +2 -2
@@ -6557,11 +6557,11 @@ int libxl__fd_flags_restore(libxl__gc *gc, int
 fd, int fdfl)
 {
     int ret, rc;
 
-    LOG(DEBUG, "fnctl F_SETFL of fd %d to %x", fd, fdfl);
+    LOG(DEBUG, "fnctl F_SETFL of fd %d to 0x%x", fd, fdfl);
 
     ret = fcntl(fd, F_SETFL, fdfl);
     if (ret < 0) {
-        LOGE(ERROR, "failed to fcntl.F_SETFL for fd %x", fd);
+        LOGE(ERROR, "failed to fcntl.F_SETFL for fd %d", fd);
         rc = ERROR_FAIL;
         goto out_err;
     }
Acked-by on v1 1/1
#2 lore raw
In reply to Ian Campbell
Quoted 6 lines · Ian Campbell

Commit 93f5194e7270 "libxl: clear O_NONBLOCK|O_NDELAY on migration fd and reinstate afterwards" added some logging of fcntl.F_GETFL at all as %x without a 0x prefix to make it clear they numbers are hex. Fix this alongwith an inadvertent logging of the fd itself as hex.

Quoted 42 lines
---
 tools/libxl/libxl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/libxl/libxl.c +4 -4
index d6efdd8..0ea7d9c 100644
@@ -6530,7 +6530,7 @@ int libxl__fd_flags_modify_save(libxl__gc *gc, int fd,
         goto out_err;
     }
 
-    LOG(DEBUG, "fnctl F_GETFL flags for fd %d are %x", fd, fdfl);
+    LOG(DEBUG, "fnctl F_GETFL flags for fd %d are 0x%x", fd, fdfl);
 
     if (r_oldflags)
         *r_oldflags = fdfl;
@@ -6538,7 +6538,7 @@ int libxl__fd_flags_modify_save(libxl__gc *gc, int fd,
     fdfl &= mask;
     fdfl |= val;
 
-    LOG(DEBUG, "fnctl F_SETFL of fd %d to %x", fd, fdfl);
+    LOG(DEBUG, "fnctl F_SETFL of fd %d to 0x%x", fd, fdfl);
 
     ret = fcntl(fd, F_SETFL, fdfl);
     if (ret < 0) {
@@ -6557,11 +6557,11 @@ int libxl__fd_flags_restore(libxl__gc *gc, int fd, int fdfl)
 {
     int ret, rc;
 
-    LOG(DEBUG, "fnctl F_SETFL of fd %d to %x", fd, fdfl);
+    LOG(DEBUG, "fnctl F_SETFL of fd %d to 0x%x", fd, fdfl);
 
     ret = fcntl(fd, F_SETFL, fdfl);
     if (ret < 0) {
-        LOGE(ERROR, "failed to fcntl.F_SETFL for fd %x", fd);
+        LOGE(ERROR, "failed to fcntl.F_SETFL for fd %d", fd);
         rc = ERROR_FAIL;
         goto out_err;
     }
Signature · 1 line
2.1.4
author Applied
#3 lore raw
Quoted 9 lines · Wei Liu
Quoted 6 lines · Ian Campbell

Commit 93f5194e7270 "libxl: clear O_NONBLOCK|O_NDELAY on migration fd and reinstate afterwards" added some logging of fcntl.F_GETFL at all as %x without a 0x prefix to make it clear they numbers are hex. Fix this alongwith an inadvertent logging of the fd itself as hex.

Applied to staging and 4.6.

Thankis
Ian.

Quoted 44 lines
Quoted 44 lines
---
 tools/libxl/libxl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/libxl/libxl.c +1 -1
index d6efdd8..0ea7d9c 100644
@@ -6530,7 +6530,7 @@ int libxl__fd_flags_modify_save(libxl__gc *gc,
 int fd,
         goto out_err;
     }
 
-    LOG(DEBUG, "fnctl F_GETFL flags for fd %d are %x", fd, fdfl);
+    LOG(DEBUG, "fnctl F_GETFL flags for fd %d are 0x%x", fd, fdfl);
 
     if (r_oldflags)
         *r_oldflags = fdfl;
tools/libxl/libxl.c +1 -1
@@ -6538,7 +6538,7 @@ int libxl__fd_flags_modify_save(libxl__gc *gc,
 int fd,
     fdfl &= mask;
     fdfl |= val;
 
-    LOG(DEBUG, "fnctl F_SETFL of fd %d to %x", fd, fdfl);
+    LOG(DEBUG, "fnctl F_SETFL of fd %d to 0x%x", fd, fdfl);
 
     ret = fcntl(fd, F_SETFL, fdfl);
     if (ret < 0) {
tools/libxl/libxl.c +2 -2
@@ -6557,11 +6557,11 @@ int libxl__fd_flags_restore(libxl__gc *gc, int
 fd, int fdfl)
 {
     int ret, rc;
 
-    LOG(DEBUG, "fnctl F_SETFL of fd %d to %x", fd, fdfl);
+    LOG(DEBUG, "fnctl F_SETFL of fd %d to 0x%x", fd, fdfl);
 
     ret = fcntl(fd, F_SETFL, fdfl);
     if (ret < 0) {
-        LOGE(ERROR, "failed to fcntl.F_SETFL for fd %x", fd);
+        LOGE(ERROR, "failed to fcntl.F_SETFL for fd %d", fd);
         rc = ERROR_FAIL;
         goto out_err;
     }
Acked-by on v1 1/1
#4 lore raw
In reply to Ian Campbell

Ian Campbell writes ("[PATCH for-4.6] libxl: format fd flags with 0x since they are hex."):

Quoted 4 lines

Commit 93f5194e7270 "libxl: clear O_NONBLOCK|O_NDELAY on migration fd and reinstate afterwards" added some logging of fcntl.F_GETFL at all as %x without a 0x prefix to make it clear they numbers are hex. Fix this alongwith an inadvertent logging of the fd itself as hex.

Thanks to Andrew Cooper for spotting this and sorry that I didn't.

Ian.