1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
|
<HTML>
<HEAD><TITLE> Volume </TITLE></HEAD>
<BODY>
<H1 ALIGN=CENTER>the Volume API</H1>
<HR>
<H1>Use cases</H1>
<P>
See Device API use cases.
<P>
<HR>
<H1>Data structures</H1>
<PRE>
struct Volume{
struct Device *dev; /* the pointer of the Device structure of which the volume belongs to */
/* physical sector numbers */
SECTNUM firstBlock; /* first block of the data area (from the beginning of the media) */
SECTNUM lastBlock; /* last usable block (from the beginning of the media) */
/* logical sector number */
SECTNUM rootBlock; /* root block (from firstBlock) */
char dosType; /* FFS/OFS, DIRCACHE, INTERNATIONAL */
BOOL bootCode; /* TRUE if a floppy is bootable */
int dataBlockSize; /* 488 or 512 */
char* volName;
/* bitmap */
long bitmapSize; /* number of blocks used to store the bitmap
(excluding the bitmapExtension blocks) */
SECTNUM *bitmapBlocks; /* bitmap blocks pointers (excluding bitmap extensions blocks) */
struct bBitmapBlock* *bitmapTable; /* stores the bitmap blocks */
BOOL *bitmapBlocksChg; /* bitmapBlocksChg[i] is TRUE if bitmapTable[i} has changed,
and need to be written at bitmapBlocks[i] */
SECTNUM curDirPtr; /* number of the current working directory */
}
</PRE>
<P>
If <I>vol</I> is one Volume structure returned by adfMount() :
<UL>
<LI>The devType is <I>vol->dev->devType</I>.
<LI>The dosType is OFS or FFS (exclusive), and may have the DIRCACHE and INTERNATIONAL
modes enabled. Uses isFFS(vol->dosType), isOFS(), isINTL() and isDIRCACHE()
to determine it.
<BR>
<B>Warning ! Even if isINTL() returns FALSE, if isDIRCACHE()
is TRUE, the Volume is considered (like with AmigaDOS) as having the
international mode enabled !</B>
</UL>
<HR>
<P ALIGN=CENTER><FONT SIZE=+2> adfMount() </FONT></P>
<H2>Syntax</H2>
<B>struct Volume*</B> adfMount(<B>struct Device *</B>dev,
<B>int</B> nPart, <B>BOOL</B> readOnly)
<H2>Description</H2>
<P>
Mounts a designed volume (nPart) of the Device (dev), eventually with
read only access (readOnly). The first partition is #0.
<P>
The current working directory is the root block.
<H2>Return values</H2>
The Volume, NULL in case of error.
<H2>Internals</H2>
<OL>
<LI>Read the bootblock to determine <I>vol->dosType</I>
and <I>vol->datablockSize</I>.
<LI>Read the rootblock, fills <I>vol->curDirPtr</I>
<LI>Read and allocate the bitmap : <I>vol->bitmapBlocks[],
vol->bitmapTable[], vol->bitmapSize, vol->bitmapBlocksChg[]</I>.
</OL>
<HR>
<P ALIGN=CENTER><FONT SIZE=+2> adfUnMount() </FONT></P>
<H2>Syntax</H2>
<B>void</B> adfUnMount(<B>struct Volume *</B>vol)
<H2>Description</H2>
Release a Volume. Free the bitmap structures.
<P>
<HR>
<P ALIGN=CENTER><FONT SIZE=+2> adfCountFreeBlocks() </FONT></P>
<H2>Syntax</H2>
<B>long</B> adfCountFreeBlocks(<B>struct Volume *</B>vol)
<H2>Description</H2>
Counts the free blocks of a Volume.
<H2>Return values</H2>
The number of free blocks.
<P>
<HR>
<P ALIGN=CENTER><FONT SIZE=+2> adfInstallBootBlock() </FONT></P>
<H2>Syntax</H2>
<B>RETCODE</B> adfInstallBootBlock(<B>struct Volume*</B> vol, <B>unsigned char*</B> code)
<H2>Description</H2>
Install a bootblock on a floppy disk. Won't work on any other device.
<P>
You must provide the 1024 bytes large bootblock.<BR>
Doesn't modify the initial 'DOS' header and dosType. Recalculates the checksum.
<H2>Return values</H2>
RC_OK, something different in case of error.
<P>
<HR>
<P ALIGN=CENTER><FONT SIZE=+2> adfCreateHdFile() </FONT></P>
<H2>Syntax</H2>
<B>RETCODE</B> adfCreateHdFile(<B>struct Device*</B> dev, <B>char*</B> volName, <B>int</B> volType)
<H2>Description</H2>
Create an hardfile on a dump file. The size of this file must be larger
than 1802240 bytes, the size of an high density floppy dump.
<P>
Use adfCreateDumpDevice() the create the device passed to adfCreateHdFile().
<H2>Return values</H2>
RC_OK, something different in case of error.
<H2>Internals</H2>
The device is created with one volume, and <I>dev->devType if filled with
DEVTYPE_HARDFILE.
<P>
<HR>
</BODY>
</HTML>
|