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 enum { 18 B_STOP_WATCHING = 0x0000, 19 B_WATCH_NAME = 0x0001, 20 B_WATCH_STAT = 0x0002, 21 B_WATCH_ATTR = 0x0004, 22 B_WATCH_DIRECTORY = 0x0008, 23 B_WATCH_ALL = 0x000f, 24 25 B_WATCH_MOUNT = 0x0010, 26 B_WATCH_INTERIM_STAT = 0x0020 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 #define B_ENTRY_CREATED 1 36 #define B_ENTRY_REMOVED 2 37 #define B_ENTRY_MOVED 3 38 #define B_STAT_CHANGED 4 39 #define B_ATTR_CHANGED 5 40 #define B_DEVICE_MOUNTED 6 41 #define B_DEVICE_UNMOUNTED 7 42 43 44 // More specific info in the "cause" field of B_ATTR_CHANGED notification 45 // messages. (Haiku only) 46 #define B_ATTR_CREATED 1 47 #define B_ATTR_REMOVED 2 48 // B_ATTR_CHANGED is reused 49 50 51 // More specific info in the "fields" field of B_STAT_CHANGED notification 52 // messages, specifying what parts of the stat data have actually been 53 // changed. (Haiku only) 54 enum { 55 B_STAT_MODE = 0x0001, 56 B_STAT_UID = 0x0002, 57 B_STAT_GID = 0x0004, 58 B_STAT_SIZE = 0x0008, 59 B_STAT_ACCESS_TIME = 0x0010, 60 B_STAT_MODIFICATION_TIME = 0x0020, 61 B_STAT_CREATION_TIME = 0x0040, 62 B_STAT_CHANGE_TIME = 0x0080, 63 64 B_STAT_INTERIM_UPDATE = 0x1000 65 }; 66 67 68 // C++ callable Prototypes 69 70 // Since you are not able to parse BMessages from plain C, there is no 71 // API exported. 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_volume(dev_t volume, uint32 flags, BMessenger target); 84 extern status_t watch_volume(dev_t volume, uint32 flags, 85 const BHandler *handler, const BLooper *looper = NULL); 86 87 extern status_t watch_node(const node_ref *node, uint32 flags, 88 BMessenger target); 89 extern status_t watch_node(const node_ref *node, uint32 flags, 90 const BHandler *handler, const BLooper *looper = NULL); 91 92 extern status_t stop_watching(BMessenger target); 93 extern status_t stop_watching(const BHandler *handler, const BLooper *looper = NULL); 94 95 #endif // __cplusplus && !_KERNEL_MODE 96 97 #endif // _NODE_MONITOR_H 98