1 //---------------------------------------------------------------------- 2 // This software is part of the OpenBeOS distribution and is covered 3 // by the OpenBeOS license. 4 // 5 // Copyright (c) 2003 Tyler Dauwalder, tyler@dauwalder.net 6 // Mad props to Axel Dörfler and his BFS implementation, from which 7 // this UDF implementation draws much influence (and a little code :-P). 8 //--------------------------------------------------------------------- 9 #ifndef _UDF_VOLUME_H 10 #define _UDF_VOLUME_H 11 12 /*! \file Volume.h 13 */ 14 15 #include <KernelExport.h> 16 #ifndef _IMPEXP_KERNEL 17 # define _IMPEXP_KERNEL 18 #endif 19 20 #ifdef COMPILE_FOR_R5 21 extern "C" { 22 #endif 23 #include <fsproto.h> 24 #ifdef COMPILE_FOR_R5 25 } 26 #endif 27 28 #include "kernel_cpp.h" 29 #include "UdfDebug.h" 30 31 #include "UdfString.h" 32 #include "UdfStructures.h" 33 #include "Partition.h" 34 35 namespace Udf { 36 37 class Icb; 38 39 class Volume { 40 public: 41 // Construction/destruction 42 Volume(nspace_id id); 43 ~Volume(); 44 45 // Mounting/unmounting 46 status_t Mount(const char *deviceName, off_t offset, off_t length, 47 uint32 blockSize, uint32 flags); 48 status_t Unmount(); 49 50 // Address mapping 51 status_t MapBlock(long_address address, off_t *mappedBlock); 52 status_t MapExtent(long_address logicalExtent, extent_address &physicalExtent); 53 54 // Miscellaneous info 55 const char *Name() const; 56 int Device() const { return fDevice; } 57 nspace_id Id() const { return fId; } 58 off_t Offset() const { return fOffset; } 59 off_t Length() const { return fLength; } 60 uint32 BlockSize() const { return fBlockSize; } 61 uint32 BlockShift() const { return fBlockShift; } 62 bool Mounted() const { return fMounted; } 63 Icb* RootIcb() { return fRootIcb; } 64 65 private: 66 Volume(); // unimplemented 67 Volume(const Volume &ref); // unimplemented 68 Volume& operator=(const Volume &ref); // unimplemented 69 70 void _Unset(); 71 72 status_t _SetPartition(uint number, Partition *partition); 73 Partition* _GetPartition(uint number); 74 75 private: 76 nspace_id fId; 77 int fDevice; 78 bool fMounted; 79 off_t fOffset; 80 off_t fLength; 81 uint32 fBlockSize; 82 uint32 fBlockShift; 83 Partition *fPartitions[UDF_MAX_PARTITION_MAPS]; 84 Icb *fRootIcb; // Destroyed by vfs via callback to release_node() 85 String fName; 86 }; 87 88 }; // namespace Udf 89 90 #endif // _UDF_VOLUME_H 91