xref: /haiku/headers/build/os/storage/NodeMonitor.h (revision 893988af824e65e49e55f517b157db8386e8002b)
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 // More specific info in the "cause" field of B_ATTR_CHANGED notification
46 // messages. (Haiku only)
47 #define	B_ATTR_CREATED		1
48 #define	B_ATTR_REMOVED		2
49 //		B_ATTR_CHANGED is reused
50 
51 
52 // More specific info in the "fields" field of B_STAT_CHANGED notification
53 // messages, specifying what parts of the stat data have actually been
54 // changed. (Haiku only)
55 enum {
56 	B_STAT_MODE					= 0x01,
57 	B_STAT_UID					= 0x02,
58 	B_STAT_GID					= 0x04,
59 	B_STAT_SIZE					= 0x08,
60 	B_STAT_ACCESS_TIME			= 0x10,
61 	B_STAT_MODIFICATION_TIME	= 0x20,
62 	B_STAT_CREATION_TIME		= 0x40,
63 	B_STAT_CHANGE_TIME			= 0x80,
64 };
65 
66 
67 /* C++ callable Prototypes
68  *
69  * Since you are not able to parse BMessages from plain C, there is no
70  * API exported.
71  */
72 
73 #if defined(__cplusplus) && !defined(_KERNEL_MODE)
74 
75 // these are only needed for the function exports
76 #include <Node.h>
77 #include <Messenger.h>
78 
79 class BLooper;
80 class BHandler;
81 
82 
83 extern status_t watch_node(const node_ref *node, uint32 flags, BMessenger target);
84 extern status_t watch_node(const node_ref *node, uint32 flags,
85 					const BHandler *handler,
86 					const BLooper *looper = NULL);
87 
88 extern status_t stop_watching(BMessenger target);
89 extern status_t stop_watching(const BHandler *handler, const BLooper *looper = NULL);
90 
91 #endif	/* __cplusplus && !_KERNEL_MODE */
92 
93 #endif	/* _NODE_MONITOR_H*/
94