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 "Extent.h" 10 #include "Inode.h" 11 #include "LeafDirectory.h" 12 #include "Node.h" 13 #include "ShortDirectory.h" 14 15 16 /* 17 * This class should act as a layer between any kind of directory 18 * and the kernel interface 19 */ 20 class DirectoryIterator { 21 public: 22 DirectoryIterator(Inode* inode); 23 ~DirectoryIterator(); 24 status_t Init(); 25 bool IsLocalDir() { return fInode->IsLocal(); } 26 status_t GetNext(char* name, size_t* length, 27 xfs_ino_t* ino); 28 status_t Lookup(const char* name, size_t length, 29 xfs_ino_t* id); 30 31 private: 32 Inode* fInode; 33 ShortDirectory* fShortDir; 34 // Short form Directory type 35 Extent* fExtentDir; 36 // Extent form Directory type 37 // TODO: Rename all to block type 38 LeafDirectory* fLeafDir; 39 // Extent based leaf directory 40 NodeDirectory* fNodeDir; 41 }; 42 43 44 #endif 45