* Implemented the AutoMounter for Haiku - it's barely tested at this point, but
at least mounting/unmounting seems to work. This fixes bug #191. * Also changed the way how Tracker automatically mounts/unmounts volumes: it now only differentiates between removable and fixed storage, not between initial scan at boot, and periodical scans during runtime. Also removed all HFS stuff. * Got rid of _INCLUDES_CLASS_DEVICE_MAP for the BeOS build. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19893 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+632
-196
File diff suppressed because it is too large
Load Diff
@@ -39,19 +39,63 @@ All rights reserved.
|
||||
#include <Looper.h>
|
||||
#include <Message.h>
|
||||
|
||||
#if OPEN_TRACKER
|
||||
#ifndef __HAIKU__
|
||||
# include "DeviceMap.h"
|
||||
#else
|
||||
#include <private/storage/DeviceMap.h>
|
||||
#endif
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
const uint32 kMountVolume = 'mntv';
|
||||
const uint32 kMountAllNow = 'mntn';
|
||||
const uint32 kSetAutomounterParams = 'pmst';
|
||||
|
||||
#ifdef __HAIKU__
|
||||
// #pragma mark - Haiku Disk Device API
|
||||
|
||||
class AutoMounter : public BLooper {
|
||||
public:
|
||||
AutoMounter();
|
||||
virtual ~AutoMounter();
|
||||
|
||||
virtual bool QuitRequested();
|
||||
|
||||
void GetSettings(BMessage* message);
|
||||
|
||||
private:
|
||||
enum mount_mode {
|
||||
kNoVolumes,
|
||||
kOnlyBFSVolumes,
|
||||
kAllVolumes,
|
||||
kRestorePreviousVolumes
|
||||
};
|
||||
|
||||
void _MountVolumes(mount_mode normal, mount_mode removable);
|
||||
void _MountVolume(BMessage* message);
|
||||
bool _ForceUnmount(const char* name, status_t error);
|
||||
void _ReportUnmountError(const char* name, status_t error);
|
||||
void _UnmountAndEjectVolume(BMessage* message);
|
||||
|
||||
void _FromMode(mount_mode mode, bool& all, bool& bfs, bool& restore);
|
||||
mount_mode _ToMode(bool all, bool bfs, bool restore = false);
|
||||
void _UpdateSettingsFromMessage(BMessage* message);
|
||||
void _ReadSettings();
|
||||
void _WriteSettings();
|
||||
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
|
||||
private:
|
||||
mount_mode fNormalMode;
|
||||
mount_mode fRemovableMode;
|
||||
|
||||
BFile fPrefsFile;
|
||||
BMessage fSettings;
|
||||
};
|
||||
|
||||
#else // !__HAIKU__
|
||||
// #pragma mark - R5 DeviceMap API
|
||||
|
||||
const uint32 kSuspendAutomounter = 'amsp';
|
||||
const uint32 kResumeAutomounter = 'amsr';
|
||||
const uint32 kMountAllNow = 'mntn';
|
||||
const uint32 kMountVolume = 'mntv';
|
||||
const uint32 kTryMountingFloppy = 'mntf';
|
||||
const uint32 kAutomounterRescan = 'rscn';
|
||||
|
||||
@@ -118,14 +162,11 @@ private:
|
||||
|
||||
void RescanDevices();
|
||||
|
||||
|
||||
void TryMountingFloppy();
|
||||
bool IsFloppyMounted();
|
||||
bool FloppyInList();
|
||||
|
||||
#if _INCLUDES_CLASS_DEVICE_MAP
|
||||
DeviceList fList;
|
||||
#endif
|
||||
|
||||
// automounter settings
|
||||
DeviceScanParams fScanParams;
|
||||
@@ -146,8 +187,10 @@ private:
|
||||
|
||||
Partition *AddMountableItemToMessage(Partition *, void *);
|
||||
|
||||
#endif // !__HAIKU__
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
using namespace BPrivate;
|
||||
|
||||
#endif
|
||||
#endif // _AUTO_MOUNTER_H
|
||||
|
||||
Reference in New Issue
Block a user