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
14class AttrDirIterator;
15class Entry;
16class FileHandle;
17class NodeHandle;
18class Path;
19class Volume;
20
21// Node
22class Node : public AttributeDirectory {
23public:
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
57protected:
58			status_t			_CheckNodeHandle(NodeHandle* nodeHandle);
59
60protected:
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