Lines Matching defs:moduleid

152 netstack_register(int moduleid,
160 ASSERT(moduleid >= 0 && moduleid < NS_MAX);
168 ASSERT(ns_reg[moduleid].nr_create == NULL);
169 ASSERT(ns_reg[moduleid].nr_flags == 0);
170 ns_reg[moduleid].nr_create = module_create;
171 ns_reg[moduleid].nr_shutdown = module_shutdown;
172 ns_reg[moduleid].nr_destroy = module_destroy;
173 ns_reg[moduleid].nr_flags = NRF_REGISTERED;
182 nm_state_t *nms = &ns->netstack_m_state[moduleid];
189 netstack_t *, ns, int, moduleid);
198 * Make sure we either run all the create functions for this moduleid
199 * or we wait for any other creators for this moduleid.
201 apply_all_netstacks(moduleid, netstack_apply_create);
205 netstack_unregister(int moduleid)
209 ASSERT(moduleid >= 0 && moduleid < NS_MAX);
211 ASSERT(ns_reg[moduleid].nr_create != NULL);
212 ASSERT(ns_reg[moduleid].nr_flags & NRF_REGISTERED);
223 nm_state_t *nms = &ns->netstack_m_state[moduleid];
226 if (ns_reg[moduleid].nr_shutdown != NULL &&
231 netstack_t *, ns, int, moduleid);
233 if ((ns_reg[moduleid].nr_flags & NRF_REGISTERED) &&
234 ns_reg[moduleid].nr_destroy != NULL &&
239 netstack_t *, ns, int, moduleid);
248 ns_reg[moduleid].nr_flags |= NRF_DYING;
251 apply_all_netstacks(moduleid, netstack_apply_shutdown);
252 apply_all_netstacks(moduleid, netstack_apply_destroy);
260 ASSERT(ns_reg[moduleid].nr_flags & NRF_REGISTERED);
261 ASSERT(ns_reg[moduleid].nr_flags & NRF_DYING);
263 nm_state_t *nms = &ns->netstack_m_state[moduleid];
269 netstack_t *, ns, int, moduleid);
274 ns_reg[moduleid].nr_create = NULL;
275 ns_reg[moduleid].nr_shutdown = NULL;
276 ns_reg[moduleid].nr_destroy = NULL;
277 ns_reg[moduleid].nr_flags = 0;
345 * the existing create callbacks to complete in moduleid order
408 * the existing create callbacks to complete in moduleid order
498 * the existing destroy callbacks to complete in reverse moduleid order
559 * Apply a function to all netstacks for a particular moduleid.
579 apply_all_netstacks(int moduleid, applyfn_t *applyfn)
589 } else if ((applyfn)(&netstack_g_lock, ns, moduleid)) {
621 /* Like the above but in reverse moduleid order */
639 * Call the create function for the ns and moduleid if CREATE_NEEDED
650 netstack_apply_create(kmutex_t *lockp, netstack_t *ns, int moduleid)
654 nm_state_t *nms = &ns->netstack_m_state[moduleid];
667 netstack_t *, ns, int, moduleid);
672 ASSERT(ns_reg[moduleid].nr_create != NULL);
677 result = (ns_reg[moduleid].nr_create)(stackid, ns);
684 ns->netstack_modules[moduleid] = result;
689 netstack_t *, ns, int, moduleid);
699 * Call the shutdown function for the ns and moduleid if SHUTDOWN_NEEDED
710 netstack_apply_shutdown(kmutex_t *lockp, netstack_t *ns, int moduleid)
714 nm_state_t *nms = &ns->netstack_m_state[moduleid];
727 netstack_t *, ns, int, moduleid);
732 ASSERT(ns_reg[moduleid].nr_shutdown != NULL);
734 netstack_module = ns->netstack_modules[moduleid];
738 (ns_reg[moduleid].nr_shutdown)(stackid, netstack_module);
748 netstack_t *, ns, int, moduleid);
758 * Call the destroy function for the ns and moduleid if DESTROY_NEEDED
769 netstack_apply_destroy(kmutex_t *lockp, netstack_t *ns, int moduleid)
773 nm_state_t *nms = &ns->netstack_m_state[moduleid];
786 netstack_t *, ns, int, moduleid);
791 ASSERT(ns_reg[moduleid].nr_destroy != NULL);
793 netstack_module = ns->netstack_modules[moduleid];
797 (ns_reg[moduleid].nr_destroy)(stackid, netstack_module);
803 ns->netstack_modules[moduleid] = NULL;
808 netstack_t *, ns, int, moduleid);
853 * Wait for any INPROGRESS flag to be cleared for the netstack/moduleid