nsc_rmspin.c revision 3270659f55e0928d6edec3d26217cc29398a8149
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#define __NSC_GEN__
#include "nsc_gen.h"
#include "nsc_mem.h"
#include "nsc_rmspin.h"
#include "../nsctl.h"
static kmutex_t _nsc_rmspin_slp;
extern nsc_mem_t *_nsc_local_mem;
/*
* void
* _nsc_init_rmlock (void)
* Initialise global locks.
*
* Called at driver initialisation time to allocate necessary
* data structures.
*/
void
{
}
/*
* void
* _nsc_deinit_rmlock (void)
* De-initialise global locks.
*
* Called at driver unload time to de-allocate
* resources.
*/
void
{
}
/*
* int
* _nsc_lock_all_rm (void)
* Take all global locks in address order.
*
* Returns 0 if _nsc_unlock_all_rm() should be called, or -1.
*/
int
{
(void) nsc_rm_lock(lp);
}
return (0);
}
/*
* void
* _nsc_unlock_all_rm (void)
* Release all global locks in reverse address order.
*
*/
void
{
}
}
/*
* nsc_rmlock_t *
* nsc_rm_lock_alloc(char *name, int flag, void *arg)
* Allocate and initialise a global lock.
*
* The 'flag' parameter should be either KM_SLEEP or KM_NOSLEEP,
* depending on whether the caller is willing to sleep while memory
* is allocated or not.
*
* The 'arg' parameter is passed directly to the underlying
* mutex_init(9f) function call.
*
* Returns NULL if lock cannot be allocated.
*/
{
return (NULL);
break;
if (lp != &_nsc_lock_top) {
return (NULL);
}
return (lk);
}
/*
* void
* nsc_rm_lock_destroy(nsc_rmlock_t *rmlockp)
* Release the global lock.
*
* Remarks:
* The specified global lock is released and made
* available for reallocation.
*/
void
{
if (!rmlockp)
return;
}
}
/*
* void
* nsc_rm_lock(nsc_rmlock_t *rmlockp)
* Acquire a global lock.
*
* rmlockp is the lock to be acquired.
* Returns 0 (success) or errno. Lock is not acquired if rc != 0.
*/
int
{
int rc;
/* always use a write-lock */
if (rc) {
}
return (rc);
}
/*
* static void
* nsc_rm_unlock(nsc_rmlock_t *rmlockp)
* Unlock a global lock.
*
* rmlockp is the lock to be released.
*/
void
{
}
}