sys/fs/nfsclient/nfs_clport.c
/*
 * Called once to initialize data structures...
 */
Called once to initialize data structures
Called once to initialize data structures
static int
nfscl_modevent(module_t mod, int type, void *data)
{
	int error = 0;
	static int loaded = 0;
	switch (type) {
	case MOD_LOAD:
		if (loaded)
			return (0);
		newnfs_portinit();
		mtx_init(&nfs_clstate_mutex, "nfs_clstate_mutex", NULL,
		    MTX_DEF);
		mtx_init(&ncl_iod_mutex, "ncl_iod_mutex", NULL, MTX_DEF);
		nfscl_init();
		NFSD_LOCK();
		nfsrvd_cbinit(0);
		NFSD_UNLOCK();
		ncl_call_invalcaches = ncl_invalcaches;
		nfsd_call_nfscl = nfssvc_nfscl;
		loaded = 1;
		break;
	case MOD_UNLOAD:
		if (nfs_numnfscbd != 0) {
			error = EBUSY;
			break;
		}
#if 0
		ncl_call_invalcaches = NULL;
		nfsd_call_nfscl = NULL;
		mtx_destroy(&nfs_clstate_mutex);
		mtx_destroy(&ncl_iod_mutex);
		loaded = 0;
		break;
#else
#endif
	default:
		error = EOPNOTSUPP;
		break;
	}
	return error;
}
static int nfscl_modevent ( module_t mod , int type , void * data ) { int error = 0 ; static int loaded = 0 ; switch ( type ) { case MOD_LOAD : if ( loaded ) return ( 0 ) ; newnfs_portinit ( ) ; mtx_init ( & nfs_clstate_mutex , " " , NULL , MTX_DEF ) ; mtx_init ( & ncl_iod_mutex , " " , NULL , MTX_DEF ) ; nfscl_init ( ) ; NFSD_LOCK ( ) ; nfsrvd_cbinit ( 0 ) ; NFSD_UNLOCK ( ) ; ncl_call_invalcaches = ncl_invalcaches ; nfsd_call_nfscl = nfssvc_nfscl ; loaded = 1 ; break ; case MOD_UNLOAD : if ( nfs_numnfscbd != 0 ) { error = EBUSY ; break ; } #if 0 ncl_call_invalcaches = NULL ; nfsd_call_nfscl = NULL ; mtx_destroy ( & nfs_clstate_mutex ) ; mtx_destroy ( & ncl_iod_mutex ) ; loaded = 0 ; break ; #else #endif default : error = EOPNOTSUPP ; break ; } return error ; }
Called once to initialize data structures...
Called once to initialize data structures ...
/*
		 * XXX: Unloading of nfscl module is unsupported.
		 */ /* and get rid of the mutexes */ /* FALLTHROUGH */