More prep for Vimage:

- only one functino to destroy an SCTP stack sctp_finish()
 - Make it so this function also arranges for any threads
   created by the image to do a kthread_exit()
This commit is contained in:
Randall Stewart 2008-06-15 12:31:23 +00:00
parent d984a6e000
commit 97a7b90ff3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=179803
4 changed files with 17 additions and 19 deletions

View File

@ -5330,6 +5330,7 @@ sctp_pcb_init()
#if defined(SCTP_USE_THREAD_BASED_ITERATOR)
SCTP_BASE_INFO(iterator_running) = 0;
SCTP_BASE_INFO(threads_must_exit) = 0;
sctp_startup_iterator();
#endif
@ -5357,6 +5358,11 @@ sctp_pcb_finish(void)
int i;
/* FIXME MT */
SCTP_BASE_INFO(threads_must_exit) = 1;
#if defined(SCTP_USE_THREAD_BASED_ITERATOR)
/* Wake the thread up so it will exit now */
sctp_wakeup_iterator();
#endif
/*
* free the vrf/ifn/ifa lists and hashes (be sure address monitor is
* destroyed first).
@ -5428,6 +5434,16 @@ sctp_pcb_finish(void)
SCTP_ZONE_DESTROY(SCTP_BASE_INFO(ipi_zone_strmoq));
SCTP_ZONE_DESTROY(SCTP_BASE_INFO(ipi_zone_asconf));
SCTP_ZONE_DESTROY(SCTP_BASE_INFO(ipi_zone_asconf_ack));
/* Get rid of other stuff to */
if (SCTP_BASE_INFO(sctp_asochash) != NULL)
SCTP_HASH_FREE(SCTP_BASE_INFO(sctp_asochash), SCTP_BASE_INFO(hashasocmark));
if (SCTP_BASE_INFO(sctp_ephash) != NULL)
SCTP_HASH_FREE(SCTP_BASE_INFO(sctp_ephash), SCTP_BASE_INFO(hashmark));
if (SCTP_BASE_INFO(sctp_tcpephash) != NULL)
SCTP_HASH_FREE(SCTP_BASE_INFO(sctp_tcpephash), SCTP_BASE_INFO(hashtcpmark));
if (SCTP_BASE_INFO(sctp_restarthash) != NULL)
SCTP_HASH_FREE(SCTP_BASE_INFO(sctp_restarthash), SCTP_BASE_INFO(hashrestartmark));
}

View File

@ -177,7 +177,7 @@ struct sctp_epinfo {
struct sctpladdr addr_wq;
struct sctpiterators iteratorhead;
int threads_must_exit;
/* ep zone info */
sctp_zone_t ipi_zone_ep;
sctp_zone_t ipi_zone_asoc;

View File

@ -98,23 +98,6 @@ sctp_finish(void)
sctp_pcb_finish();
}
/*
* cleanup of the SCTP_BASE_INFO() structure.
* Assumes that the SCTP_BASE_INFO() lock is held.
*/
void
sctp_pcbinfo_cleanup(void)
{
/* free the hash tables */
if (SCTP_BASE_INFO(sctp_asochash) != NULL)
SCTP_HASH_FREE(SCTP_BASE_INFO(sctp_asochash), SCTP_BASE_INFO(hashasocmark));
if (SCTP_BASE_INFO(sctp_ephash) != NULL)
SCTP_HASH_FREE(SCTP_BASE_INFO(sctp_ephash), SCTP_BASE_INFO(hashmark));
if (SCTP_BASE_INFO(sctp_tcpephash) != NULL)
SCTP_HASH_FREE(SCTP_BASE_INFO(sctp_tcpephash), SCTP_BASE_INFO(hashtcpmark));
if (SCTP_BASE_INFO(sctp_restarthash) != NULL)
SCTP_HASH_FREE(SCTP_BASE_INFO(sctp_restarthash), SCTP_BASE_INFO(hashrestartmark));
}
void

View File

@ -308,7 +308,6 @@ void sctp_init __P((void));
void sctp_finish(void);
void sctp_pcbinfo_cleanup(void);
int sctp_flush(struct socket *, int);
int sctp_shutdown __P((struct socket *));
void sctp_notify