Commit 8b13c4a794e26e4fd61a71858a24d309998825e0

Authored by aliguori
1 parent 4d73cd3b

qemu: add net_client_uninit / qemu_find_vlan_client (Marcelo Tosatti)

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6600 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 2 changed files with 23 additions and 0 deletions
... ... @@ -366,6 +366,19 @@ void qemu_del_vlan_client(VLANClientState *vc)
366 366 pvc = &(*pvc)->next;
367 367 }
368 368  
  369 +VLANClientState *qemu_find_vlan_client(VLANState *vlan, void *opaque)
  370 +{
  371 + VLANClientState **pvc = &vlan->first_client;
  372 +
  373 + while (*pvc != NULL)
  374 + if ((*pvc)->opaque == opaque)
  375 + return *pvc;
  376 + else
  377 + pvc = &(*pvc)->next;
  378 +
  379 + return NULL;
  380 +}
  381 +
369 382 int qemu_can_send_packet(VLANClientState *vc1)
370 383 {
371 384 VLANState *vlan = vc1->vlan;
... ... @@ -1713,6 +1726,14 @@ int net_client_init(const char *device, const char *p)
1713 1726 return ret;
1714 1727 }
1715 1728  
  1729 +void net_client_uninit(NICInfo *nd)
  1730 +{
  1731 + nd->vlan->nb_guest_devs--;
  1732 + nb_nics--;
  1733 + nd->used = 0;
  1734 + free((void *)nd->model);
  1735 +}
  1736 +
1716 1737 int net_client_parse(const char *str)
1717 1738 {
1718 1739 const char *p;
... ...
... ... @@ -42,6 +42,7 @@ VLANClientState *qemu_new_vlan_client(VLANState *vlan,
42 42 IOCanRWHandler *fd_can_read,
43 43 void *opaque);
44 44 void qemu_del_vlan_client(VLANClientState *vc);
  45 +VLANClientState *qemu_find_vlan_client(VLANState *vlan, void *opaque);
45 46 int qemu_can_send_packet(VLANClientState *vc);
46 47 ssize_t qemu_sendv_packet(VLANClientState *vc, const struct iovec *iov,
47 48 int iovcnt);
... ... @@ -94,6 +95,7 @@ void net_checksum_calculate(uint8_t *data, int length);
94 95  
95 96 /* from net.c */
96 97 int net_client_init(const char *device, const char *p);
  98 +void net_client_uninit(NICInfo *nd);
97 99 int net_client_parse(const char *str);
98 100 void net_slirp_smb(const char *exported_dir);
99 101 void net_slirp_redir(const char *redir_str);
... ...