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