xref: /haiku/src/add-ons/kernel/file_systems/udf/VirtualPartition.h (revision 4e77893b64fd53da5b3ec706f3798aa7dfb2e6e6)
1*4e77893bSTyler Dauwalder //----------------------------------------------------------------------
2*4e77893bSTyler Dauwalder //  This software is part of the OpenBeOS distribution and is covered
3*4e77893bSTyler Dauwalder //  by the OpenBeOS license.
4*4e77893bSTyler Dauwalder //
5*4e77893bSTyler Dauwalder //  Copyright (c) 2003 Tyler Dauwalder, tyler@dauwalder.net
6*4e77893bSTyler Dauwalder //---------------------------------------------------------------------
7*4e77893bSTyler Dauwalder #ifndef _UDF_VIRTUAL_PARTITION_H
8*4e77893bSTyler Dauwalder #define _UDF_VIRTUAL_PARTITION_H
9*4e77893bSTyler Dauwalder 
10*4e77893bSTyler Dauwalder /*! \file VirtualPartition.h
11*4e77893bSTyler Dauwalder */
12*4e77893bSTyler Dauwalder 
13*4e77893bSTyler Dauwalder #include <kernel_cpp.h>
14*4e77893bSTyler Dauwalder 
15*4e77893bSTyler Dauwalder #include "Partition.h"
16*4e77893bSTyler Dauwalder #include "PhysicalPartition.h"
17*4e77893bSTyler Dauwalder #include "UdfDebug.h"
18*4e77893bSTyler Dauwalder 
19*4e77893bSTyler Dauwalder namespace Udf {
20*4e77893bSTyler Dauwalder 
21*4e77893bSTyler Dauwalder /*! \brief Type 2 virtual partition
22*4e77893bSTyler Dauwalder 
23*4e77893bSTyler Dauwalder 	VirtualPartitions add an extra layer of indirection between logical
24*4e77893bSTyler Dauwalder 	block numbers and physical block numbers, allowing the underlying
25*4e77893bSTyler Dauwalder 	physical block numbers to be changed without changing the original
26*4e77893bSTyler Dauwalder 	references to (virtual) logical block numbers.
27*4e77893bSTyler Dauwalder 
28*4e77893bSTyler Dauwalder 	Note that VirtualPartitions should be found only on sequentially written
29*4e77893bSTyler Dauwalder 	media such as CD-R, per UDF-2.01 2.2.10.
30*4e77893bSTyler Dauwalder 
31*4e77893bSTyler Dauwalder 	See also UDF-2.01 2.2.8, UDF-2.01 2.2.10
32*4e77893bSTyler Dauwalder */
33*4e77893bSTyler Dauwalder class VirtualPartition : public Partition {
34*4e77893bSTyler Dauwalder public:
35*4e77893bSTyler Dauwalder 	VirtualPartition(PhysicalPartition &physicalPartition);
36*4e77893bSTyler Dauwalder 	virtual ~VirtualPartition();
37*4e77893bSTyler Dauwalder 	virtual status_t MapBlock(uint32 logicalBlock, uint32 &physicalBlock);
38*4e77893bSTyler Dauwalder 
39*4e77893bSTyler Dauwalder 	status_t InitCheck();
40*4e77893bSTyler Dauwalder private:
41*4e77893bSTyler Dauwalder 	PhysicalPartition fPhysicalPartition;
42*4e77893bSTyler Dauwalder };
43*4e77893bSTyler Dauwalder 
44*4e77893bSTyler Dauwalder };	// namespace Udf
45*4e77893bSTyler Dauwalder 
46*4e77893bSTyler Dauwalder #endif	// _UDF_VIRTUAL_PARTITION_H
47