BPicture: Fix archive constructor.
[haiku.git] / src / add-ons / kernel / file_systems / udf / Volume.h
blob03487d3117853e71eba30689c5e4ea8a8cfee3fc
1 /*
2 * Copyright 2012, Jérôme Duval, korli@users.berlios.de.
3 * Copyright 2008, Salvatore Benedetto, salvatore.benedetto@gmail.com
4 * Copyright 2003, Tyler Dauwalder, tyler@dauwalder.net.
5 * Distributed under the terms of the MIT License.
6 */
7 #ifndef _UDF_VOLUME_H
8 #define _UDF_VOLUME_H
10 /*! \file Volume.h */
12 #include <fs_info.h>
13 #include <fs_interface.h>
14 #include <KernelExport.h>
16 #include <util/kernel_cpp.h>
18 #include <dirent.h>
20 #include "UdfString.h"
21 #include "UdfStructures.h"
22 #include "Partition.h"
24 class Icb;
26 class Volume {
27 public:
28 Volume(fs_volume *volume);
29 ~Volume();
31 status_t Mount(const char *device, off_t offset, off_t length,
32 uint32 blockSize, uint32 flags);
33 status_t Unmount();
35 bool IsReadOnly() { return true; }
37 // Address mapping
38 status_t MapBlock(long_address address, off_t *mappedBlock);
39 status_t MapExtent(long_address logicalExtent,
40 extent_address &physicalExtent);
42 // Miscellaneous info
43 const char *Name() const;
44 int Device() const { return fDevice; }
45 dev_t ID() const { return fFSVolume ? fFSVolume->id : -1; }
46 fs_volume *FSVolume() const { return fFSVolume; }
47 off_t Offset() const { return fOffset; }
48 off_t Length() const { return fLength; }
49 void *BlockCache() {return fBlockCache; }
50 uint32 BlockSize() const { return fBlockSize; }
51 uint32 BlockShift() const { return fBlockShift; }
52 bool Mounted() const { return fMounted; }
53 Icb* RootIcb() { return fRootIcb; }
54 primary_volume_descriptor *PrimaryVolumeDescriptor()
55 { return &fPrimaryVolumeDescriptor; }
57 private:
58 void _Unset();
60 status_t _SetPartition(uint number, Partition *partition);
61 Partition* _GetPartition(uint number);
63 private:
64 void *fBlockCache;
65 uint32 fBlockShift;
66 uint32 fBlockSize;
67 int fDevice;
68 fs_volume *fFSVolume;
69 off_t fLength;
70 bool fMounted;
71 UdfString fName;
72 off_t fOffset;
73 Partition *fPartitions[UDF_MAX_PARTITION_MAPS];
74 Icb *fRootIcb; // Destroyed by vfs via callback to put_node()
75 primary_volume_descriptor fPrimaryVolumeDescriptor;
78 #endif // _UDF_VOLUME_H