Add a watch_volume method to the node monitor to be able to watch node changes on a whole volume and not only for one node.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39020 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2008, Haiku Inc. All Rights Reserved.
|
||||
* Copyright 2003-2010, Haiku Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _NODE_MONITOR_H
|
||||
@@ -83,10 +83,15 @@ class BLooper;
|
||||
class BHandler;
|
||||
|
||||
|
||||
extern status_t watch_node(const node_ref *node, uint32 flags, BMessenger target);
|
||||
extern status_t watch_volume(const dev_t volume, uint32 flags,
|
||||
BMessenger target);
|
||||
extern status_t watch_volume(const dev_t volume, uint32 flags,
|
||||
const BHandler *handler, const BLooper *looper = NULL);
|
||||
|
||||
extern status_t watch_node(const node_ref *node, uint32 flags,
|
||||
BMessenger target);
|
||||
extern status_t watch_node(const node_ref *node, uint32 flags,
|
||||
const BHandler *handler,
|
||||
const BLooper *looper = NULL);
|
||||
const BHandler *handler, const BLooper *looper = NULL);
|
||||
|
||||
extern status_t stop_watching(BMessenger target);
|
||||
extern status_t stop_watching(const BHandler *handler, const BLooper *looper = NULL);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2003-2008, Axel Dörfler, [email protected]. All rights reserved.
|
||||
* Copyright 2005-2008, Ingo Weinhold, [email protected].
|
||||
* Copyright 2010, Clemens Zeidler, [email protected].
|
||||
*
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
@@ -39,6 +40,9 @@
|
||||
// ToDo: return another error code than B_NO_MEMORY if the team's maximum is hit
|
||||
|
||||
|
||||
const dev_t kWatchVolumeNode = (dev_t)-1;
|
||||
|
||||
|
||||
typedef struct monitor_listener monitor_listener;
|
||||
typedef struct node_monitor node_monitor;
|
||||
|
||||
@@ -541,6 +545,9 @@ NodeMonitorService::NotifyEntryCreatedOrRemoved(int32 opcode, dev_t device,
|
||||
// get the lists of all interested listeners
|
||||
interested_monitor_listener_list interestedListeners[3];
|
||||
int32 interestedListenerCount = 0;
|
||||
// ... for the volume
|
||||
_GetInterestedMonitorListeners(device, kWatchVolumeNode, B_WATCH_NAME,
|
||||
interestedListeners, interestedListenerCount);
|
||||
// ... for the node
|
||||
if (opcode != B_ENTRY_CREATED) {
|
||||
_GetInterestedMonitorListeners(device, node, B_WATCH_NAME,
|
||||
@@ -584,8 +591,11 @@ NodeMonitorService::NotifyEntryMoved(dev_t device, ino_t fromDirectory,
|
||||
RecursiveLocker locker(fRecursiveLock);
|
||||
|
||||
// get the lists of all interested listeners
|
||||
interested_monitor_listener_list interestedListeners[3];
|
||||
interested_monitor_listener_list interestedListeners[4];
|
||||
int32 interestedListenerCount = 0;
|
||||
// ... for the volume
|
||||
_GetInterestedMonitorListeners(device, kWatchVolumeNode, B_WATCH_NAME,
|
||||
interestedListeners, interestedListenerCount);
|
||||
// ... for the node
|
||||
_GetInterestedMonitorListeners(nodeDevice, node, B_WATCH_NAME,
|
||||
interestedListeners, interestedListenerCount);
|
||||
@@ -628,6 +638,9 @@ NodeMonitorService::NotifyStatChanged(dev_t device, ino_t node,
|
||||
// get the lists of all interested listeners
|
||||
interested_monitor_listener_list interestedListeners[3];
|
||||
int32 interestedListenerCount = 0;
|
||||
// ... for the volume
|
||||
_GetInterestedMonitorListeners(device, kWatchVolumeNode, B_WATCH_STAT,
|
||||
interestedListeners, interestedListenerCount);
|
||||
// ... for the node, depending on wether its an interim update or not
|
||||
_GetInterestedMonitorListeners(device, node,
|
||||
(statFields & B_STAT_INTERIM_UPDATE) != 0
|
||||
@@ -673,6 +686,9 @@ NodeMonitorService::NotifyAttributeChanged(dev_t device, ino_t node,
|
||||
// get the lists of all interested listeners
|
||||
interested_monitor_listener_list interestedListeners[3];
|
||||
int32 interestedListenerCount = 0;
|
||||
// ... for the volume
|
||||
_GetInterestedMonitorListeners(device, kWatchVolumeNode, B_WATCH_ATTR,
|
||||
interestedListeners, interestedListenerCount);
|
||||
// ... for the node
|
||||
_GetInterestedMonitorListeners(device, node, B_WATCH_ATTR,
|
||||
interestedListeners, interestedListenerCount);
|
||||
|
||||
Reference in New Issue
Block a user