1 /* 2 * Copyright 2003-2007, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Copyright 2003, Tyler Akidau, haiku@akidau.net. 4 * Distributed under the terms of the MIT License. 5 */ 6 #ifndef _DISK_DEVICE_H 7 #define _DISK_DEVICE_H 8 9 #include <Partition.h> 10 11 12 struct user_disk_device_data; 13 14 class BDiskDevice : public BPartition { 15 public: 16 BDiskDevice(); 17 virtual ~BDiskDevice(); 18 19 bool HasMedia() const; 20 bool IsRemovableMedia() const; 21 bool IsReadOnlyMedia() const; 22 bool IsWriteOnceMedia() const; 23 24 status_t Eject(bool update = false); 25 26 status_t SetTo(partition_id id); 27 status_t Update(bool* updated = NULL); 28 void Unset(); 29 status_t InitCheck() const; 30 31 virtual status_t GetPath(BPath* path) const; 32 33 bool IsModified() const; 34 status_t PrepareModifications(); 35 status_t CommitModifications(bool synchronously = true, 36 BMessenger progressMessenger = BMessenger(), 37 bool receiveCompleteProgressUpdates = true); 38 status_t CancelModifications(); 39 40 private: 41 friend class BDiskDeviceList; 42 friend class BDiskDeviceRoster; 43 44 BDiskDevice(const BDiskDevice&); 45 BDiskDevice& operator=(const BDiskDevice&); 46 47 static status_t _GetData(partition_id id, bool deviceOnly, 48 size_t neededSize, 49 user_disk_device_data** data); 50 51 status_t _SetTo(partition_id id, bool deviceOnly, 52 size_t neededSize); 53 status_t _SetTo(user_disk_device_data* data); 54 status_t _Update(bool* updated); 55 status_t _Update(user_disk_device_data* data, 56 bool* updated); 57 58 static void _ClearUserData(user_partition_data* data); 59 60 virtual bool _AcceptVisitor(BDiskDeviceVisitor* visitor, 61 int32 level); 62 63 user_disk_device_data* fDeviceData; 64 }; 65 66 #endif // _DISK_DEVICE_H 67