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

#ifndef HDRS
#define HDRS

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

#endif

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


/*
 ***	UnHoldDir - Unhold Directory
 *
 *	UnHoldDir is called to decrement the hold count. If SDF_PND
 *	is set and the caller was the last guy who had it held, we
 *	release the task who wanted to lock it - it's the first one 
 *	on the list.
 *
 *	ENTRY	none (pfrm->psbd = address of SBDIR to unhold)
 *
 *	EXIT	none
 *
 *	Defined as macro in pr_dir.h
 */

/*
 ***	UnHoldDir_ - Unhold a Secific directory Directory
 *
 *	UnHoldDir is called to decrement the hold count. If SDF_PND
 *	is set and the caller was the last guy who had it held, we
 *	release the task who wanted to lock it - it's the first one 
 *	on the list.
 *
 *	ENTRY	psbd = address of SBDIR to unhold
 *
 *	EXIT	none
 *
 */
void
UnHoldDir_( PSUBDIR psbd )
{

    DecrHoldsSBD (psbd);

    if ((psbd->bFlags & SDF_PND) && (psbd->cusHolds == 0))
	WakeupSBD (psbd);
}





/*
 ***	ChkHoldDir - Check Unheld Directory
 *
 *	ChkHoldDir is just like UnHoldDir except that it's called
 *	after the caller has decremented SD_HCNT and discovered that
 *	SD_FLAG is set.
 *
 *	ENTRY	psbd = SUBDIR address
 *	EXIT	none
 */
void
ChkHoldDir (psbd)
PSUBDIR psbd;
{
    if (psbd->cusHolds == 0)
	WakeupSBD( psbd );
}
