* 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:
Axel Dörfler
2007-01-21 18:03:47 +00:00
parent 34b5fabe88
commit 83dd342c4a
2 changed files with 1258 additions and 779 deletions
File diff suppressed because it is too large Load Diff
+55 -12
View File
@@ -39,19 +39,63 @@ All rights reserved.
#include <Looper.h> #include <Looper.h>
#include <Message.h> #include <Message.h>
#if OPEN_TRACKER #ifndef __HAIKU__
#include "DeviceMap.h" # include "DeviceMap.h"
#else
#include <private/storage/DeviceMap.h>
#endif #endif
namespace BPrivate { namespace BPrivate {
const uint32 kMountVolume = 'mntv';
const uint32 kMountAllNow = 'mntn';
const uint32 kSetAutomounterParams = 'pmst'; 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 kSuspendAutomounter = 'amsp';
const uint32 kResumeAutomounter = 'amsr'; const uint32 kResumeAutomounter = 'amsr';
const uint32 kMountAllNow = 'mntn';
const uint32 kMountVolume = 'mntv';
const uint32 kTryMountingFloppy = 'mntf'; const uint32 kTryMountingFloppy = 'mntf';
const uint32 kAutomounterRescan = 'rscn'; const uint32 kAutomounterRescan = 'rscn';
@@ -65,7 +109,7 @@ struct AutomountParams {
}; };
class AutoMounter : public BLooper { class AutoMounter : public BLooper {
public: public:
AutoMounter( AutoMounter(
bool checkRemovableOnly = true, // do not poll nonremovable disks bool checkRemovableOnly = true, // do not poll nonremovable disks
bool checkCDs = true, // currently ignored bool checkCDs = true, // currently ignored
@@ -93,7 +137,7 @@ public:
Partition * EachPartition(EachPartitionFunction, void *); Partition * EachPartition(EachPartitionFunction, void *);
Partition *FindPartition(dev_t id); Partition *FindPartition(dev_t id);
private: private:
void ReadSettings(); void ReadSettings();
void WriteSettings(); void WriteSettings();
@@ -118,14 +162,11 @@ private:
void RescanDevices(); void RescanDevices();
void TryMountingFloppy(); void TryMountingFloppy();
bool IsFloppyMounted(); bool IsFloppyMounted();
bool FloppyInList(); bool FloppyInList();
#if _INCLUDES_CLASS_DEVICE_MAP
DeviceList fList; DeviceList fList;
#endif
// automounter settings // automounter settings
DeviceScanParams fScanParams; DeviceScanParams fScanParams;
@@ -146,8 +187,10 @@ private:
Partition *AddMountableItemToMessage(Partition *, void *); Partition *AddMountableItemToMessage(Partition *, void *);
#endif // !__HAIKU__
} // namespace BPrivate } // namespace BPrivate
using namespace BPrivate; using namespace BPrivate;
#endif #endif // _AUTO_MOUNTER_H