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