qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] NBD dead code elimination
@ 2008-06-18  7:15 Carlo Marcelo Arenas Belon
  2008-06-18  9:00 ` Laurent Vivier
  0 siblings, 1 reply; 2+ messages in thread
From: Carlo Marcelo Arenas Belon @ 2008-06-18  7:15 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 272 bytes --]

The following patch, removes tcp_socket_outgoing which is not being used by
the current implementation, neither the proposed unix socket patches.

This avoids the following compile time warning :

  nbd.c:99: warning: 'tcp_socket_outgoing' defined but not used

Carlo
---

[-- Attachment #2: qemu-nbd-deadcode.patch --]
[-- Type: text/plain, Size: 1054 bytes --]

Index: nbd.c
===================================================================
--- nbd.c	(revision 4745)
+++ nbd.c	(working copy)
@@ -95,45 +95,6 @@
     return offset;
 }
 
-static int tcp_socket_outgoing(const char *address, uint16_t port)
-{
-    int s;
-    struct in_addr in;
-    struct sockaddr_in addr;
-    int serrno;
-
-    s = socket(PF_INET, SOCK_STREAM, 0);
-    if (s == -1) {
-        return -1;
-    }
-
-    if (inet_aton(address, &in) == 0) {
-        struct hostent *ent;
-
-        ent = gethostbyname(address);
-        if (ent == NULL) {
-            goto error;
-        }
-
-        memcpy(&in, ent->h_addr, sizeof(in));
-    }
-
-    addr.sin_family = AF_INET;
-    addr.sin_port = htons(port);
-    memcpy(&addr.sin_addr.s_addr, &in, sizeof(in));
-
-    if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
-        goto error;
-    }
-
-    return s;
-error:
-    serrno = errno;
-    close(s);
-    errno = serrno;
-    return -1;
-}
-
 int tcp_socket_incoming(const char *address, uint16_t port)
 {
     int s;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] NBD dead code elimination
  2008-06-18  7:15 [Qemu-devel] [PATCH] NBD dead code elimination Carlo Marcelo Arenas Belon
@ 2008-06-18  9:00 ` Laurent Vivier
  0 siblings, 0 replies; 2+ messages in thread
From: Laurent Vivier @ 2008-06-18  9:00 UTC (permalink / raw)
  To: qemu-devel

Hi,

I don't know if it is a good idea to remove this code, perhaps it can be
useful one day if we want to add the nbd-client functionality in
qemu-nbd (my patch, using unix socket, already does).

Regards,
Laurent

Le mercredi 18 juin 2008 à 02:15 -0500, Carlo Marcelo Arenas Belon a
écrit :
> The following patch, removes tcp_socket_outgoing which is not being used by
> the current implementation, neither the proposed unix socket patches.
> 
> This avoids the following compile time warning :
> 
>   nbd.c:99: warning: 'tcp_socket_outgoing' defined but not used
> 
> Carlo
> ---
-- 
------------- Laurent.Vivier@bull.net ---------------
"The best way to predict the future is to invent it."
- Alan Kay

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-06-18  9:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-18  7:15 [Qemu-devel] [PATCH] NBD dead code elimination Carlo Marcelo Arenas Belon
2008-06-18  9:00 ` Laurent Vivier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).