/*static char *SCCSID = "@(#)setderr.c	6.2 92/01/31";*/
#define _BTXT _BTXT
#define _BTXT _BTXT
#define INCL_DOSERRORS
#include <os2def.h>
#include <bse.h>
#include <fsh.h>
#include "const.h"
#include "misc.h"
#include "chain.h"
#include "buf.h"
#include "dir.h"
#include "volume.h"
#include "storage.h"
#include "tables.h"
#include "pb_ifs.h"
#include "superb.h"
#include "pbmacros.h"
#include "lw.h"
#include "frame.h"
#include "fsdata.h"
#include "log.h"

#include "pr_CACHE.h"
#include "pr_DEBUG.h"
#include "pr_MISC.h"
#include "pr_FSSUB.h"


/*
 ***	SetDiskErr_ - Set Hard Error on Disk
 *
 *	SetDiskErr_ is identical to SetHardErr, except
 *	that we get the volume id from the buffer header
 *	(through its vlsn).
 *
 *	ENTRY	pbuf = pointer to buffer w/ bad sector(s)
 *	ENTRY	erc = Error Code
 *
 *	EXIT	none
 *
 *
 */

void far
SetDiskErr_( PBUFNODE pbuf, USHORT erc , PFRAME pfrm)
{
#ifdef SETBADSEC
    PVOLTAB pvol;
#endif

    SETHARDERR( erc );

#ifdef SETBADSEC
    /*
     *	Get a pointer to the volume table entry for the
     *	buffer's vlsn.
     */
    pvol = VolPtr[ IVOLFROMLSN( pbuf->lsnSec ) ];


    /*
     *	If the current volume does not have the fault flag
     *	SPF_BADSEC set, set it and write the spare block out.
     */
    if( !(pvol->bSpareFlags & SPF_BADSEC) ) {

	pvol->bSpareFlags &= SPF_BADSEC;
	UpdateSPBFlag(pvol,pfrm);

    }
#else
    pbuf;
#endif
}
