/* * Disk.h * ProFUSE * * Created by Kelvin Sherlock on 12/18/08. * */ #ifndef __DISK_H__ #define __DISK_H__ #include #include #include #include #include #include #include enum { P8_OK = 0, P8_INTERNAL_ERROR, P8_INVALID_FORK, P8_INVALID_BLOCK, P8_INVALID_STORAGE_TYPE, P8_CYCLICAL_BLOCK }; enum { P8_DATA_FORK = 0, P8_RESOURCE_FORK = 1 }; /* flags */ enum { P8_DOS_ORDER = 1, P8_2MG = 2, P8_DC42 = 4 }; class Disk; typedef SHARED_PTR(Disk) DiskPointer; class Disk { public: ~Disk(); //static Disk *Open2MG(const char *file); static DiskPointer OpenFile(Device::BlockDevicePointer device); int Normalize(FileEntry &f, unsigned fork, ExtendedEntry *ee = NULL); int Read(unsigned block, void *buffer); int ReadIndex(unsigned block, void *buffer, unsigned level, off_t offset, unsigned blocks); int ReadFile(const FileEntry &f, void *buffer); void *ReadFile(const FileEntry &f, unsigned fork, uint32_t *size, int * error); int ReadVolume(VolumeEntry *volume, std::vector *files); int ReadDirectory(unsigned block, SubdirEntry *dir, std::vector *files); private: Disk(); Disk(Device::BlockDevicePointer device); unsigned _blocks; Device::BlockDevicePointer _device; }; #endif