xref: /haiku/src/add-ons/kernel/file_systems/netfs/server/Entry.h (revision 68ea01249e1e2088933cb12f9c28d4e5c5d1c9ef)
1 // Entry.h
2 
3 #ifndef NET_FS_ENTRY_H
4 #define NET_FS_ENTRY_H
5 
6 #include <HashString.h>
7 #include <util/DoublyLinkedList.h>
8 
9 #include "EntryRef.h"
10 
11 class Directory;
12 class Node;
13 class Path;
14 class Volume;
15 
16 // Entry
17 class Entry : public DoublyLinkedListLinkImpl<Entry> {
18 public:
19 								Entry(Volume* volume, Directory* directory,
20 									const char* name, Node* node);
21 								~Entry();
22 
23 			status_t			InitCheck() const;
24 
25 			Volume*				GetVolume() const;
26 			Directory*			GetDirectory() const;
27 			NoAllocEntryRef		GetEntryRef() const;
28 			dev_t				GetVolumeID() const;
29 			ino_t				GetDirectoryID() const;
30 			const char*			GetName() const;
31 			Node*				GetNode() const;
32 
33 			status_t			GetPath(Path* path);
34 
35 			bool				Exists() const;
36 
37 			bool				IsActualEntry() const;
38 
39 private:
40 			struct GetDirEntryLink;
41 			friend struct GetDirEntryLink;
42 			friend class Directory;
43 
44 			Volume*				fVolume;
45 			Directory*			fDirectory;
46 			HashString			fName;
47 			Node*				fNode;
48 			DoublyLinkedListLink<Entry> fDirEntryLink;
49 };
50 
51 // GetDirEntryLink
52 struct Entry::GetDirEntryLink {
53 	DoublyLinkedListLink<Entry>* operator()(Entry* entry) const
54 	{
55 		return &entry->fDirEntryLink;
56 	}
57 
58 	const DoublyLinkedListLink<Entry>* operator()(const Entry* entry) const
59 	{
60 		return &entry->fDirEntryLink;
61 	}
62 };
63 
64 #endif	// NET_FS_ENTRY_H
65