/*
 * smb_notify_init
 *
 * This function is not multi-thread safe. The caller must make sure only one
 * thread makes the call.
 */
int
smb_notify_init(void)
{
	int	rc;

	if (smb_notify_initialized)
		return (0);

	smb_slist_constructor(&smb_ncr_list, sizeof (smb_request_t),
	    offsetof(smb_request_t, sr_ncr.nc_lnd));

	smb_slist_constructor(&smb_nce_list, sizeof (smb_request_t),
	    offsetof(smb_request_t, sr_ncr.nc_lnd));

	smb_thread_init(&smb_thread_notify_daemon,
	    "smb_notify_change_daemon", smb_notify_change_daemon, NULL);

	rc = smb_thread_start(&smb_thread_notify_daemon);
	if (rc) {
		smb_thread_destroy(&smb_thread_notify_daemon);
		smb_slist_destructor(&smb_ncr_list);
		smb_slist_destructor(&smb_nce_list);
		return (rc);
	}

	smb_notify_initialized = B_TRUE;

	return (0);
}
/*
 * smb_notify_fini
 *
 * This function is not multi-thread safe. The caller must make sure only one
 * thread makes the call.
 */
void
smb_notify_fini(void)
{
	if (!smb_notify_initialized)
		return;

	smb_thread_stop(&smb_thread_notify_daemon);
	smb_thread_destroy(&smb_thread_notify_daemon);
	smb_slist_destructor(&smb_ncr_list);
	smb_slist_destructor(&smb_nce_list);
	smb_notify_initialized = B_FALSE;
}
Ejemplo n.º 3
0
void
smb_kshare_stop(smb_server_t *sv)
{
	smb_thread_stop(&sv->sv_export.e_unexport_thread);
	smb_thread_destroy(&sv->sv_export.e_unexport_thread);
}