1 /* 2 * Copyright 2020 Suhel Mehta, mehtasuhel@gmail.com 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 #ifndef VOLUME_H 6 #define VOLUME_H 7 8 #include "ufs2.h" 9 10 class Volume { 11 public: 12 Volume(fs_volume* volume); 13 ~Volume(); 14 15 status_t Mount(const char* device, uint32 flags); 16 status_t Unmount(); 17 status_t Initialize(int fd, const char* name, 18 uint32 blockSize, uint32 flags); 19 20 bool IsValidSuperBlock(); 21 bool IsValidInodeBlock(off_t block) const; 22 bool IsReadOnly() const; 23 fs_volume* FSVolume() const { return fFSVolume; } 24 ufs2_super_block& SuperBlock() { return fSuperBlock; } 25 status_t LoadSuperBlock(); 26 static status_t Identify(int fd, ufs2_super_block* superBlock); 27 28 private: 29 fs_volume* fFSVolume; 30 ufs2_super_block fSuperBlock; 31 }; 32 33 #endif // VOLUME_H 34