#include "Inode.h"
#include "Volume.h"
#include "Journal.h"
Inode::Inode(const char *name,int32 mode)
:
fMode(mode)
{
rw_lock_init(&fLock, "inode lock");
fFile.SetTo(name,B_CREATE_FILE | B_READ_WRITE | B_ERASE_FILE);
fSize = 0;
fVolume = new Volume(&fFile);
}
Inode::~Inode()
{
delete fVolume;
}
status_t
Inode::FindBlockRun(off_t pos, block_run &run, off_t &offset)
{
run.SetTo(0,0,1);
offset = 0;
return B_OK;
}
status_t
Inode::Append(Transaction& transaction, off_t bytes)
{
return SetFileSize(transaction, Size() + bytes);
}
status_t
Inode::SetFileSize(Transaction&, off_t bytes)
{
fSize = bytes;
return fFile.SetSize(bytes);
}