2008-02-25 16:54:30 +03:00
|
|
|
/*
|
2010-10-20 16:31:53 +04:00
|
|
|
* Copyright 2003-2010, Haiku Inc. All Rights Reserved.
|
2008-02-25 16:54:30 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2002-10-23 17:54:44 +04:00
|
|
|
#ifndef _NODE_MONITOR_H
|
|
|
|
#define _NODE_MONITOR_H
|
2003-01-17 20:43:31 +03:00
|
|
|
|
2002-10-23 17:54:44 +04:00
|
|
|
|
|
|
|
#include <StorageDefs.h>
|
|
|
|
|
|
|
|
|
|
|
|
/* Flags for the watch_node() call.
|
|
|
|
*
|
2003-01-17 20:43:31 +03:00
|
|
|
* Note that B_WATCH_MOUNT is NOT included in B_WATCH_ALL.
|
|
|
|
* You may prefer to use BVolumeRoster for volume watching.
|
2002-10-23 17:54:44 +04:00
|
|
|
*/
|
2003-01-17 20:43:31 +03:00
|
|
|
|
2002-10-23 17:54:44 +04:00
|
|
|
enum {
|
2008-02-25 16:54:30 +03:00
|
|
|
B_STOP_WATCHING = 0x0000,
|
|
|
|
B_WATCH_NAME = 0x0001,
|
|
|
|
B_WATCH_STAT = 0x0002,
|
|
|
|
B_WATCH_ATTR = 0x0004,
|
|
|
|
B_WATCH_DIRECTORY = 0x0008,
|
|
|
|
B_WATCH_ALL = 0x000f,
|
|
|
|
|
|
|
|
B_WATCH_MOUNT = 0x0010,
|
|
|
|
B_WATCH_INTERIM_STAT = 0x0020
|
2002-10-23 17:54:44 +04:00
|
|
|
};
|
|
|
|
|
2003-01-17 20:43:31 +03:00
|
|
|
|
|
|
|
/* The "opcode" field of the B_NODE_MONITOR notification message you get.
|
|
|
|
*
|
|
|
|
* The presence and meaning of the other fields in that message specifying what
|
|
|
|
* exactly caused the notification depend on this value.
|
2002-10-23 17:54:44 +04:00
|
|
|
*/
|
|
|
|
|
2003-01-17 20:43:31 +03:00
|
|
|
#define B_ENTRY_CREATED 1
|
|
|
|
#define B_ENTRY_REMOVED 2
|
|
|
|
#define B_ENTRY_MOVED 3
|
|
|
|
#define B_STAT_CHANGED 4
|
|
|
|
#define B_ATTR_CHANGED 5
|
|
|
|
#define B_DEVICE_MOUNTED 6
|
|
|
|
#define B_DEVICE_UNMOUNTED 7
|
|
|
|
|
|
|
|
|
2005-02-02 17:19:26 +03:00
|
|
|
// More specific info in the "cause" field of B_ATTR_CHANGED notification
|
|
|
|
// messages. (Haiku only)
|
|
|
|
#define B_ATTR_CREATED 1
|
|
|
|
#define B_ATTR_REMOVED 2
|
|
|
|
// B_ATTR_CHANGED is reused
|
|
|
|
|
|
|
|
|
|
|
|
// More specific info in the "fields" field of B_STAT_CHANGED notification
|
|
|
|
// messages, specifying what parts of the stat data have actually been
|
|
|
|
// changed. (Haiku only)
|
|
|
|
enum {
|
2008-02-25 16:54:30 +03:00
|
|
|
B_STAT_MODE = 0x0001,
|
|
|
|
B_STAT_UID = 0x0002,
|
|
|
|
B_STAT_GID = 0x0004,
|
|
|
|
B_STAT_SIZE = 0x0008,
|
|
|
|
B_STAT_ACCESS_TIME = 0x0010,
|
|
|
|
B_STAT_MODIFICATION_TIME = 0x0020,
|
|
|
|
B_STAT_CREATION_TIME = 0x0040,
|
|
|
|
B_STAT_CHANGE_TIME = 0x0080,
|
|
|
|
|
|
|
|
B_STAT_INTERIM_UPDATE = 0x1000
|
2005-02-02 17:26:42 +03:00
|
|
|
};
|
2005-02-02 17:19:26 +03:00
|
|
|
|
|
|
|
|
2003-01-17 20:43:31 +03:00
|
|
|
/* C++ callable Prototypes
|
|
|
|
*
|
|
|
|
* Since you are not able to parse BMessages from plain C, there is no
|
|
|
|
* API exported.
|
|
|
|
*/
|
|
|
|
|
2003-06-27 06:25:02 +04:00
|
|
|
#if defined(__cplusplus) && !defined(_KERNEL_MODE)
|
2003-01-17 20:43:31 +03:00
|
|
|
|
2003-01-17 21:28:09 +03:00
|
|
|
// these are only needed for the function exports
|
|
|
|
#include <Node.h>
|
|
|
|
#include <Messenger.h>
|
|
|
|
|
|
|
|
class BLooper;
|
|
|
|
class BHandler;
|
|
|
|
|
|
|
|
|
2010-10-24 04:49:20 +04:00
|
|
|
extern status_t watch_volume(dev_t volume, uint32 flags, BMessenger target);
|
|
|
|
extern status_t watch_volume(dev_t volume, uint32 flags,
|
2010-10-20 16:31:53 +04:00
|
|
|
const BHandler *handler, const BLooper *looper = NULL);
|
|
|
|
|
|
|
|
extern status_t watch_node(const node_ref *node, uint32 flags,
|
|
|
|
BMessenger target);
|
2003-01-17 20:43:31 +03:00
|
|
|
extern status_t watch_node(const node_ref *node, uint32 flags,
|
2010-10-20 16:31:53 +04:00
|
|
|
const BHandler *handler, const BLooper *looper = NULL);
|
2003-01-17 20:43:31 +03:00
|
|
|
|
|
|
|
extern status_t stop_watching(BMessenger target);
|
|
|
|
extern status_t stop_watching(const BHandler *handler, const BLooper *looper = NULL);
|
|
|
|
|
2003-06-27 06:25:02 +04:00
|
|
|
#endif /* __cplusplus && !_KERNEL_MODE */
|
2002-10-23 17:54:44 +04:00
|
|
|
|
2003-01-17 20:43:31 +03:00
|
|
|
#endif /* _NODE_MONITOR_H*/
|