/*static char *SCCSID = "@(#)unlckdir.c	6.1 90/11/17";*/
/*static char *SCCSID = "@(#)unlckdir.c	13.2 90/01/25";*/
#ifndef  _BTXT
#define  _BTXT _BTXT
#define  _THISFILE "UNLCKDIR.C"
#include _THISFILE.C
#undef   _BTXT
#endif

#ifndef HDRS
#define HDRS

/***	unlockdir - unlock a locked SBDIR
 */

#include <os2def.h>
#include "const.h"
#include "chain.h"
#include "misc.h"
#include "buf.h"
#include "dir.h"
#include "storage.h"
#include "volume.h"
#include "tables.h"
#include "pb_ifs.h"
#include "lw.h"
#include "frame.h"
#include "fsdata.h"
#include "assert.h"
#include "log.h"

#endif

#include "pr_DIR.h"
#include "pr_MISC.h"
#include "pr_debug.h"


/*
 ***	UnLockDir - Unlock Directory
 *
 *	Unlock a directory and run any waiters.
 *
 *	ENTRY	none
 *
 *	EXIT	none
 *
 *	10/20/88 -- up to date with 10/16/88 assembly
 *
 *      Macro in pr_dir.h [GiladO 11/13/89]
 */

/*
 ***	UnLockDir_ - Unlock Directory
 *
 *	Same as UnLockDir except:
 *
 *	ENTRY	psbd (EAX) = SBDIR address
 *
 *	EXIT	none
 */

void
UnLockDir_ (psbd)
PSUBDIR psbd;
{
    ASSERT_SBD(psbd);

#ifdef DEBUG
    if ((psbd->bFlags & SDF_LCK) == 0) {
	dprintf ("UnLockDir_: psbd=%p, SDF_LCK bit is off\n", psbd);
	Int3 ();
    }
#endif

    ClrLockSBD(psbd);

    if ( psbd->cusWaiters != 0 ) {
	WakeupSBD( psbd );
    }
}
