1// Entry.h 2 3#ifndef ENTRY_H 4#define ENTRY_H 5 6#include <fs_interface.h> 7#include <SupportDefs.h> 8 9#include <util/DoublyLinkedList.h> 10 11#include "String.h" 12 13class AllocationInfo; 14class Directory; 15class EntryIterator; 16class Node; 17 18class Entry : public DoublyLinkedListLinkImpl<Entry> { 19public: 20 Entry(const char *name, Node *node = NULL, Directory *parent = NULL); 21 ~Entry(); 22 23 status_t InitCheck() const; 24 25 inline void SetParent(Directory *parent) { fParent = parent; } 26 Directory *GetParent() const { return fParent; } 27 28// inline void SetNode(Node *node) { fNode = node; } 29 status_t Link(Node *node); 30 status_t Unlink(); 31 Node *GetNode() const { return fNode; } 32 33 status_t SetName(const char *newName); 34 inline const char *GetName() const { return fName.GetString(); } 35 36// inline Volume *GetVolume() const { return fVolume; } 37 38 inline DoublyLinkedListLink<Entry> *GetReferrerLink() 39 { return &fReferrerLink; } 40 41 // entry iterator management 42 void AttachEntryIterator(EntryIterator *iterator); 43 void DetachEntryIterator(EntryIterator *iterator); 44 inline DoublyLinkedList<EntryIterator> *GetEntryIteratorList() 45 { return &fIterators; } 46 47 // debugging 48 void GetAllocationInfo(AllocationInfo &info); 49 50private: 51 Directory *fParent; 52 Node *fNode; 53 String fName; 54 DoublyLinkedListLink<Entry> fReferrerLink; 55 // iterator management 56 DoublyLinkedList<EntryIterator> fIterators; 57}; 58 59// GetNodeReferrerLink 60class GetNodeReferrerLink { 61private: 62 typedef DoublyLinkedListLink<Entry> Link; 63 64public: 65 inline Link *operator()(Entry *entry) const 66 { 67 return entry->GetReferrerLink(); 68 } 69}; 70 71#endif // ENTRY_H 72