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