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
This commit is contained in:
Ingo Weinhold 2003-02-08 00:39:38 +00:00
parent ae17e5046d
commit bdc2eaf5d8
5 changed files with 54 additions and 17 deletions

View File

@ -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<Session *> fSessions;
friend class BDiskDeviceRoster;
BObjectList<BSession> 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

View File

@ -82,7 +82,8 @@ public:
status_t StopWatching(BMessenger target);
private:
int32 fDeviceID; // iteration state
BMessenger fManager;
int32 fCookie;
};
#endif // _DISK_DEVICE_ROSTER_H

View File

@ -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

View File

@ -6,7 +6,7 @@
#ifndef _PARTITION_H
#define _PARTITION_H
#include <fs_device.h>
#include <disk_scanner.h>
#include <Mime.h>
#include <ObjectList.h>
#include <Point.h>
@ -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

View File

@ -7,7 +7,7 @@
#define _SESSION_H
#include <DiskDeviceVisitor.h>
#include <fs_device.h>
#include <disk_scanner.h>
#include <ObjectList.h>
#include <Point.h>
#include <String.h>
@ -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:
friend class BDiskDevice;
BDiskDevice *fDevice;
BObjectList<BPartition *> fPartitions;
BObjectList<BPartition> fPartitions;
int32 fUniqueID;
int32 fChangeCounter;
int32 fIndex;
// TODO: Only offset, size and flags are used. Cleanup!
session_info fInfo;
BString fPartitioningSystem;
};
#endif // _SESSION_H