2003-02-01 01:05:09 +03:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// This software is part of the OpenBeOS distribution and is covered
|
|
|
|
// by the OpenBeOS license.
|
|
|
|
//---------------------------------------------------------------------
|
2003-02-01 00:17:20 +03:00
|
|
|
|
|
|
|
#ifndef _DISK_DEVICE_H
|
|
|
|
#define _DISK_DEVICE_H
|
|
|
|
|
|
|
|
#include <DiskDeviceVisitor.h>
|
|
|
|
#include <ObjectList.h>
|
|
|
|
|
|
|
|
class BPartition;
|
|
|
|
class BSession;
|
|
|
|
|
|
|
|
class BDiskDevice {
|
|
|
|
public:
|
|
|
|
BDiskDevice();
|
|
|
|
~BDiskDevice();
|
|
|
|
|
2003-02-08 03:39:38 +03:00
|
|
|
void Unset();
|
|
|
|
|
2003-02-01 21:12:03 +03:00
|
|
|
off_t Size() const;
|
|
|
|
int32 BlockSize() const;
|
|
|
|
|
2003-02-01 00:17:20 +03:00
|
|
|
int32 CountSessions() const;
|
|
|
|
BSession *SessionAt(int32 index) const;
|
|
|
|
|
|
|
|
int32 CountPartitions() const;
|
|
|
|
|
2003-02-08 03:39:38 +03:00
|
|
|
const char *Path() const;
|
2003-02-16 21:03:59 +03:00
|
|
|
status_t GetName(BString *name, bool includeBusID = true,
|
|
|
|
bool includeLUN = false) const;
|
|
|
|
status_t GetName(char *name, bool includeBusID = true,
|
|
|
|
bool includeLUN = false) const;
|
2003-02-01 00:17:20 +03:00
|
|
|
|
|
|
|
bool IsReadOnly() const;
|
|
|
|
bool IsRemovable() const;
|
|
|
|
bool HasMedia() const;
|
|
|
|
bool IsFloppy() const;
|
2003-02-01 21:12:03 +03:00
|
|
|
uint8 Type() const;
|
2003-02-01 00:17:20 +03:00
|
|
|
|
|
|
|
int32 UniqueID() const;
|
|
|
|
|
2003-02-16 21:03:59 +03:00
|
|
|
status_t Eject(bool update = false);
|
2003-02-01 00:17:20 +03:00
|
|
|
status_t LowLevelFormat(); // TODO: remove?
|
|
|
|
|
2003-02-16 21:03:59 +03:00
|
|
|
status_t Update(bool *updated = NULL);
|
2003-02-01 00:17:20 +03:00
|
|
|
|
|
|
|
BSession *VisitEachSession(BDiskDeviceVisitor *visitor);
|
|
|
|
BPartition *VisitEachPartition(BDiskDeviceVisitor *visitor);
|
|
|
|
bool Traverse(BDiskDeviceVisitor *visitor);
|
|
|
|
|
2003-02-09 02:34:47 +03:00
|
|
|
BSession *SessionWithID(int32 id);
|
|
|
|
BPartition *PartitionWithID(int32 id);
|
|
|
|
|
2003-02-01 00:17:20 +03:00
|
|
|
private:
|
|
|
|
BDiskDevice(const BDiskDevice &);
|
|
|
|
BDiskDevice &operator=(const BDiskDevice &);
|
|
|
|
|
2003-02-08 03:39:38 +03:00
|
|
|
status_t _Unarchive(BMessage *archive);
|
2003-02-16 21:03:59 +03:00
|
|
|
status_t _Update(BMessage *archive);
|
2003-02-08 03:39:38 +03:00
|
|
|
|
|
|
|
bool _AddSession(BSession *session);
|
|
|
|
|
2003-02-01 00:17:20 +03:00
|
|
|
private:
|
2003-02-20 03:22:09 +03:00
|
|
|
friend class BDiskDeviceList;
|
2003-02-08 03:39:38 +03:00
|
|
|
friend class BDiskDeviceRoster;
|
|
|
|
|
|
|
|
BObjectList<BSession> fSessions;
|
2003-02-01 00:17:20 +03:00
|
|
|
int32 fUniqueID;
|
2003-02-08 03:39:38 +03:00
|
|
|
int32 fChangeCounter;
|
|
|
|
status_t fMediaStatus;
|
|
|
|
off_t fSize;
|
2003-02-01 00:17:20 +03:00
|
|
|
int32 fBlockSize;
|
2003-02-08 03:39:38 +03:00
|
|
|
uint8 fType;
|
2003-02-01 00:17:20 +03:00
|
|
|
bool fReadOnly;
|
|
|
|
bool fRemovable;
|
2003-02-08 03:39:38 +03:00
|
|
|
// bool fIsFloppy;
|
|
|
|
char fPath[B_FILE_NAME_LENGTH];
|
2003-02-01 00:17:20 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _DISK_DEVICE_H
|