1 /* 2 * Copyright 2003-2010, Haiku Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _NODE_MONITOR_H 6 #define _NODE_MONITOR_H 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 B_WATCH_INTERIM_STAT = 0x0020 28 }; 29 30 31 /* The "opcode" field of the B_NODE_MONITOR notification message you get. 32 * 33 * The presence and meaning of the other fields in that message specifying what 34 * exactly caused the notification depend on this value. 35 */ 36 37 #define B_ENTRY_CREATED 1 38 #define B_ENTRY_REMOVED 2 39 #define B_ENTRY_MOVED 3 40 #define B_STAT_CHANGED 4 41 #define B_ATTR_CHANGED 5 42 #define B_DEVICE_MOUNTED 6 43 #define B_DEVICE_UNMOUNTED 7 44 45 46 // More specific info in the "cause" field of B_ATTR_CHANGED notification 47 // messages. (Haiku only) 48 #define B_ATTR_CREATED 1 49 #define B_ATTR_REMOVED 2 50 // B_ATTR_CHANGED is reused 51 52 53 // More specific info in the "fields" field of B_STAT_CHANGED notification 54 // messages, specifying what parts of the stat data have actually been 55 // changed. (Haiku only) 56 enum { 57 B_STAT_MODE = 0x0001, 58 B_STAT_UID = 0x0002, 59 B_STAT_GID = 0x0004, 60 B_STAT_SIZE = 0x0008, 61 B_STAT_ACCESS_TIME = 0x0010, 62 B_STAT_MODIFICATION_TIME = 0x0020, 63 B_STAT_CREATION_TIME = 0x0040, 64 B_STAT_CHANGE_TIME = 0x0080, 65 66 B_STAT_INTERIM_UPDATE = 0x1000 67 }; 68 69 70 /* C++ callable Prototypes 71 * 72 * Since you are not able to parse BMessages from plain C, there is no 73 * API exported. 74 */ 75 76 #if defined(__cplusplus) && !defined(_KERNEL_MODE) 77 78 // these are only needed for the function exports 79 #include <Node.h> 80 #include <Messenger.h> 81 82 class BLooper; 83 class BHandler; 84 85 86 extern status_t watch_volume(dev_t volume, uint32 flags, BMessenger target); 87 extern status_t watch_volume(dev_t volume, uint32 flags, 88 const BHandler *handler, const BLooper *looper = NULL); 89 90 extern status_t watch_node(const node_ref *node, uint32 flags, 91 BMessenger target); 92 extern status_t watch_node(const node_ref *node, uint32 flags, 93 const BHandler *handler, const BLooper *looper = NULL); 94 95 extern status_t stop_watching(BMessenger target); 96 extern status_t stop_watching(const BHandler *handler, const BLooper *looper = NULL); 97 98 #endif /* __cplusplus && !_KERNEL_MODE */ 99 100 #endif /* _NODE_MONITOR_H*/ 101