xref: /haiku/headers/os/storage/NodeMonitor.h (revision 7120e97489acbf17d86d3f33e3b2e68974fd4b23)
1 /***************************************************************************
2 //
3 //	File:			NodeMonitor.h
4 //
5 //	Description:	The Node Monitor
6 //
7 //	Copyright 1992-98, Be Incorporated, All Rights Reserved.
8 //
9 ***************************************************************************/
10 
11 
12 #ifndef _NODE_MONITOR_H
13 #define _NODE_MONITOR_H
14 
15 #ifndef _BE_BUILD_H
16 #include <BeBuild.h>
17 #endif
18 #include <StorageDefs.h>
19 #include <Node.h>
20 #include <Messenger.h>
21 
22 class	BLooper;
23 class	BHandler;
24 
25 _IMPEXP_BE status_t watch_node(const node_ref *node,
26 					   uint32 flags,
27 					   BMessenger target);
28 
29 _IMPEXP_BE status_t watch_node(const node_ref *node,
30 					   uint32 flags,
31 					   const BHandler *handler,
32 					   const BLooper *looper = NULL);
33 
34 _IMPEXP_BE status_t stop_watching(BMessenger target);
35 
36 _IMPEXP_BE status_t stop_watching(const BHandler *handler,
37 					  const BLooper *looper=NULL);
38 
39 /* Flags for the watch_node() call.
40  * Note that B_WATCH_MOUNT is NOT included in
41  * B_WATCH_ALL -- the latter is a convenience
42  * for watching all watchable state changes for
43  * a specific node.  Watching for volumes
44  * being mounted and unmounted (B_WATCH_MOUNT)
45  * is in a category by itself.
46  *
47  * BVolumeRoster provides a handy cover for
48  * volume watching.
49  */
50 enum {
51     B_STOP_WATCHING = 0x0000,
52 	B_WATCH_NAME =	0x0001,
53 	B_WATCH_STAT =	0x0002,
54 	B_WATCH_ATTR =	0x0004,
55 	B_WATCH_DIRECTORY =	0x0008,
56 	B_WATCH_ALL = 0x000f,
57 	B_WATCH_MOUNT = 0x0010
58 };
59 
60 /* When a node monitor notification
61  * returns to the target, the "opcode" field
62  * will hold one of these values.  The other
63  * fields in the message tell you which
64  * node (or device) changed.  See the documentation
65  * for the names of these other fields.
66  */
67 #define		B_ENTRY_CREATED		1
68 #define		B_ENTRY_REMOVED		2
69 #define		B_ENTRY_MOVED		3
70 #define		B_STAT_CHANGED		4
71 #define		B_ATTR_CHANGED		5
72 #define		B_DEVICE_MOUNTED	6
73 #define		B_DEVICE_UNMOUNTED	7
74 
75 
76 #endif
77