xref: /haiku/headers/private/storage/DiskDevice.h (revision 51978af14a173e7fae0563b562be5603bc652aeb)
1 //----------------------------------------------------------------------
2 //  This software is part of the OpenBeOS distribution and is covered
3 //  by the OpenBeOS license.
4 //---------------------------------------------------------------------
5 
6 #ifndef _DISK_DEVICE_H
7 #define _DISK_DEVICE_H
8 
9 #include <Partition.h>
10 
11 struct user_disk_device_data;
12 
13 class BDiskDevice : public BPartition {
14 public:
15 	BDiskDevice();
16 	virtual ~BDiskDevice();
17 
18 	bool HasMedia() const;
19 	bool IsRemovableMedia() const;
20 	bool IsReadOnlyMedia() const;
21 	bool IsWriteOnceMedia() const;
22 
23 	status_t Eject(bool update = false);
24 
25 	status_t SetTo(partition_id id);
26 	status_t Update(bool *updated = NULL);
27 	void Unset();
28 	status_t InitCheck() const;
29 
30 	virtual status_t GetPath(BPath *path) const;
31 
32 	bool IsModified() const;
33 	status_t PrepareModifications();
34 	status_t CommitModifications(bool synchronously = true,
35 		BMessenger progressMessenger = BMessenger(),
36 		bool receiveCompleteProgressUpdates = true);
37 	status_t CancelModifications();
38 
39 private:
40 	friend class BDiskDeviceList;
41 	friend class BDiskDeviceRoster;
42 
43 	BDiskDevice::BDiskDevice(const BDiskDevice &);
44 	BDiskDevice &BDiskDevice::operator=(const BDiskDevice &);
45 
46 	static status_t _GetData(partition_id id, bool deviceOnly, bool shadow,
47 							 size_t neededSize, user_disk_device_data **data);
48 
49 	status_t _SetTo(partition_id id, bool deviceOnly, bool shadow,
50 					size_t neededSize);
51 	status_t _SetTo(user_disk_device_data *data);
52 	status_t _Update(bool shadow, bool *updated);
53 	status_t _Update(user_disk_device_data *data, bool *updated);
54 
55 	virtual bool _AcceptVisitor(BDiskDeviceVisitor *visitor, int32 level);
56 
57 	user_disk_device_data	*fDeviceData;
58 };
59 
60 #endif	// _DISK_DEVICE_H
61