1 /* 2 * Copyright 2020, Shubham Bhagat, shubhambhagat111@yahoo.com 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 #ifndef _DIRECTORY_H_ 6 #define _DIRECTORY_H_ 7 8 9 #include "BPlusTree.h" 10 #include "Extent.h" 11 #include "Inode.h" 12 #include "LeafDirectory.h" 13 #include "Node.h" 14 #include "ShortDirectory.h" 15 16 17 /* 18 * This class should act as a layer between any kind of directory 19 * and the kernel interface 20 */ 21 class DirectoryIterator { 22 public: 23 DirectoryIterator(Inode* inode); 24 ~DirectoryIterator(); 25 status_t Init(); 26 bool IsLocalDir() { return fInode->IsLocal(); } 27 status_t GetNext(char* name, size_t* length, 28 xfs_ino_t* ino); 29 status_t Lookup(const char* name, size_t length, 30 xfs_ino_t* id); 31 32 private: 33 Inode* fInode; 34 ShortDirectory* fShortDir; 35 // Short form Directory type 36 Extent* fExtentDir; 37 // Extent form Directory type 38 // TODO: Rename all to block type 39 LeafDirectory* fLeafDir; 40 // Extent based leaf directory 41 NodeDirectory* fNodeDir; 42 TreeDirectory* fTreeDir; 43 }; 44 45 46 #endif 47