Skip to contentSkip to conversation

qemu-socket: Polish errors for connect() and listen() failure

PATCH Applied Markus Armbruster 3 participants 6 messages Sep 19, 2014 – Sep 26, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu-socket: Polish errors for connect() and listen() failure

connect() doesn't "connect to socket", it connects a socket to an address and, if it's of type SOCK_STREAM, initiates a connection. Scratch "to".

listen() does "set socket to listening mode", but it sounds awkward. Change to "listen on socket".

---
 include/qapi/qmp/qerror.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/qapi/qmp/qerror.h +2 -2
index 902d1a7..774e75d 100644
@@ -155,10 +155,10 @@ void qerror_report_err(Error *err);
     ERROR_CLASS_GENERIC_ERROR, "this feature or command is not currently supported"
 
 #define QERR_SOCKET_CONNECT_FAILED \
-    ERROR_CLASS_GENERIC_ERROR, "Failed to connect to socket"
+    ERROR_CLASS_GENERIC_ERROR, "Failed to connect socket"
 
 #define QERR_SOCKET_LISTEN_FAILED \
-    ERROR_CLASS_GENERIC_ERROR, "Failed to set socket to listening mode"
+    ERROR_CLASS_GENERIC_ERROR, "Failed to listen on socket"
 
 #define QERR_SOCKET_BIND_FAILED \
     ERROR_CLASS_GENERIC_ERROR, "Failed to bind socket"
Signature · 1 line
1.9.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines

Subject: [Qemu-devel] [PATCH] qemu-socket: Polish errors for connect() and listen() failure

connect() doesn't "connect to socket", it connects a socket to an address and, if it's of type SOCK_STREAM, initiates a connection. Scratch "to".

Quoted 8 lines

listen() does "set socket to listening mode", but it sounds awkward. Change to "listen on socket".

---
 include/qapi/qmp/qerror.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

And Cc'ing qemu-trivial@

Best regards,
-Gonglei

Quoted 21 lines
include/qapi/qmp/qerror.h +0 -0
index 902d1a7..774e75d 100644
@@ -155,10 +155,10 @@ void qerror_report_err(Error *err);
     ERROR_CLASS_GENERIC_ERROR, "this feature or command is not

currently supported"

#define QERR_SOCKET_CONNECT_FAILED \

include/qapi/qmp/qerror.h +2 -3
-    ERROR_CLASS_GENERIC_ERROR, "Failed to connect to socket"
+    ERROR_CLASS_GENERIC_ERROR, "Failed to connect socket"
 
 #define QERR_SOCKET_LISTEN_FAILED \
-    ERROR_CLASS_GENERIC_ERROR, "Failed to set socket to listening mode"
+    ERROR_CLASS_GENERIC_ERROR, "Failed to listen on socket"
 
 #define QERR_SOCKET_BIND_FAILED \
     ERROR_CLASS_GENERIC_ERROR, "Failed to bind socket"
--

1.9.3

#2 lore raw
In reply to Markus Armbruster
Quoted 19 lines · On Fri, 19 Sep 2014 09:27:04 +0200 Markus Armbruster <[email protected]> wrote:

connect() doesn't "connect to socket", it connects a socket to an address and, if it's of type SOCK_STREAM, initiates a connection. Scratch "to".

listen() does "set socket to listening mode", but it sounds awkward. Change to "listen on socket".

---
 include/qapi/qmp/qerror.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/qapi/qmp/qerror.h +0 -0
index 902d1a7..774e75d 100644
@@ -155,10 +155,10 @@ void qerror_report_err(Error *err);
     ERROR_CLASS_GENERIC_ERROR, "this feature or command is not currently supported"
 

include/qapi/qmp/qerror.h void qerror_report_err(Error *err); · line 164

Quoted 10 lines
include/qapi/qmp/qerror.h +2 -2
 #define QERR_SOCKET_CONNECT_FAILED \
-    ERROR_CLASS_GENERIC_ERROR, "Failed to connect to socket"
+    ERROR_CLASS_GENERIC_ERROR, "Failed to connect socket"
 
 #define QERR_SOCKET_LISTEN_FAILED \
-    ERROR_CLASS_GENERIC_ERROR, "Failed to set socket to listening mode"
+    ERROR_CLASS_GENERIC_ERROR, "Failed to listen on socket"
 
 #define QERR_SOCKET_BIND_FAILED \
     ERROR_CLASS_GENERIC_ERROR, "Failed to bind socket"

The word fixing is good, but what about getting rid of the QERR_ macros too?

