Skip to contentSkip to conversation

warnings in net.c

PATCH In review Ulrich Hecht 5 participants 7 messages Jun 17, 2009 – Jun 18, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 warnings in net.c

removes unused slirp code and initializes ret in net_client_init()

---
 net.c |   51 +--------------------------------------------------
 1 files changed, 1 insertions(+), 50 deletions(-)
net.c +1 -50
index af9de73..91976b9 100644
@@ -691,55 +691,6 @@ int slirp_is_inited(void)
     return slirp_inited;
 }
 
-static ssize_t slirp_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
-{
-#ifdef DEBUG_SLIRP
-    printf("slirp input:\n");
-    hex_dump(stdout, buf, size);
-#endif
-    slirp_input(buf, size);
-    return size;
-}
-
-static int slirp_in_use;
-
-static void net_slirp_cleanup(VLANClientState *vc)
-{
-    slirp_in_use = 0;
-}
-
-static int net_slirp_init(VLANState *vlan, const char *model, const char *name,
-                          int restricted, const char *ip)
-{
-    if (slirp_in_use) {
-        /* slirp only supports a single instance so far */
-        return -1;
-    }
-    if (!slirp_inited) {
-        slirp_inited = 1;
-        slirp_init(restricted, ip);
-
-        while (slirp_redirs) {
-            struct slirp_config_str *config = slirp_redirs;
-
-            slirp_redirection(NULL, config->str);
-            slirp_redirs = config->next;
-            qemu_free(config);
-        }
-#ifndef _WIN32
-        if (slirp_smb_export) {
-            slirp_smb(slirp_smb_export);
-        }
-#endif
-    }
-
-    slirp_vc = qemu_new_vlan_client(vlan, model, name, NULL, slirp_receive,
-                                    NULL, net_slirp_cleanup, NULL);
-    slirp_vc->info_str[0] = '\0';
-    slirp_in_use = 1;
-    return 0;
-}
-
 static void net_slirp_redir_print(void *opaque, int is_udp,
                                   struct in_addr *laddr, u_int lport,
                                   struct in_addr *faddr, u_int fport)
@@ -2088,7 +2039,7 @@ int net_client_init(Monitor *mon, const char *device, const char *p)
         "vlan", "name", "fd", NULL
     };
     char buf[1024];
-    int vlan_id, ret;
+    int vlan_id, ret = 0;
     VLANState *vlan;
     char *name = NULL;
 
Signature · 1 line
1.6.2.1
#1 lore raw
Quoted 3 lines · Ulrich Hecht

removes unused slirp code and initializes ret in net_client_init()

It is definitely not unused when CONFIG_SLIRP is defined. I'm damn sure I use the code and that I was debugging it two days ago.

Best regards,
Filip Navara

#6 lore raw
In reply to Ulrich Hecht
Quoted 1 line · Ulrich Hecht

removes unused slirp code and initializes ret in net_client_init()

Totally bogus, you must be compiling without CONFIG_SLIRP.

#2 lore raw
In reply to Filip Navara
Quoted 9 lines · Filip Navara
Quoted 3 lines · Ulrich Hecht

removes unused slirp code and initializes ret in net_client_init()

It is definitely not unused when CONFIG_SLIRP is defined. I'm damn sure I use the code and that I was debugging it two days ago.

Right, the patch is incorrect. And even with --disable-slirp, it builds fine for me as-is. Ulrich, what is your setup (configure parameters etc.)?

Also, the ret initialization appears to be unneeded on first glance. No compiler around has a problem with it. What is your version / setup here? And more important: What path requires the initialization (because it remains unclear if ret=0 is the correct until we know the precise case).

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
#4 lore raw
In reply to Filip Navara
Quoted 7 lines · Filip Navara
Quoted 3 lines · Ulrich Hecht

removes unused slirp code and initializes ret in net_client_init()

It is definitely not unused when CONFIG_SLIRP is defined. I'm damn sure I use the code and that I was debugging it two days ago.

Er, yes, now that you mention it... I even grepped for net_client_init, but I didn't find it.

Still, it dies thanks to -Werror with a plain "./configure". I guess framing it with #ifdef CONFIG_SLIRP will do.

CU
Uli

Signature · 4 lines
Heute ist
- Tag der Aussiedlung (in Ägypten)

SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
#3 lore raw
In reply to Jan Kiszka
Quoted 5 lines · Jan Kiszka

Also, the ret initialization appears to be unneeded on first glance. No compiler around has a problem with it. What is your version / setup here? And more important: What path requires the initialization (because it remains unclear if ret=0 is the correct until we know the precise case).

Honestly, I can't reproduce it. I guess this whole thing is bogus after all. I shouldn't get up before 11 AM any more...

CU
Uli

Signature · 4 lines
Heute ist
- Tag der Aussiedlung (in Ägypten)

SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
#5 lore raw
In reply to Ulrich Hecht
Quoted 5 lines · Ulrich Hecht
Quoted 4 lines · Filip Navara
Quoted 3 lines · Ulrich Hecht

removes unused slirp code and initializes ret in net_client_init()

Quoted 8 lines
Quoted 2 lines

It is definitely not unused when CONFIG_SLIRP is defined. I'm damn sure I use the code and that I was debugging it two days ago.

Er, yes, now that you mention it... I even grepped for net_client_init, but I didn't find it.

Still, it dies thanks to -Werror with a plain "./configure". I guess framing it with #ifdef CONFIG_SLIRP will do.

It _is_ already framed, and it _does_ build flawlessly with --disable-slirp here. You must be looking at a different version.

Jan