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:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2003-2007, Axel Dörfler, [email protected]. All rights reserved.
|
* Copyright 2003-2008, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef _KERNEL_NODE_MONITOR_H
|
#ifndef _KERNEL_NODE_MONITOR_H
|
||||||
@@ -12,6 +12,16 @@
|
|||||||
struct io_context;
|
struct io_context;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#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" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2003-2007, Axel Dörfler, [email protected]. All rights reserved.
|
* Copyright 2003-2008, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -109,6 +109,8 @@ class NodeMonitorService : public NotificationService {
|
|||||||
status_t RemoveListener(const KMessage *eventSpecifier,
|
status_t RemoveListener(const KMessage *eventSpecifier,
|
||||||
NotificationListener &listener);
|
NotificationListener &listener);
|
||||||
|
|
||||||
|
status_t AddListener(io_context *context, dev_t device, ino_t node,
|
||||||
|
uint32 flags, NotificationListener ¬ificationListener);
|
||||||
status_t RemoveListener(io_context *context, dev_t device, ino_t node,
|
status_t RemoveListener(io_context *context, dev_t device, ino_t node,
|
||||||
NotificationListener ¬ificationListener);
|
NotificationListener ¬ificationListener);
|
||||||
|
|
||||||
@@ -130,8 +132,6 @@ class NodeMonitorService : public NotificationService {
|
|||||||
status_t _AddMonitorListener(io_context *context,
|
status_t _AddMonitorListener(io_context *context,
|
||||||
node_monitor* monitor, uint32 flags,
|
node_monitor* monitor, uint32 flags,
|
||||||
NotificationListener& notificationListener);
|
NotificationListener& notificationListener);
|
||||||
status_t _AddListener(io_context *context, dev_t device, ino_t node,
|
|
||||||
uint32 flags, NotificationListener ¬ificationListener);
|
|
||||||
status_t _UpdateListener(io_context *context, dev_t device, ino_t node,
|
status_t _UpdateListener(io_context *context, dev_t device, ino_t node,
|
||||||
uint32 flags, bool addFlags,
|
uint32 flags, bool addFlags,
|
||||||
NotificationListener ¬ificationListener);
|
NotificationListener ¬ificationListener);
|
||||||
@@ -376,7 +376,7 @@ NodeMonitorService::_AddMonitorListener(io_context *context,
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
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)
|
uint32 flags, NotificationListener& notificationListener)
|
||||||
{
|
{
|
||||||
TRACE(("%s(dev = %ld, node = %Ld, flags = %ld, listener = %p\n",
|
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);
|
ino_t node = eventSpecifier->GetInt64("node", -1);
|
||||||
uint32 flags = eventSpecifier->GetInt32("flags", 0);
|
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
|
// #pragma mark - public kernel API
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user