xref: /haiku/src/add-ons/kernel/file_systems/netfs/server/Node.h (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
1 // Node.h
2 
3 #ifndef NET_FS_NODE_H
4 #define NET_FS_NODE_H
5 
6 #include <util/DoublyLinkedList.h>
7 
8 #include "AttributeDirectory.h"
9 #include "NodeRef.h"
10 
11 // required by mwcc -- otherwise it can't instantiate the list
12 #include "Entry.h"
13 
14 class AttrDirIterator;
15 class Entry;
16 class FileHandle;
17 class NodeHandle;
18 class Path;
19 class Volume;
20 
21 // Node
22 class Node : public AttributeDirectory {
23 public:
24 								Node(Volume* volume, const struct stat& st);
25 	virtual						~Node();
26 
27 			Volume*				GetVolume() const;
28 			node_ref			GetNodeRef() const;
29 			dev_t				GetVolumeID() const;
30 			ino_t				GetID() const;
31 
32 			void				AddReferringEntry(Entry* entry);
33 			void				RemoveReferringEntry(Entry* entry);
34 			Entry*				FindReferringEntry(dev_t volumeID,
35 									ino_t directoryID, const char* name);
36 			Entry*				GetFirstReferringEntry() const;
37 			Entry*				GetNextReferringEntry(Entry* entry) const;
38 			Entry*				FindReferringEntry(const entry_ref& entryRef);
39 	virtual	Entry*				GetActualReferringEntry() const;
40 
41 			const struct stat&	GetStat() const;
42 			status_t			UpdateStat();
43 
44 			bool				IsDirectory() const;
45 			bool				IsFile() const;
46 			bool				IsSymlink() const;
47 
48 			status_t			GetPath(Path* path);
49 
50 			status_t			Open(int openMode, FileHandle** fileHandle);
51 			status_t			OpenAttrDir(AttrDirIterator** iterator);
52 	virtual	status_t			OpenNode(BNode& node);
53 
54 			status_t			ReadSymlink(char* buffer, int32 bufferSize,
55 									int32* bytesRead = NULL);
56 
57 protected:
58 			status_t			_CheckNodeHandle(NodeHandle* nodeHandle);
59 
60 protected:
61 			typedef DoublyLinkedList<Entry> EntryList;
62 
63 			Volume*				fVolume;
64 			struct stat			fStat;
65 			EntryList			fReferringEntries;
66 };
67 
68 
69 
70 #endif	// NET_FS_NODE_H
71