diff --git a/headers/private/storage/DiskDevice.h b/headers/private/storage/DiskDevice.h index caebcc8f04..3bc65afcf7 100644 --- a/headers/private/storage/DiskDevice.h +++ b/headers/private/storage/DiskDevice.h @@ -17,7 +17,7 @@ public: void Unset(); bool IsModified() const; - uint32 CommitModifications(bool synchronously = true, + status_t CommitModifications(bool synchronously = true, BMessenger progressMessenger = BMessenger(), bool receiveCompleteProgressUpdates = true, BMessage *template = NULL); diff --git a/headers/private/storage/DiskDeviceJob.h b/headers/private/storage/DiskDeviceJob.h index b08be618b5..78c8e38055 100644 --- a/headers/private/storage/DiskDeviceJob.h +++ b/headers/private/storage/DiskDeviceJob.h @@ -29,21 +29,38 @@ enum { B_DISK_DEVICE_JOB_CANCELED, }; +// disk device job progress info +struct disk_device_progress_info { + int32 task_count; + int32 completed_tasks; + float current_task_progress; + char current_task_description[256]; +}; + +// disk device job cancel properties +enum { + B_DISK_DEVICE_JOB_CAN_CANCEL = 0x01, + B_DISK_DEVICE_JOB_STOP_ON_CANCEL = 0x02, + B_DISK_DEVICE_JOB_REVERSE_ON_CANCEL = 0x04, +}; + class BDiskDeviceJob { public: - uint32 ID() const; + disk_job_id ID() const; uint32 Type() const; float Progress() const; // [0.0, 1.0] uint32 Status() const; const char *Description() const; + status_t GetProgressInfo(disk_devive_progress_info *info) const; + uint32 CancelProperties() const; - BPartition* Partition() const; + partition_id PartitionID() const; + private: - uint32 fJobID; - uint32 fType; - uint32 fPartitionID; - uint32 fStatus; - BString fDescription; + disk_job_id fJobID; + uint32 fType; + partition_id fPartitionID; + BString fDescription; }; #endif // _DISK_DEVICE_JOB_H diff --git a/headers/private/storage/DiskDeviceList.h b/headers/private/storage/DiskDeviceList.h index c105f983bf..ae017e2627 100644 --- a/headers/private/storage/DiskDeviceList.h +++ b/headers/private/storage/DiskDeviceList.h @@ -28,8 +28,8 @@ public: bool Lock(); void Unlock(); - uint32 CountDevices() const; - BDiskDevice *DeviceAt(uint32 index) const; + int32 CountDevices() const; + BDiskDevice *DeviceAt(int32 index) const; BDiskDevice *VisitEachDevice(BDiskDeviceVisitor *visitor); BPartition *VisitEachPartition(BDiskDeviceVisitor *visitor); @@ -39,8 +39,8 @@ public: BPartition *VisitEachMountablePartition(BDiskDeviceVisitor *visitor); BPartition *VisitEachInitializablePartition(BDiskDeviceVisitor *visitor); - BDiskDevice *DeviceWithID(uint32 id) const; - BPartition *PartitionWithID(uint32 id) const; + BDiskDevice *DeviceWithID(partition_id id) const; + BPartition *PartitionWithID(partition_id id) const; virtual void MountPointMoved(BPartition *partition); virtual void PartitionMounted(BPartition *partition); diff --git a/headers/private/storage/DiskDevicePrivate.h b/headers/private/storage/DiskDevicePrivate.h index 5a8b45e122..5a8bb68ca9 100644 --- a/headers/private/storage/DiskDevicePrivate.h +++ b/headers/private/storage/DiskDevicePrivate.h @@ -36,13 +36,13 @@ private: // IDFinderVisitor class IDFinderVisitor : public BDiskDeviceVisitor { public: - IDFinderVisitor(uint32 id); + IDFinderVisitor(partition_id id); virtual bool Visit(BDiskDevice *device); virtual bool Visit(BPartition *partition); private: - uint32 fID; + partition_id fID; }; status_t get_disk_device_messenger(BMessenger *messenger); diff --git a/headers/private/storage/DiskDeviceRoster.h b/headers/private/storage/DiskDeviceRoster.h index 2929ca6693..c05bf79361 100644 --- a/headers/private/storage/DiskDeviceRoster.h +++ b/headers/private/storage/DiskDeviceRoster.h @@ -98,6 +98,12 @@ public: status_t GetNextActiveJob(BDiskDeviceJob *job); status_t RewindActiveJobs(); + partition_id RegisterDeviceFile(const char *filename); + // publishes: /dev/disk/virtual/files//raw + status_t UnregisterDeviceFile(const char *filename); + status_t UnregisterDeviceFile(partition_id device); +// TODO: Add the respective syscalls. Also for Get{Device,Partition}ForPath() + bool VisitEachDevice(BDiskDeviceVisitor *visitor, BDiskDevice *device = NULL); bool VisitEachPartition(BDiskDeviceVisitor *visitor, @@ -118,10 +124,16 @@ public: BDiskDevice *device = NULL, BPartition **partition = NULL); - status_t GetDeviceWithID(uint32 id, BDiskDevice *device) const; - status_t GetPartitionWithID(uint32 id, BDiskDevice *device, + status_t GetDeviceWithID(partition_id id, BDiskDevice *device) const; + status_t GetPartitionWithID(partition_id id, BDiskDevice *device, BPartition **partition) const; + partition_id GetDeviceForPath(const char *filename, BDiskDevice *device, + bool registerIfFile = false); + partition_id GetPartitionForPath(const char *filename, BDiskDevice *device, + BPartition **partition, + bool registerIfFile = false); + status_t StartWatching(BMessenger target, uint32 eventMask = B_DEVICE_REQUEST_ALL); status_t StartWatchingJob(BDiskDeviceJob *job, BMessenger target, @@ -129,19 +141,19 @@ public: status_t StopWatching(BMessenger target); private: - status_t _GetObjectWithID(const char *fieldName, uint32 id, + status_t _GetObjectWithID(const char *fieldName, partition_id id, BDiskDevice *device) const; // TODO: Introduce iterators instead of these functions. - static status_t _GetNextAddOn(BDirectory **directory, uint32 *index, + static status_t _GetNextAddOn(BDirectory **directory, int32 *index, const char *subdir, BPrivate::AddOnImage *image); static status_t _GetNextAddOn(BDirectory *directory, BPrivate::AddOnImage *image); - static status_t _GetNextAddOnDir(BPath *path, uint32 *index, + static status_t _GetNextAddOnDir(BPath *path, int32 *index, const char *subdir); - static status_t _GetNextAddOnDir(BDirectory **directory, uint32 *index, + static status_t _GetNextAddOnDir(BDirectory **directory, int32 *index, const char *subdir); static status_t _LoadPartitionAddOn(const char *partitioningSystem, @@ -150,11 +162,11 @@ private: private: BMessenger fManager; - uint32 fCookie; + int32 fCookie; BDirectory *fPartitionAddOnDir; BDirectory *fFSAddOnDir; - uint32 fPartitionAddOnDirIndex; - uint32 fFSAddOnDirIndex; + int32 fPartitionAddOnDirIndex; + int32 fFSAddOnDirIndex; }; #endif // _DISK_DEVICE_ROSTER_H diff --git a/headers/private/storage/DiskSystem.h b/headers/private/storage/DiskSystem.h index 1775f87df9..c26b7f1e96 100644 --- a/headers/private/storage/DiskSystem.h +++ b/headers/private/storage/DiskSystem.h @@ -8,6 +8,7 @@ class BDiskSystem { public: + const char *ShortName() const; const char *Name() const; bool SupportsDefragmenting(BPartition *partition, bool *whileMounted) const; diff --git a/headers/private/storage/Partition.h b/headers/private/storage/Partition.h index 9e7dd11d8d..e53290bdb6 100644 --- a/headers/private/storage/Partition.h +++ b/headers/private/storage/Partition.h @@ -24,7 +24,7 @@ public: off_t Offset() const; // 0 for devices off_t Size() const; uint32 BlockSize() const; - uint32 Index() const; // 0 for devices + int32 Index() const; // 0 for devices uint32 Status() const; bool IsMountable() const; @@ -35,9 +35,10 @@ public: bool IsMounted() const; const char* Name() const; + const char* ContentName() const; const char* Type() const; // See DiskDeviceTypes.h const char* ContentType() const; // See DiskDeviceTypes.h - uint32 UniqueID() const; + partition_id UniqueID() const; uint32 Flags() const; status_t GetPath(BPath *path) const; @@ -49,10 +50,10 @@ public: // Hierarchy Info - BDiskDevice* Device() const; - BPartition* Parent() const; - BPartition* ChildAt(uint32 index) const; - uint32 CountChildren() const; + BDiskDevice *Device() const; + BPartition *Parent() const; + BPartition *ChildAt(int32 index) const; + int32 CountChildren() const; BPartitioningInfo* GetPartitioningInfo() const; @@ -85,6 +86,8 @@ public: BDiskScannerParameterEditor **contentEditor); status_t SetParameters(const char *parameters, const char *contentParameters); +// TODO: Add name/content name editing methods, Also in BDiskSystem. + bool CanInitialize(const char *diskSystem) const; status_t GetInitializationParameterEditor(const char *system, BDiskScannerParameterEditor **editor) const; @@ -101,14 +104,14 @@ public: status_t CreateChild(off_t start, off_t size, const char *parameters, BPartition** child = NULL); - bool CanDeleteChild(uint32 index) const; - status_t DeleteChild(uint32 index); + bool CanDeleteChild(int32 index) const; + status_t DeleteChild(int32 index); protected: off_t fOffset; off_t fSize; uint32 fBlockSize; - uint32 fIndex; + int32 fIndex; uint32 fStatus; bool fIsMountable; @@ -122,12 +125,12 @@ protected: char fType[B_FILE_NAME_LENGTH]; char fContentType[B_FILE_NAME_LENGTH]; - uint32 fUniqueID; + partition_id fUniqueID; uint32 fFlags; BObjectList fChildren; - uint32 fChangeCounter; + int32 fChangeCounter; } #endif // _PARTITION_H diff --git a/headers/private/storage/PartitioningInfo.h b/headers/private/storage/PartitioningInfo.h index f38361c329..789f23b562 100644 --- a/headers/private/storage/PartitioningInfo.h +++ b/headers/private/storage/PartitioningInfo.h @@ -10,14 +10,16 @@ class BPartition; class BPartitioningInfo { public: - status_t GetPartitionableSpaceAt(uint32 index, off_t *Offset, off_t *Size) const; - uint32 CountPartitionableSpaces() const; + status_t GetPartitionableSpaceAt(int32 index, off_t *offset, + off_t *size) const; + int32 CountPartitionableSpaces() const; + + BPartition *Parent() const; // needed? - BPartition* Parent() const; private: - off_t *fOffsetArray; - off_t *fSizeArray; - uint32 fCount; + off_t *fOffsetArray; + off_t *fSizeArray; + int32 fCount; }; #endif // _PARTITIONING_INFO_H