Patchwork [03/18] qemu-sockets: unix_listen and unix_connect are portable

login
register
mail settings
Submitter Paolo Bonzini
Date Oct. 3, 2012, 2:36 p.m.
Message ID <1349275025-5093-4-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/188815/
State New
Headers show

Comments

Paolo Bonzini - Oct. 3, 2012, 2:36 p.m.
They are just wrappers and do not need a Win32-specific version.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qemu-sockets.c | 49 +++++++++++++++++--------------------------------
 1 file modificato, 17 inserzioni(+), 32 rimozioni(-)
Luiz Capitulino - Oct. 4, 2012, 4:38 p.m.
On Wed,  3 Oct 2012 16:36:50 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:

> They are just wrappers and do not need a Win32-specific version.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>

> ---
>  qemu-sockets.c | 49 +++++++++++++++++--------------------------------
>  1 file modificato, 17 inserzioni(+), 32 rimozioni(-)
> 
> diff --git a/qemu-sockets.c b/qemu-sockets.c
> index 5cf2b32..79c7b66 100644
> --- a/qemu-sockets.c
> +++ b/qemu-sockets.c
> @@ -731,6 +731,23 @@ int unix_connect_opts(QemuOpts *opts, Error **errp)
>      return sock;
>  }
>  
> +#else
> +
> +int unix_listen_opts(QemuOpts *opts, Error **errp)
> +{
> +    error_setg(errp, "unix sockets are not available on windows");
> +    errno = ENOTSUP;
> +    return -1;
> +}
> +
> +int unix_connect_opts(QemuOpts *opts, Error **errp)
> +{
> +    error_setg(errp, "unix sockets are not available on windows");
> +    errno = ENOTSUP;
> +    return -1;
> +}
> +#endif
> +
>  /* compatibility wrapper */
>  int unix_listen(const char *str, char *ostr, int olen, Error **errp)
>  {
> @@ -773,38 +790,6 @@ int unix_connect(const char *path, Error **errp)
>      return sock;
>  }
>  
> -#else
> -
> -int unix_listen_opts(QemuOpts *opts, Error **errp)
> -{
> -    error_setg(errp, "unix sockets are not available on windows");
> -    errno = ENOTSUP;
> -    return -1;
> -}
> -
> -int unix_connect_opts(QemuOpts *opts, Error **errp)
> -{
> -    error_setg(errp, "unix sockets are not available on windows");
> -    errno = ENOTSUP;
> -    return -1;
> -}
> -
> -int unix_listen(const char *path, char *ostr, int olen, Error **errp)
> -{
> -    error_setg(errp, "unix sockets are not available on windows");
> -    errno = ENOTSUP;
> -    return -1;
> -}
> -
> -int unix_connect(const char *path, Error **errp)
> -{
> -    error_setg(errp, "unix sockets are not available on windows");
> -    errno = ENOTSUP;
> -    return -1;
> -}
> -
> -#endif
> -
>  #ifdef _WIN32
>  static void socket_cleanup(void)
>  {
Markus Armbruster - Oct. 17, 2012, 1:17 p.m.
Paolo Bonzini <pbonzini@redhat.com> writes:

> They are just wrappers and do not need a Win32-specific version.

This gave me pause (it's my thick-headed day, apparently), until I
realized that in addition to what the commit message says you also move
related code.  Please try harder to make review as easy as possible.
Paolo Bonzini - Oct. 17, 2012, 1:21 p.m.
Il 17/10/2012 15:17, Markus Armbruster ha scritto:
>> > They are just wrappers and do not need a Win32-specific version.
> This gave me pause (it's my thick-headed day, apparently), until I
> realized that in addition to what the commit message says you also move
> related code.  Please try harder to make review as easy as possible.

I don't, it's just git that decided to make the diff this way. :)

Paolo

Patch

diff --git a/qemu-sockets.c b/qemu-sockets.c
index 5cf2b32..79c7b66 100644
--- a/qemu-sockets.c
+++ b/qemu-sockets.c
@@ -731,6 +731,23 @@  int unix_connect_opts(QemuOpts *opts, Error **errp)
     return sock;
 }
 
+#else
+
+int unix_listen_opts(QemuOpts *opts, Error **errp)
+{
+    error_setg(errp, "unix sockets are not available on windows");
+    errno = ENOTSUP;
+    return -1;
+}
+
+int unix_connect_opts(QemuOpts *opts, Error **errp)
+{
+    error_setg(errp, "unix sockets are not available on windows");
+    errno = ENOTSUP;
+    return -1;
+}
+#endif
+
 /* compatibility wrapper */
 int unix_listen(const char *str, char *ostr, int olen, Error **errp)
 {
@@ -773,38 +790,6 @@  int unix_connect(const char *path, Error **errp)
     return sock;
 }
 
-#else
-
-int unix_listen_opts(QemuOpts *opts, Error **errp)
-{
-    error_setg(errp, "unix sockets are not available on windows");
-    errno = ENOTSUP;
-    return -1;
-}
-
-int unix_connect_opts(QemuOpts *opts, Error **errp)
-{
-    error_setg(errp, "unix sockets are not available on windows");
-    errno = ENOTSUP;
-    return -1;
-}
-
-int unix_listen(const char *path, char *ostr, int olen, Error **errp)
-{
-    error_setg(errp, "unix sockets are not available on windows");
-    errno = ENOTSUP;
-    return -1;
-}
-
-int unix_connect(const char *path, Error **errp)
-{
-    error_setg(errp, "unix sockets are not available on windows");
-    errno = ENOTSUP;
-    return -1;
-}
-
-#endif
-
 #ifdef _WIN32
 static void socket_cleanup(void)
 {