#ifndef VOLUME_H
#define VOLUME_H
#include <fs_interface.h>
#include <SupportDefs.h>
#include "hashes.h"
#include "List.h"
struct reiserfs_super_block;
class BlockCache;
class Tree;
class Settings;
class SuperBlock;
class VNode;
class Volume {
public:
Volume();
~Volume();
status_t Identify(int fd, partition_data *partition);
status_t Mount(fs_volume *fsVolume, const char *path);
status_t Unmount();
dev_t GetID() const { return fFSVolume->id; }
fs_volume *GetFSVolume() const { return fFSVolume; }
off_t GetBlockSize() const;
off_t CountBlocks() const;
off_t CountFreeBlocks() const;
const char *GetName() const;
void UpdateName(partition_id partitionID);
const char *GetDeviceName() const;
BlockCache *GetBlockCache() const { return fBlockCache; }
Tree *GetTree() const { return fTree; }
Settings *GetSettings() const { return fSettings; }
status_t GetKeyOffsetForName(const char * name, int len, uint64 *result);
VNode *GetRootVNode() const { return fRootVNode; }
status_t GetVNode(ino_t id, VNode **node);
status_t PutVNode(ino_t id);
status_t FindVNode(ino_t id, VNode *node);
status_t FindVNode(uint32 dirID, uint32 objectID, VNode *node);
status_t FindDirEntry(VNode *dir, const char *entryName,
VNode *foundNode, bool failIfHidden = false);
status_t ReadLink(VNode *node, char *buffer, size_t bufferSize,
size_t *linkLength);
status_t FindEntry(const VNode *rootDir, const char *path,
VNode *foundNode);
bool IsNegativeEntry(ino_t id);
bool IsNegativeEntry(uint32 dirID, uint32 objectID);
bool GetHideEsoteric() const;
private:
status_t _ReadSuperBlock();
void _InitHashFunction();
uint32 _DetectHashFunction();
bool _VerifyHashFunction(hash_function_t function);
void _InitNegativeEntries();
private:
fs_volume *fFSVolume;
int fDevice;
BlockCache *fBlockCache;
Tree *fTree;
SuperBlock *fSuperBlock;
hash_function_t fHashFunction;
VNode *fRootVNode;
char *fDeviceName;
Settings *fSettings;
List<ino_t> fNegativeEntries;
char fVolumeName[B_OS_NAME_LENGTH];
};
#endif