vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / kernel / file_systems / udf / SparablePartition.h
blobc6049d38bfb26933a0101a96b448392973cc23b7
1 //----------------------------------------------------------------------
2 // This software is part of the OpenBeOS distribution and is covered
3 // by the MIT License.
4 //
5 // Copyright (c) 2003 Tyler Dauwalder, tyler@dauwalder.net
6 //---------------------------------------------------------------------
7 #ifndef _UDF_SPARABLE_PARTITION_H
8 #define _UDF_SPARABLE_PARTITION_H
10 /*! \file SparablePartition.h
13 #include <util/kernel_cpp.h>
15 #include "UdfStructures.h"
16 #include "Partition.h"
17 #include "UdfDebug.h"
19 /*! \brief Type 2 sparable partition
21 Sparable partitions provide a defect-managed partition
22 space for media that does not implicitly provide defect management,
23 such as CD-RW. Arbitrary packets of blocks in the sparable partition
24 may be transparently remapped to other locations on disc should the
25 original locations become defective.
27 Per UDF-2.01 2.2.11, sparable partitions shall be recorded only on
28 disk/drive systems that do not perform defect management.
30 See also UDF-2.01 2.2.9, UDF-2.01 2.2.11
32 class SparablePartition : public Partition {
33 public:
34 SparablePartition(uint16 number, uint32 start, uint32 length, uint16 packetLength,
35 uint8 tableCount, uint32 *tableLocations);
36 virtual ~SparablePartition();
37 virtual status_t MapBlock(uint32 logicalBlock, off_t &physicalBlock);
39 status_t InitCheck();
41 uint16 Number() const { return fNumber; }
42 uint32 Start() const { return fStart; }
43 uint32 Length() const { return fLength; }
44 uint32 PacketLength() const { return fPacketLength; }
45 uint8 TableCount() const { return fTableCount; }
47 //! Maximum number of redundant sparing tables per SparablePartition
48 static const uint8 kMaxSparingTableCount = UDF_MAX_SPARING_TABLE_COUNT;
49 private:
50 uint16 fNumber;
51 uint32 fStart;
52 uint32 fLength;
53 uint32 fPacketLength;
54 uint8 fTableCount;
55 uint32 fTableLocations[kMaxSparingTableCount];
56 status_t fInitStatus;
59 #endif // _UDF_SPARABLE_PARTITION_H