Added add_node_listener() and remove_node_listener() kernel private functions

to watch a node.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24035 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-02-20 16:48:16 +00:00
parent 59312709ae
commit 9448bb6e0b
2 changed files with 33 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2003-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2003-2008, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_NODE_MONITOR_H
@ -12,6 +12,16 @@
struct io_context;
#ifdef __cplusplus
// C++ only part
class NotificationListener;
extern status_t remove_node_listener(dev_t device, dev_t node,
NotificationListener& listener);
extern status_t add_node_listener(dev_t device, dev_t node, uint32 flags,
NotificationListener& listener);
extern "C" {
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright 2003-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2003-2008, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License.
*/
@ -109,6 +109,8 @@ class NodeMonitorService : public NotificationService {
status_t RemoveListener(const KMessage *eventSpecifier,
NotificationListener &listener);
status_t AddListener(io_context *context, dev_t device, ino_t node,
uint32 flags, NotificationListener &notificationListener);
status_t RemoveListener(io_context *context, dev_t device, ino_t node,
NotificationListener &notificationListener);
@ -130,8 +132,6 @@ class NodeMonitorService : public NotificationService {
status_t _AddMonitorListener(io_context *context,
node_monitor* monitor, uint32 flags,
NotificationListener& notificationListener);
status_t _AddListener(io_context *context, dev_t device, ino_t node,
uint32 flags, NotificationListener &notificationListener);
status_t _UpdateListener(io_context *context, dev_t device, ino_t node,
uint32 flags, bool addFlags,
NotificationListener &notificationListener);
@ -376,7 +376,7 @@ NodeMonitorService::_AddMonitorListener(io_context *context,
status_t
NodeMonitorService::_AddListener(io_context *context, dev_t device, ino_t node,
NodeMonitorService::AddListener(io_context *context, dev_t device, ino_t node,
uint32 flags, NotificationListener& notificationListener)
{
TRACE(("%s(dev = %ld, node = %Ld, flags = %ld, listener = %p\n",
@ -775,7 +775,7 @@ NodeMonitorService::AddListener(const KMessage* eventSpecifier,
ino_t node = eventSpecifier->GetInt64("node", -1);
uint32 flags = eventSpecifier->GetInt32("flags", 0);
return _AddListener(context, device, node, flags, listener);
return AddListener(context, device, node, flags, listener);
}
@ -944,6 +944,23 @@ notify_mount(dev_t device, dev_t parentDevice, ino_t parentDirectory)
}
status_t
remove_node_listener(dev_t device, dev_t node, NotificationListener& listener)
{
return sNodeMonitorService.RemoveListener(get_current_io_context(true),
device, node, listener);
}
status_t
add_node_listener(dev_t device, dev_t node, uint32 flags,
NotificationListener& listener)
{
return sNodeMonitorService.AddListener(get_current_io_context(true),
device, node, flags, listener);
}
// #pragma mark - public kernel API