1// FDManager.h 2 3#ifndef NET_FS_FD_MANAGER_H 4#define NET_FS_FD_MANAGER_H 5 6#include <SupportDefs.h> 7 8#include "Locker.h" 9 10class BDirectory; 11class BEntry; 12class BFile; 13class BNode; 14 15class FDManager { 16private: 17 FDManager(); 18 ~FDManager(); 19 20 status_t Init(); 21 22public: 23 static status_t CreateDefault(); 24 static void DeleteDefault(); 25 static FDManager* GetDefault(); 26 27 static status_t SetDirectory(BDirectory* directory, 28 const node_ref* ref); 29 static status_t SetEntry(BEntry* entry, const entry_ref* ref); 30 static status_t SetEntry(BEntry* entry, const char* path); 31 static status_t SetFile(BFile* file, const char* path, 32 uint32 openMode); 33 static status_t SetNode(BNode* node, const entry_ref* ref); 34 35 static status_t Open(const char* path, uint32 openMode, 36 mode_t mode, int& fd); 37 static status_t OpenDir(const char* path, DIR*& dir); 38 static status_t OpenAttrDir(const char* path, DIR*& dir); 39 40private: 41 status_t _IncreaseLimit(); 42 43private: 44 Locker fLock; 45 int32 fFDLimit; 46 47 static FDManager* sManager; 48}; 49 50#endif // NET_FS_FD_MANAGER_H 51