void shutdown_netfront(struct netfront_dev *dev) { struct netfront_dev_list *list = NULL; struct netfront_dev_list *to_del = NULL; /* Check this is a valid device */ for ( list = dev_list; list != NULL; list = list->next ) { if (list->dev == dev) break; } if (!list) { printk("Trying to shutdown an invalid netfront device (%p)\n", dev); return; } list->refcount--; if (list->refcount == 0) { _shutdown_netfront(dev); free(dev->nodename); free(dev); to_del = list; if (to_del == dev_list) { free(to_del); dev_list = NULL; } else { for ( list = dev_list; list->next != to_del; list = list->next ); list->next = to_del->next; free(to_del); } } }
void suspend_netfront(void) { struct netfront_dev_list *list; for (list = dev_list; list != NULL; list = list->next) _shutdown_netfront(list->dev); }