* Implemented a basic notification mechanism. Right now, only media changes and
device additions/removals can be monitored. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29582 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2007, Haiku, Inc. All rights reserved.
|
||||
* Copyright 2004-2009, Haiku, Inc. All rights reserved.
|
||||
* Copyright 2003-2004, Ingo Weinhold, [email protected]. All rights reserved.
|
||||
*
|
||||
* Distributed under the terms of the MIT License.
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <disk_device_manager.h>
|
||||
#include <Locker.h>
|
||||
#include <Notifications.h>
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
@@ -40,6 +41,9 @@ public:
|
||||
|
||||
// Disk Device / Partition Management
|
||||
|
||||
DefaultUserNotificationService& Notifications();
|
||||
void Notify(const KMessage& event, uint32 eventMask);
|
||||
|
||||
// manager must be locked
|
||||
KDiskDevice *FindDevice(const char *path);
|
||||
KDiskDevice *FindDevice(partition_id id, bool deviceOnly = true);
|
||||
@@ -104,6 +108,7 @@ private:
|
||||
struct PartitionSet;
|
||||
class DiskSystemWatcher;
|
||||
class DeviceWatcher;
|
||||
class DiskNotifications;
|
||||
|
||||
static status_t _CheckMediaStatusDaemon(void* self);
|
||||
status_t _CheckMediaStatus();
|
||||
@@ -126,6 +131,8 @@ private:
|
||||
|
||||
status_t _AddRemoveMonitoring(const char *path, bool add);
|
||||
|
||||
void _NotifyDeviceEvent(KDiskDevice* device, int32 event, uint32 mask);
|
||||
|
||||
BLocker fLock;
|
||||
DeviceMap *fDevices;
|
||||
PartitionMap *fPartitions;
|
||||
@@ -135,6 +142,7 @@ private:
|
||||
volatile bool fTerminating;
|
||||
DiskSystemWatcher *fDiskSystemWatcher;
|
||||
DeviceWatcher *fDeviceWatcher;
|
||||
DiskNotifications* fNotifications;
|
||||
|
||||
static KDiskDeviceManager *sDefaultManager;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2008, Haiku Inc.
|
||||
* Copyright 2003-2009, Haiku Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@@ -90,6 +90,10 @@ status_t _user_delete_child_partition(partition_id partitionID,
|
||||
int32* changeCounter, partition_id childID,
|
||||
int32 childChangeCounter);
|
||||
|
||||
// change notification
|
||||
status_t _user_start_watching_disks(uint32 eventMask, port_id port, int32 token);
|
||||
status_t _user_stop_watching_disks(port_id port, int32 token);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user