The easiest way to do this would be to just replace each macro with its text. If the string duplication bothers you (it doesn't bother me very much, btw) you could create wrappers say qemu_listen() or listen_errp() or whatever.

#3 lore raw
Quoted 36 lines · Luiz Capitulino
Quoted 19 lines · On Fri, 19 Sep 2014 09:27:04 +0200 Markus Armbruster <[email protected]> wrote:

connect() doesn't "connect to socket", it connects a socket to an address and, if it's of type SOCK_STREAM, initiates a connection. Scratch "to".

listen() does "set socket to listening mode", but it sounds awkward. Change to "listen on socket".

---
 include/qapi/qmp/qerror.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/qapi/qmp/qerror.h +0 -0
index 902d1a7..774e75d 100644
@@ -155,10 +155,10 @@ void qerror_report_err(Error *err);
     ERROR_CLASS_GENERIC_ERROR, "this feature or command is not currently supported"
 

include/qapi/qmp/qerror.h void qerror_report_err(Error *err); · line 164

Quoted 10 lines
include/qapi/qmp/qerror.h +2 -2
 #define QERR_SOCKET_CONNECT_FAILED \
-    ERROR_CLASS_GENERIC_ERROR, "Failed to connect to socket"
+    ERROR_CLASS_GENERIC_ERROR, "Failed to connect socket"
 
 #define QERR_SOCKET_LISTEN_FAILED \
-    ERROR_CLASS_GENERIC_ERROR, "Failed to set socket to listening mode"
+    ERROR_CLASS_GENERIC_ERROR, "Failed to listen on socket"
 
 #define QERR_SOCKET_BIND_FAILED \
     ERROR_CLASS_GENERIC_ERROR, "Failed to bind socket"

The word fixing is good, but what about getting rid of the QERR_ macros too?

Quoted 4 lines

The easiest way to do this would be to just replace each macro with its text. If the string duplication bothers you (it doesn't bother me very much, btw) you could create wrappers say qemu_listen() or listen_errp() or whatever.

I can do that on top. Okay?

#4 lore raw
Quoted 38 lines · On Fri, 19 Sep 2014 19:16:08 +0200 Markus Armbruster <[email protected]> wrote:
Quoted 36 lines · Luiz Capitulino
Quoted 19 lines · On Fri, 19 Sep 2014 09:27:04 +0200 Markus Armbruster <[email protected]> wrote:

connect() doesn't "connect to socket", it connects a socket to an address and, if it's of type SOCK_STREAM, initiates a connection. Scratch "to".

listen() does "set socket to listening mode", but it sounds awkward. Change to "listen on socket".

---
 include/qapi/qmp/qerror.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/qapi/qmp/qerror.h +0 -0
index 902d1a7..774e75d 100644
@@ -155,10 +155,10 @@ void qerror_report_err(Error *err);
     ERROR_CLASS_GENERIC_ERROR, "this feature or command is not currently supported"
 

include/qapi/qmp/qerror.h void qerror_report_err(Error *err); · line 164

Quoted 10 lines
include/qapi/qmp/qerror.h +2 -2
 #define QERR_SOCKET_CONNECT_FAILED \
-    ERROR_CLASS_GENERIC_ERROR, "Failed to connect to socket"
+    ERROR_CLASS_GENERIC_ERROR, "Failed to connect socket"
 
 #define QERR_SOCKET_LISTEN_FAILED \
-    ERROR_CLASS_GENERIC_ERROR, "Failed to set socket to listening mode"
+    ERROR_CLASS_GENERIC_ERROR, "Failed to listen on socket"
 
 #define QERR_SOCKET_BIND_FAILED \
     ERROR_CLASS_GENERIC_ERROR, "Failed to bind socket"

The word fixing is good, but what about getting rid of the QERR_ macros too?

Quoted 6 lines
Quoted 4 lines

The easiest way to do this would be to just replace each macro with its text. If the string duplication bothers you (it doesn't bother me very much, btw) you could create wrappers say qemu_listen() or listen_errp() or whatever.

I can do that on top. Okay?

OK.

#5 lore raw
In reply to Markus Armbruster
Quoted 8 lines · On Fri, 19 Sep 2014 09:27:04 +0200 Markus Armbruster <[email protected]> wrote:

connect() doesn't "connect to socket", it connects a socket to an address and, if it's of type SOCK_STREAM, initiates a connection. Scratch "to".

listen() does "set socket to listening mode", but it sounds awkward. Change to "listen on socket".

Applied to the qmp branch, thanks.

Quoted 21 lines
---
 include/qapi/qmp/qerror.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/qapi/qmp/qerror.h +2 -2
index 902d1a7..774e75d 100644
@@ -155,10 +155,10 @@ void qerror_report_err(Error *err);
     ERROR_CLASS_GENERIC_ERROR, "this feature or command is not currently supported"
 
 #define QERR_SOCKET_CONNECT_FAILED \
-    ERROR_CLASS_GENERIC_ERROR, "Failed to connect to socket"
+    ERROR_CLASS_GENERIC_ERROR, "Failed to connect socket"
 
 #define QERR_SOCKET_LISTEN_FAILED \
-    ERROR_CLASS_GENERIC_ERROR, "Failed to set socket to listening mode"
+    ERROR_CLASS_GENERIC_ERROR, "Failed to listen on socket"
 
 #define QERR_SOCKET_BIND_FAILED \
     ERROR_CLASS_GENERIC_ERROR, "Failed to bind socket"