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 "bfs.h" 14 15 16 class Volume; 17 class Transaction; 18 19 20 class Inode { 21 public: 22 Inode(const char *name,int32 mode = S_STR_INDEX | S_ALLOW_DUPS); 23 ~Inode(); 24 25 rw_lock &Lock() { return fLock; } 26 27 status_t FindBlockRun(off_t pos,block_run &run,off_t &offset); 28 status_t Append(Transaction *,off_t bytes); 29 status_t SetFileSize(Transaction *,off_t bytes); 30 31 Volume *GetVolume() const { return fVolume; } 32 off_t ID() const { return 0; } 33 int32 Mode() const { return fMode; } 34 char *Name() const { return "whatever"; } 35 block_run BlockRun() const { return block_run::Run(0,0,0); } 36 block_run Parent() const { return block_run::Run(0,0,0); } 37 off_t BlockNumber() const { return 0; } 38 bfs_inode *Node() { return (bfs_inode *)1; } 39 40 off_t Size() const { return fSize; } 41 bool IsContainer() const { return true; } 42 bool IsDirectory() const { return true; } 43 44 private: 45 friend void dump_inode(Inode &inode); 46 47 Volume *fVolume; 48 BFile fFile; 49 off_t fSize; 50 rw_lock fLock; 51 int32 fMode; 52 53 // for dump_inode() only: 54 off_t fOldSize; 55 off_t fOldLastModified; 56 off_t fBlockNumber; 57 void *fTree; 58 void *fAttributes; 59 }; 60 61 #endif /* INODE_H */ 62