1 #ifndef INODE_H 2 #define INODE_H 3 /* Inode - emulation for the B+Tree torture test 4 ** 5 ** Initial version by Axel Dörfler, axeld@pinc-software.de 6 ** This file may be used under the terms of the OpenBeOS License. 7 */ 8 9 10 #include <SupportDefs.h> 11 #include <File.h> 12 13 #include "Lock.h" 14 #include "bfs.h" 15 16 17 class Volume; 18 class Transaction; 19 20 21 class Inode { 22 public: 23 Inode(const char *name,int32 mode = S_STR_INDEX | S_ALLOW_DUPS); 24 ~Inode(); 25 26 ReadWriteLock &Lock() { return fLock; } 27 28 status_t FindBlockRun(off_t pos,block_run &run,off_t &offset); 29 status_t Append(Transaction *,off_t bytes); 30 status_t SetFileSize(Transaction *,off_t bytes); 31 32 Volume *GetVolume() const { return fVolume; } 33 off_t ID() const { return 0; } 34 int32 Mode() const { return fMode; } 35 char *Name() const { return "whatever"; } 36 block_run BlockRun() const { return block_run::Run(0,0,0); } 37 block_run Parent() const { return block_run::Run(0,0,0); } 38 off_t BlockNumber() const { return 0; } 39 bfs_inode *Node() { return (bfs_inode *)1; } 40 41 off_t Size() const { return fSize; } 42 bool IsContainer() const { return true; } 43 bool IsDirectory() const { return true; } 44 45 private: 46 friend void dump_inode(Inode &inode); 47 48 Volume *fVolume; 49 BFile fFile; 50 off_t fSize; 51 ReadWriteLock fLock; 52 int32 fMode; 53 54 // for dump_inode() only: 55 off_t fOldSize; 56 off_t fOldLastModified; 57 off_t fBlockNumber; 58 void *fTree; 59 void *fAttributes; 60 }; 61 62 #endif /* INODE_H */ 63