static void destroy_all_devs(void) { #if MAX_WIIMOTES > 1 #error "destroy_all_devs only works for a single device" #endif dev_destroy(dev); globfree(&js_devs); }
static int __init graybox_init(void) { int i, error; log_debug("%s", banner); log_debug("Inserting the module..."); /* Init Packet sender's submodules. */ error = config_init(); if (error) goto config_failure; error = dev_init(); if (error) goto device_failure; error = receiver_init(); if (error) goto receiver_failure; error = skbops_init(); if (error) goto skbops_failure; /* Hook Jool to Netfilter. */ for (i = 0; i < ARRAY_SIZE(nfho); i++) { nfho[i].owner = NULL; nfho[i].priority = NF_IP_PRI_FIRST + 25; } error = nf_register_hooks(nfho, ARRAY_SIZE(nfho)); if (error) goto nf_register_hooks_failure; /* Yay */ log_info(MODULE_NAME " module inserted.\n"); return error; nf_register_hooks_failure: skbops_destroy(); skbops_failure: receiver_destroy(); receiver_failure: dev_destroy(); device_failure: config_destroy(); config_failure: return error; }
static void __exit graybox_exit(void) { nf_unregister_hooks(nfho, ARRAY_SIZE(nfho)); skbops_destroy(); receiver_destroy(); dev_destroy(); config_destroy(); log_info(MODULE_NAME " module removed."); }
static void del_index(struct timeval *tv, uint16_t index, const void *data, uint16_t size) { struct hci_dev *dev; dev = queue_remove_if(dev_list, dev_match_index, UINT_TO_PTR(index)); if (!dev) { fprintf(stderr, "Remove for an unexisting device\n"); return; } dev_destroy(dev); }