Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LXGtT-000447-VL for qemu-devel@nongnu.org; Wed, 11 Feb 2009 10:20:56 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LXGtT-00043k-3y for qemu-devel@nongnu.org; Wed, 11 Feb 2009 10:20:55 -0500 Received: from [199.232.76.173] (port=52345 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LXGtS-00043h-Qv for qemu-devel@nongnu.org; Wed, 11 Feb 2009 10:20:54 -0500 Received: from savannah.gnu.org ([199.232.41.3]:40291 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LXGtS-0002D7-Hk for qemu-devel@nongnu.org; Wed, 11 Feb 2009 10:20:54 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LXGtR-0004qn-Iw for qemu-devel@nongnu.org; Wed, 11 Feb 2009 15:20:53 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LXGtQ-0004qj-JS for qemu-devel@nongnu.org; Wed, 11 Feb 2009 15:20:52 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Wed, 11 Feb 2009 15:20:52 +0000 Subject: [Qemu-devel] [6600] qemu: add net_client_uninit / qemu_find_vlan_client (Marcelo Tosatti ) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 6600 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6600 Author: aliguori Date: 2009-02-11 15:20:51 +0000 (Wed, 11 Feb 2009) Log Message: ----------- qemu: add net_client_uninit / qemu_find_vlan_client (Marcelo Tosatti) Signed-off-by: Marcelo Tosatti Signed-off-by: Anthony Liguori Modified Paths: -------------- trunk/net.c trunk/net.h Modified: trunk/net.c =================================================================== --- trunk/net.c 2009-02-11 15:20:46 UTC (rev 6599) +++ trunk/net.c 2009-02-11 15:20:51 UTC (rev 6600) @@ -366,6 +366,19 @@ pvc = &(*pvc)->next; } +VLANClientState *qemu_find_vlan_client(VLANState *vlan, void *opaque) +{ + VLANClientState **pvc = &vlan->first_client; + + while (*pvc != NULL) + if ((*pvc)->opaque == opaque) + return *pvc; + else + pvc = &(*pvc)->next; + + return NULL; +} + int qemu_can_send_packet(VLANClientState *vc1) { VLANState *vlan = vc1->vlan; @@ -1713,6 +1726,14 @@ return ret; } +void net_client_uninit(NICInfo *nd) +{ + nd->vlan->nb_guest_devs--; + nb_nics--; + nd->used = 0; + free((void *)nd->model); +} + int net_client_parse(const char *str) { const char *p; Modified: trunk/net.h =================================================================== --- trunk/net.h 2009-02-11 15:20:46 UTC (rev 6599) +++ trunk/net.h 2009-02-11 15:20:51 UTC (rev 6600) @@ -42,6 +42,7 @@ IOCanRWHandler *fd_can_read, void *opaque); void qemu_del_vlan_client(VLANClientState *vc); +VLANClientState *qemu_find_vlan_client(VLANState *vlan, void *opaque); int qemu_can_send_packet(VLANClientState *vc); ssize_t qemu_sendv_packet(VLANClientState *vc, const struct iovec *iov, int iovcnt); @@ -94,6 +95,7 @@ /* from net.c */ int net_client_init(const char *device, const char *p); +void net_client_uninit(NICInfo *nd); int net_client_parse(const char *str); void net_slirp_smb(const char *exported_dir); void net_slirp_redir(const char *redir_str);