xref: /haiku/headers/os/storage/NodeMonitor.h (revision d5cd5d63ff0ad395989db6cf4841a64d5b545d1d)
1 #ifndef _NODE_MONITOR_H
2 #define _NODE_MONITOR_H
3 /* Node monitor calls for kernel add-ons
4 **
5 ** Distributed under the terms of the OpenBeOS License.
6 */
7 
8 
9 #include <StorageDefs.h>
10 
11 
12 /* Flags for the watch_node() call.
13  *
14  * Note that B_WATCH_MOUNT is NOT included in B_WATCH_ALL.
15  * You may prefer to use BVolumeRoster for volume watching.
16  */
17 
18 enum {
19     B_STOP_WATCHING		= 0x0000,
20 	B_WATCH_NAME		= 0x0001,
21 	B_WATCH_STAT		= 0x0002,
22 	B_WATCH_ATTR		= 0x0004,
23 	B_WATCH_DIRECTORY	= 0x0008,
24 	B_WATCH_ALL			= 0x000f,
25 
26 	B_WATCH_MOUNT		= 0x0010
27 };
28 
29 
30 /* The "opcode" field of the B_NODE_MONITOR notification message you get.
31  *
32  * The presence and meaning of the other fields in that message specifying what
33  * exactly caused the notification depend on this value.
34  */
35 
36 #define	B_ENTRY_CREATED		1
37 #define	B_ENTRY_REMOVED		2
38 #define	B_ENTRY_MOVED		3
39 #define	B_STAT_CHANGED		4
40 #define	B_ATTR_CHANGED		5
41 #define	B_DEVICE_MOUNTED	6
42 #define	B_DEVICE_UNMOUNTED	7
43 
44 
45 /* C++ callable Prototypes
46  *
47  * Since you are not able to parse BMessages from plain C, there is no
48  * API exported.
49  */
50 
51 #if defined(__cplusplus) && !defined(_KERNEL_MODE)
52 
53 // these are only needed for the function exports
54 #include <Node.h>
55 #include <Messenger.h>
56 
57 class BLooper;
58 class BHandler;
59 
60 
61 extern status_t watch_node(const node_ref *node, uint32 flags, BMessenger target);
62 extern status_t watch_node(const node_ref *node, uint32 flags,
63 					const BHandler *handler,
64 					const BLooper *looper = NULL);
65 
66 extern status_t stop_watching(BMessenger target);
67 extern status_t stop_watching(const BHandler *handler, const BLooper *looper = NULL);
68 
69 #endif	/* __cplusplus && !_KERNEL_MODE */
70 
71 #endif	/* _NODE_MONITOR_H*/
72