#include <u.h>
#include <libc.h>

int
canilock(ILock *ilk)
{
	Pmspl s;

	s = splhi();
	if(canlock(&ilk->lk)){
		ilk->s = s;
		return 1;
	}
	splx(s);
	return 0;
}

void
ilock(ILock *ilk)
{
	Pmspl s;

	s = splhi();
	lock(&ilk->lk);
	ilk->s = s;
}

void
iunlock(ILock *ilk)
{
	Pmspl s;

	s = ilk->s;
	unlock(&ilk->lk);
	splx(s);
}
