1 /* Inode - emulation for the B+Tree torture test 2 ** 3 ** Initial version by Axel Dörfler, axeld@pinc-software.de 4 ** This file may be used under the terms of the OpenBeOS License. 5 */ 6 7 8 #include "Inode.h" 9 #include "Volume.h" 10 #include "Journal.h" 11 12 13 Inode::Inode(const char *name,int32 mode) 14 : 15 fMode(mode) 16 { 17 fFile.SetTo(name,B_CREATE_FILE | B_READ_WRITE | B_ERASE_FILE); 18 fSize = 0; 19 fVolume = new Volume(&fFile); 20 } 21 22 23 Inode::~Inode() 24 { 25 delete fVolume; 26 } 27 28 29 status_t 30 Inode::FindBlockRun(off_t pos, block_run &run, off_t &offset) 31 { 32 // the whole file data is covered by this one block_run structure... 33 run.SetTo(0,0,1); 34 offset = 0; 35 return B_OK; 36 } 37 38 39 status_t 40 Inode::Append(Transaction *transaction, off_t bytes) 41 { 42 return SetFileSize(transaction,Size() + bytes); 43 } 44 45 46 status_t 47 Inode::SetFileSize(Transaction *, off_t bytes) 48 { 49 //printf("set size = %ld\n",bytes); 50 fSize = bytes; 51 return fFile.SetSize(bytes); 52 } 53 54