home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
274.lha
/
DiskHandler
/
volume.c
< prev
Wrap
C/C++ Source or Header
|
1989-07-25
|
3KB
|
104 lines
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* |_o_o|\\ Copyright (c) 1987 The Software Distillery. All Rights Reserved */
/* |. o.| || This program may not be distributed without the permission of */
/* | . | || the authors: BBS: */
/* | o | || John Toebes Dave Baker */
/* | . |// */
/* ====== */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Volume Manipulation */
/* ActCurentVol ActRenameDisk ActDiskInfo ActInfo */
#include "handler.h"
void ActCurentVol(global, pkt)
GLOBAL global;
struct DosPacket *pkt; /* a pointer to the dos packet sent */
{
BUG(("ActCurentVol\n"));
pkt->dp_Res1 = MKBADDR(global->volume);
}
void ActRenameDisk(global, pkt)
GLOBAL global;
struct DosPacket *pkt; /* a pointer to the dos packet sent */
{
char *name;
BUG(("ActRenameDisk\n"));
name = (char *)pkt->dp_Arg1;
pkt->dp_Res1 = RenameDisk(global, name);
}
void ActDiskInfo(global, pkt)
GLOBAL global;
struct DosPacket *pkt; /* a pointer to the dos packet sent */
{
struct InfoData *info;
BUG(("ActDiskInfo\n"));
info = (struct InfoData *)pkt->dp_Arg1;
GetVolInfo(global, info);
pkt->dp_Res1 = DOS_TRUE;
}
void ActInfo(global, pkt)
GLOBAL global;
struct DosPacket *pkt; /* a pointer to the dos packet sent */
{
struct FileLock *lock;
struct InfoData *info;
BUG(("ActInfo\n"));
lock = (struct FileLock *)pkt->dp_Arg1;
info = (struct InfoData *)pkt->dp_Arg2;
if (lock == NULL ||
lock->fl_Volume != MKBADDR(global->volume))
info->id_DiskType = global->diskstatus;
else
GetVolInfo(global, info);
pkt->dp_Res1 = DOS_TRUE;
}
void GetVolInfo(global, info)
GLOBAL global;
register struct InfoData *info;
{
register struct DirBlock *block;
if (global->volume == NULL)
{
info->id_DiskType = global->diskstatus;
}
else
{
/* get the block associated with the key */
block = (struct DirBlock*)GetBlock(global,global->Root);
if (block == NULL)
info->id_DiskType = global->diskstatus;
else
{
/* Now copy over what they wanted */
info->id_NumSoftErrors = 0; /* what a lie... */
info->id_UnitNumber = global->unitnum;
info->id_DiskState = global->diskstate;
info->id_NumBlocks = ((global->dskenv.de_numblks)-
(global->dskenv.de_reservedblks));
info->id_NumBlocksUsed = CountBlocks(global);
info->id_DiskType = global->volume->dl_DiskType;
info->id_VolumeNode = MKBADDR(global->volume);
info->id_InUse = 0;
}
}
}