/*static char *SCCSID = "@(#)qdskinfo.c	6.2 92/01/31";*/
#define _BTXT _BTXT
#define INCL_DOSERRORS
#include <os2def.h>
#include <bse.h>
#include "api.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 "pr_FCN.h"
#include "pr_MISC.h"
#include "pr_debug.h"


/*
 ***	QueryDiskInfo - Get disk allocation info
 *
 *	Entry	hVPB = volume handle/identifier
 *		pfsalloc = address of fsalloc buffer to be filled in
 *
 *	Returns error code or else
 *		0 if OK
 *		    *pfsalloc filled in
 *
 */

USHORT
QueryDiskInfo (hVPB, pfsalloc, pfrm)
HVOL	hVPB;
PFSALLOCATE pfsalloc;
PFRAME	pfrm;
{
    PVOLTAB pvol;

#ifdef DEBUG
    if (hVPB == 0) {
	INTERR (__FILE__": hVPB == 0");
    }
#endif

    if ((pvol = FindPVol (hVPB)) == NULL) {
#ifdef DEBUG
	dprintf ("QueryDiskInfo: can't find hVPB=0x%d\n", hVPB);
#endif
	return (GetHardErr (ERROR_INVALID_HANDLE));
    }

    pfsalloc->cUnitAvail = pvol->csecSpace < 0L ? 0L : pvol->csecSpace;

    pfsalloc->idFileSystem = 0L;	/* BUGBUG - what is this??? */

    pfsalloc->cUnit = pvol->cSectsOnVol;

    pfsalloc->cSectorUnit = 1;

    pfsalloc->cbSector = SECSIZE;

    return NO_ERROR;
}
