xref: /haiku/src/servers/package/PackageDaemon.h (revision 17889a8c70dbb3d59c1412f6431968753c767bab)
1 /*
2  * Copyright 2013, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Ingo Weinhold <ingo_weinhold@gmx.de>
7  */
8 #ifndef PACKAGE_DAEMON_H
9 #define PACKAGE_DAEMON_H
10 
11 
12 #include <fs_info.h>
13 #include <Node.h>
14 #include <ObjectList.h>
15 #include <VolumeRoster.h>
16 
17 #include <Server.h>
18 
19 
20 class Root;
21 class Volume;
22 
23 
24 class PackageDaemon : public BServer {
25 public:
26 								PackageDaemon(status_t* _error);
27 	virtual						~PackageDaemon();
28 
29 			status_t			Init();
30 
31 	virtual	void				MessageReceived(BMessage* message);
32 
33 private:
34 			typedef BObjectList<Root> RootList;
35 
36 private:
37 			status_t			_RegisterVolume(dev_t device);
38 			void				_UnregisterVolume(Volume* volume);
39 
40 			status_t			_GetOrCreateRoot(const node_ref& nodeRef,
41 									Root*& _root);
42 			Root*				_FindRoot(const node_ref& nodeRef) const;
43 			void				_PutRoot(Root* root);
44 
45 			Volume*				_FindVolume(dev_t deviceID) const;
46 
47 			void				_HandleVolumeMounted(const BMessage* message);
48 			void				_HandleVolumeUnmounted(const BMessage* message);
49 
50 private:
51 			Root*				fSystemRoot;
52 			RootList			fRoots;
53 			BVolumeRoster		fVolumeWatcher;
54 };
55 
56 
57 
58 #endif	// PACKAGE_DAEMON_H
59