2007-10-18 00:51:10 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2003-2007, Ingo Weinhold, ingo_weinhold@gmx.de.
|
|
|
|
* Copyright 2003, Tyler Akidau, haiku@akidau.net.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2003-02-01 00:17:20 +03:00
|
|
|
#ifndef _DISK_DEVICE_H
|
|
|
|
#define _DISK_DEVICE_H
|
|
|
|
|
2003-07-07 03:11:10 +04:00
|
|
|
#include <Partition.h>
|
|
|
|
|
2007-10-18 00:51:10 +04:00
|
|
|
|
2003-07-07 03:11:10 +04:00
|
|
|
struct user_disk_device_data;
|
|
|
|
|
2003-05-29 01:43:58 +04:00
|
|
|
class BDiskDevice : public BPartition {
|
2003-02-01 00:17:20 +03:00
|
|
|
public:
|
2007-10-18 00:51:10 +04:00
|
|
|
BDiskDevice();
|
|
|
|
virtual ~BDiskDevice();
|
2003-07-07 03:11:10 +04:00
|
|
|
|
2007-10-18 00:51:10 +04:00
|
|
|
bool HasMedia() const;
|
|
|
|
bool IsRemovableMedia() const;
|
|
|
|
bool IsReadOnlyMedia() const;
|
|
|
|
bool IsWriteOnceMedia() const;
|
2003-02-01 00:17:20 +03:00
|
|
|
|
2007-10-18 00:51:10 +04:00
|
|
|
status_t Eject(bool update = false);
|
2003-02-01 00:17:20 +03:00
|
|
|
|
2007-10-18 00:51:10 +04:00
|
|
|
status_t SetTo(partition_id id);
|
|
|
|
status_t Update(bool* updated = NULL);
|
|
|
|
void Unset();
|
|
|
|
status_t InitCheck() const;
|
2003-07-07 03:11:10 +04:00
|
|
|
|
2007-10-18 00:51:10 +04:00
|
|
|
virtual status_t GetPath(BPath* path) const;
|
2003-07-07 03:11:10 +04:00
|
|
|
|
2007-10-18 00:51:10 +04:00
|
|
|
bool IsModified() const;
|
|
|
|
status_t PrepareModifications();
|
|
|
|
status_t CommitModifications(bool synchronously = true,
|
|
|
|
BMessenger progressMessenger = BMessenger(),
|
|
|
|
bool receiveCompleteProgressUpdates = true);
|
|
|
|
status_t CancelModifications();
|
2003-07-07 03:11:10 +04:00
|
|
|
|
2008-10-14 01:51:43 +04:00
|
|
|
bool IsFile() const;
|
|
|
|
status_t GetFilePath(BPath* path) const;
|
|
|
|
|
2003-02-01 00:17:20 +03:00
|
|
|
private:
|
2007-10-18 00:51:10 +04:00
|
|
|
friend class BDiskDeviceList;
|
|
|
|
friend class BDiskDeviceRoster;
|
2003-02-08 03:39:38 +03:00
|
|
|
|
2007-10-18 00:51:10 +04:00
|
|
|
BDiskDevice(const BDiskDevice&);
|
|
|
|
BDiskDevice& operator=(const BDiskDevice&);
|
2003-07-22 04:19:23 +04:00
|
|
|
|
2007-10-18 00:51:10 +04:00
|
|
|
static status_t _GetData(partition_id id, bool deviceOnly,
|
2007-10-18 02:56:23 +04:00
|
|
|
size_t neededSize,
|
2007-10-18 00:51:10 +04:00
|
|
|
user_disk_device_data** data);
|
2003-07-22 04:19:23 +04:00
|
|
|
|
2007-10-18 00:51:10 +04:00
|
|
|
status_t _SetTo(partition_id id, bool deviceOnly,
|
2007-10-18 02:56:23 +04:00
|
|
|
size_t neededSize);
|
2007-10-18 00:51:10 +04:00
|
|
|
status_t _SetTo(user_disk_device_data* data);
|
2007-10-18 02:56:23 +04:00
|
|
|
status_t _Update(bool* updated);
|
2007-10-18 00:51:10 +04:00
|
|
|
status_t _Update(user_disk_device_data* data,
|
|
|
|
bool* updated);
|
2003-07-08 22:26:15 +04:00
|
|
|
|
2007-10-18 00:51:10 +04:00
|
|
|
static void _ClearUserData(user_partition_data* data);
|
2007-10-07 18:56:26 +04:00
|
|
|
|
2007-10-18 00:51:10 +04:00
|
|
|
virtual bool _AcceptVisitor(BDiskDeviceVisitor* visitor,
|
|
|
|
int32 level);
|
2003-05-29 01:43:58 +04:00
|
|
|
|
2007-10-18 00:51:10 +04:00
|
|
|
user_disk_device_data* fDeviceData;
|
2003-07-07 03:11:10 +04:00
|
|
|
};
|
2003-02-01 00:17:20 +03:00
|
|
|
|
|
|
|
#endif // _DISK_DEVICE_H
|