btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / private / storage / DiskSystemAddOnManager.h
bloba7798e54c52ad935e30ca56aa30fdd4dea6e4415
1 /*
2 * Copyright 2007, Ingo Weinhold, bonefish@users.sf.net.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef _DISK_SYSTEM_ADD_ON_MANAGER_H
6 #define _DISK_SYSTEM_ADD_ON_MANAGER_H
8 #include <FindDirectory.h>
9 #include <List.h>
10 #include <Locker.h>
13 class BDiskSystemAddOn;
16 namespace BPrivate {
19 class DiskSystemAddOnManager {
20 public:
21 static DiskSystemAddOnManager* Default();
23 bool Lock();
24 void Unlock();
26 // load/unload all disk system add-ons
27 status_t LoadDiskSystems();
28 void UnloadDiskSystems();
30 // manager must be locked
31 int32 CountAddOns() const;
32 BDiskSystemAddOn* AddOnAt(int32 index) const;
34 // manager will be locked
35 BDiskSystemAddOn* GetAddOn(const char* name);
36 void PutAddOn(BDiskSystemAddOn* addOn);
38 private:
39 struct AddOnImage;
40 struct AddOn;
41 struct StringSet;
43 DiskSystemAddOnManager();
45 static void _InitSingleton();
47 AddOn* _AddOnAt(int32 index) const;
48 void _PutAddOn(int32 index);
50 status_t _LoadAddOns(StringSet& alreadyLoaded,
51 directory_which directory);
53 private:
54 mutable BLocker fLock;
55 BList fAddOns;
56 BList fAddOnsToBeUnloaded;
57 int32 fLoadCount;
59 static DiskSystemAddOnManager* sManager;
63 } // namespace BPrivate
65 using BPrivate::DiskSystemAddOnManager;
67 #endif // _DISK_SYSTEM_ADD_ON_MANAGER_H