2 ** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the MIT License.
11 #include <SupportDefs.h>
25 Volume(boot::Partition
*partition
);
29 status_t
GetName(char *name
, size_t size
) const;
31 int Device() const { return fDevice
; }
32 Directory
*Root() { return fRoot
; }
33 int32
FatBits() const { return fFatBits
; }
34 uint32
DataStart() const { return fDataStart
; }
36 int32
BlockSize() const { return fBlockSize
; }
37 int32
ClusterSize() const { return fSectorsPerCluster
* fBytesPerSector
; }
39 int32
BlockShift() const { return fBlockShift
; }
40 int32
SectorShift() const { return fSectorShift
; }
41 int32
ClusterShift() const { return fClusterShift
; }
43 int32
NumBlocks() const { return (int32
)((off_t
)fTotalSectors
* fBytesPerSector
/ fBlockSize
); }
44 int32
NumSectors() const { return fTotalSectors
; }
45 int32
NumClusters() const { return fTotalClusters
; }
47 uint32
NextCluster(uint32 cluster
, uint32 skip
=0);
48 bool IsValidCluster(uint32 cluster
) const;
49 bool IsLastCluster(uint32 cluster
) const;
50 uint32
InvalidClusterID() const { return (1 << fFatBits
) - 1; }
52 status_t
AllocateCluster(uint32 previousCluster
,
55 off_t
ClusterToOffset(uint32 cluster
) const;
56 // uint32 ToCluster(off_t offset) const { return offset >> ClusterShift(); }
57 off_t
BlockToOffset(off_t block
) const
58 { return block
<< BlockShift(); }
59 uint32
ToBlock(off_t offset
) const { return offset
>> BlockShift(); }
62 status_t
_UpdateCluster(uint32 cluster
, uint32 value
);
63 status_t
_ClusterAllocated(uint32 cluster
);
71 // from the boot/fsinfo sectors
72 uint32 fBytesPerSector
;
73 uint32 fSectorsPerCluster
;
74 uint32 fReservedSectors
;
76 uint32 fSectorsPerFat
;
79 uint16 fMaxRootEntries
;
83 uint32 fTotalClusters
;
84 uint32 fRootDirCluster
;
87 CachedBlock
*fCachedBlock
;