As suggested by Ingo use a B_WATCH_VOLUME flag to tell the kernel to watch
the whole volume. Kernel part follows. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39106 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -83,9 +83,8 @@ class BLooper;
|
|||||||
class BHandler;
|
class BHandler;
|
||||||
|
|
||||||
|
|
||||||
extern status_t watch_volume(const dev_t volume, uint32 flags,
|
extern status_t watch_volume(dev_t volume, uint32 flags, BMessenger target);
|
||||||
BMessenger target);
|
extern status_t watch_volume(dev_t volume, uint32 flags,
|
||||||
extern status_t watch_volume(const dev_t volume, uint32 flags,
|
|
||||||
const BHandler *handler, const BLooper *looper = NULL);
|
const BHandler *handler, const BLooper *looper = NULL);
|
||||||
|
|
||||||
extern status_t watch_node(const node_ref *node, uint32 flags,
|
extern status_t watch_node(const node_ref *node, uint32 flags,
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010, Clemens Zeidler, [email protected].
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef _NODE_MONITOR_PRIVATE_H
|
||||||
|
#define _NODE_MONITOR_PRIVATE_H
|
||||||
|
|
||||||
|
|
||||||
|
enum {
|
||||||
|
B_WATCH_VOLUME = 0xF000
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _NODE_MONITOR_PRIVATE_H */
|
||||||
@@ -15,10 +15,13 @@
|
|||||||
|
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
|
|
||||||
|
#include "node_monitor_private.h"
|
||||||
|
|
||||||
|
|
||||||
// TODO: Tests!
|
// TODO: Tests!
|
||||||
|
|
||||||
|
|
||||||
// watch_node
|
// watch_volume
|
||||||
/*! \brief Subscribes a target to watch node changes on a volume.
|
/*! \brief Subscribes a target to watch node changes on a volume.
|
||||||
|
|
||||||
Depending of \a flags the action performed by this function varies:
|
Depending of \a flags the action performed by this function varies:
|
||||||
@@ -32,12 +35,14 @@
|
|||||||
\return \c B_OK, if everything went fine, another error code otherwise.
|
\return \c B_OK, if everything went fine, another error code otherwise.
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
watch_volume(const dev_t volume, uint32 flags, BMessenger target)
|
watch_volume(dev_t volume, uint32 flags, BMessenger target)
|
||||||
{
|
{
|
||||||
if ((flags | B_WATCH_NAME) == 0 && (flags | B_WATCH_STAT)
|
if ((flags | B_WATCH_NAME) == 0 && (flags | B_WATCH_STAT)
|
||||||
&& (flags | B_WATCH_ATTR))
|
&& (flags | B_WATCH_ATTR))
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
|
flags |= B_WATCH_VOLUME;
|
||||||
|
|
||||||
BMessenger::Private messengerPrivate(target);
|
BMessenger::Private messengerPrivate(target);
|
||||||
port_id port = messengerPrivate.Port();
|
port_id port = messengerPrivate.Port();
|
||||||
int32 token = messengerPrivate.Token();
|
int32 token = messengerPrivate.Token();
|
||||||
@@ -46,7 +51,7 @@ watch_volume(const dev_t volume, uint32 flags, BMessenger target)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
watch_volume(const dev_t volume, uint32 flags, const BHandler *handler,
|
watch_volume(dev_t volume, uint32 flags, const BHandler *handler,
|
||||||
const BLooper *looper)
|
const BLooper *looper)
|
||||||
{
|
{
|
||||||
return watch_volume(volume, flags, BMessenger(handler, looper));
|
return watch_volume(volume, flags, BMessenger(handler, looper));
|
||||||
|
|||||||
Reference in New Issue
Block a user