From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=33362 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OCyIQ-0003Um-01 for qemu-devel@nongnu.org; Fri, 14 May 2010 13:03:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OCyIN-00008L-BF for qemu-devel@nongnu.org; Fri, 14 May 2010 13:03:33 -0400 Received: from goliath.siemens.de ([192.35.17.28]:23290) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OCyIN-000082-1V for qemu-devel@nongnu.org; Fri, 14 May 2010 13:03:31 -0400 Message-ID: <4BED825E.7050505@siemens.com> Date: Fri, 14 May 2010 19:03:26 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <1273855231-22835-1-git-send-email-miguel.filho@gmail.com> In-Reply-To: <1273855231-22835-1-git-send-email-miguel.filho@gmail.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] net: Remove dead code from net/socket.c List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Miguel Di Ciurcio Filho Cc: aliguori@linux.vnet.ibm.com, qemu-devel@nongnu.org Miguel Di Ciurcio Filho wrote: > When a connection is accepted, the handler net_socket_accept() calls > net_socket_fd_init(). If the socket is UDP/multicast, > net_socket_fd_init() calls net_socket_fd_init_dgram, if > the socket is TCP it calls net_socket_fd_init_dgram_stream. > > In both cases the info_str string is written inside > net_socket_fd_init_(stream|dgram), and after that, it is > overwritten on a subsequent snprintf() in net_socket_accept(). > There is non-zero time window between registration and acceptance. And you have the path taken for fd sockets. Jan > net_socket_fd_init_(stream|dgram) always puts into the info_str the fd > number, and this information is overwritten latter. No one has noticed this for > so long that I believe this code is dead. > > Signed-off-by: Miguel Di Ciurcio Filho > --- > net/socket.c | 7 ------- > 1 files changed, 0 insertions(+), 7 deletions(-) > > diff --git a/net/socket.c b/net/socket.c > index 1c4e153..b72a2de 100644 > --- a/net/socket.c > +++ b/net/socket.c > @@ -267,11 +267,6 @@ static NetSocketState *net_socket_fd_init_dgram(VLANState *vlan, > > nc = qemu_new_net_client(&net_dgram_socket_info, vlan, NULL, model, name); > > - snprintf(nc->info_str, sizeof(nc->info_str), > - "socket: fd=%d (%s mcast=%s:%d)", > - fd, is_connected ? "cloned" : "", > - inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port)); > - > s = DO_UPCAST(NetSocketState, nc, nc); > > s->fd = fd; > @@ -307,8 +302,6 @@ static NetSocketState *net_socket_fd_init_stream(VLANState *vlan, > > nc = qemu_new_net_client(&net_socket_info, vlan, NULL, model, name); > > - snprintf(nc->info_str, sizeof(nc->info_str), "socket: fd=%d", fd); > - > s = DO_UPCAST(NetSocketState, nc, nc); > > s->fd = fd; -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux