From bdc2eaf5d8764d7d5046f3cfba63acc0e71174f3 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 8 Feb 2003 00:39:38 +0000 Subject: [PATCH] Started implementing the API. Necessary changes to the headers. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2657 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/storage/DiskDevice.h | 20 ++++++++++++--- headers/private/storage/DiskDeviceRoster.h | 3 ++- headers/private/storage/DiskDeviceVisitor.h | 4 +-- headers/private/storage/Partition.h | 17 ++++++++++--- headers/private/storage/Session.h | 27 ++++++++++++++++----- 5 files changed, 54 insertions(+), 17 deletions(-) diff --git a/headers/private/storage/DiskDevice.h b/headers/private/storage/DiskDevice.h index 7b0014cae7..6a5866bda6 100644 --- a/headers/private/storage/DiskDevice.h +++ b/headers/private/storage/DiskDevice.h @@ -17,6 +17,8 @@ public: BDiskDevice(); ~BDiskDevice(); + void Unset(); + off_t Size() const; int32 BlockSize() const; @@ -25,7 +27,7 @@ public: int32 CountPartitions() const; - const char *DevicePath() const; + const char *Path() const; void GetName(BString *name, bool includeBusID = true, bool includeLUN = false) const; void GetName(char *name, bool includeBusID = true, @@ -52,14 +54,24 @@ private: BDiskDevice(const BDiskDevice &); BDiskDevice &operator=(const BDiskDevice &); + status_t _Unarchive(BMessage *archive); + + bool _AddSession(BSession *session); + private: - BObjectList fSessions; + friend class BDiskDeviceRoster; + + BObjectList fSessions; int32 fUniqueID; + int32 fChangeCounter; + status_t fMediaStatus; + off_t fSize; int32 fBlockSize; - char fPath[B_FILE_NAME_LENGTH]; + uint8 fType; bool fReadOnly; bool fRemovable; - bool fIsFloppy; +// bool fIsFloppy; + char fPath[B_FILE_NAME_LENGTH]; }; #endif // _DISK_DEVICE_H diff --git a/headers/private/storage/DiskDeviceRoster.h b/headers/private/storage/DiskDeviceRoster.h index 9aac880753..4fd1507b0b 100644 --- a/headers/private/storage/DiskDeviceRoster.h +++ b/headers/private/storage/DiskDeviceRoster.h @@ -82,7 +82,8 @@ public: status_t StopWatching(BMessenger target); private: - int32 fDeviceID; // iteration state + BMessenger fManager; + int32 fCookie; }; #endif // _DISK_DEVICE_ROSTER_H diff --git a/headers/private/storage/DiskDeviceVisitor.h b/headers/private/storage/DiskDeviceVisitor.h index faebd48a7c..1a38e83254 100644 --- a/headers/private/storage/DiskDeviceVisitor.h +++ b/headers/private/storage/DiskDeviceVisitor.h @@ -17,8 +17,8 @@ class BDiskDeviceVisitor { // return true to abort iteration virtual bool Visit(BDiskDevice *device); - virtual bool Visit(BSession *device); - virtual bool Visit(BPartition *device); + virtual bool Visit(BSession *session); + virtual bool Visit(BPartition *partition); }; #endif _DISK_DEVICE_VISITOR_H diff --git a/headers/private/storage/Partition.h b/headers/private/storage/Partition.h index e759877886..a4dc6d8caa 100644 --- a/headers/private/storage/Partition.h +++ b/headers/private/storage/Partition.h @@ -6,7 +6,7 @@ #ifndef _PARTITION_H #define _PARTITION_H -#include +#include #include #include #include @@ -18,6 +18,8 @@ class BVolume; class BPartition { public: + ~BPartition(); + BSession *Session() const; BDiskDevice *Device() const; @@ -68,19 +70,26 @@ public: private: BPartition(); BPartition(const BPartition &); - ~BPartition(); BPartition &operator=(const BPartition &); + void _Unset(); + status_t _Unarchive(BMessage *archive); + + void _SetSession(BSession *session); + private: + friend class BSession; + BSession *fSession; + int32 fUniqueID; + int32 fChangeCounter; + int32 fIndex; // TODO: Also contains the device name, which we can get from Device() anyway. // We could either remove it from extended_partition_info or list // the individual fields here. extended_partition_info fInfo; - int32 fUniqueID; dev_t fVolumeID; - node_ref fMountPoint; }; #endif // _PARTITION_H diff --git a/headers/private/storage/Session.h b/headers/private/storage/Session.h index 91354e7745..085a4d5a06 100644 --- a/headers/private/storage/Session.h +++ b/headers/private/storage/Session.h @@ -7,7 +7,7 @@ #define _SESSION_H #include -#include +#include #include #include #include @@ -19,10 +19,13 @@ extern const char *B_INTEL_PARTITIONING; class BSession { public: + ~BSession(); + BDiskDevice *Device() const; off_t Offset() const; off_t Size() const; + int32 BlockSize() const; int32 CountPartitions() const; BPartition *PartitionAt(int32 index) const; @@ -53,15 +56,27 @@ public: private: BSession(); - ~BSession(); BSession(const BSession &); BSession &operator=(const BSession &); + void _Unset(); + status_t _Unarchive(BMessage *archive); + + void _SetDevice(BDiskDevice *device); + + bool _AddPartition(BPartition *partition); + private: - BDiskDevice *fDevice; - BObjectList fPartitions; - int32 fUniqueID; - session_info fInfo; + friend class BDiskDevice; + + BDiskDevice *fDevice; + BObjectList fPartitions; + int32 fUniqueID; + int32 fChangeCounter; + int32 fIndex; +// TODO: Only offset, size and flags are used. Cleanup! + session_info fInfo; + BString fPartitioningSystem; }; #endif // _SESSION_H