Some changes due to changes in the API. Added disk system iteration.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3909 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
//#include <DiskDeviceList.h>
|
//#include <DiskDeviceList.h>
|
||||||
#include <DiskDeviceRoster.h>
|
#include <DiskDeviceRoster.h>
|
||||||
#include <DiskDeviceVisitor.h>
|
#include <DiskDeviceVisitor.h>
|
||||||
|
#include <DiskSystem.h>
|
||||||
#include <KDiskDeviceManager.h> // for userland testing only
|
#include <KDiskDeviceManager.h> // for userland testing only
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <Messenger.h>
|
#include <Messenger.h>
|
||||||
@@ -31,9 +32,11 @@ public:
|
|||||||
pathString = path.Path();
|
pathString = path.Path();
|
||||||
else
|
else
|
||||||
pathString = strerror(error);
|
pathString = strerror(error);
|
||||||
printf("device %ld: `%s'\n", device->UniqueID(), pathString);
|
printf("device %ld: `%s'\n", device->ID(), pathString);
|
||||||
printf(" removable: %d\n", device->IsRemovable());
|
|
||||||
printf(" has media: %d\n", device->HasMedia());
|
printf(" has media: %d\n", device->HasMedia());
|
||||||
|
printf(" removable: %d\n", device->IsRemovableMedia());
|
||||||
|
printf(" read only: %d\n", device->IsReadOnlyMedia());
|
||||||
|
printf(" write once: %d\n", device->IsWriteOnceMedia());
|
||||||
printf(" ---\n");
|
printf(" ---\n");
|
||||||
Visit(device, 0);
|
Visit(device, 0);
|
||||||
return false;
|
return false;
|
||||||
@@ -51,7 +54,7 @@ public:
|
|||||||
pathString = path.Path();
|
pathString = path.Path();
|
||||||
else
|
else
|
||||||
pathString = strerror(error);
|
pathString = strerror(error);
|
||||||
printf("%spartition %ld: `%s'\n", prefix, partition->UniqueID(),
|
printf("%spartition %ld: `%s'\n", prefix, partition->ID(),
|
||||||
pathString);
|
pathString);
|
||||||
}
|
}
|
||||||
printf("%s offset: %lld\n", prefix, partition->Offset());
|
printf("%s offset: %lld\n", prefix, partition->Offset());
|
||||||
@@ -241,7 +244,7 @@ printf("TestApp::MessageReceived(%.4s)\n", (char*)&message->what);
|
|||||||
int32 id;
|
int32 id;
|
||||||
if (message->FindInt32("device_id", &id) == B_OK) {
|
if (message->FindInt32("device_id", &id) == B_OK) {
|
||||||
for (int32 i = 0; BDiskDevice *device = fDevices.ItemAt(i); i++) {
|
for (int32 i = 0; BDiskDevice *device = fDevices.ItemAt(i); i++) {
|
||||||
if (device->UniqueID() == id) {
|
if (device->ID() == id) {
|
||||||
bool updated;
|
bool updated;
|
||||||
status_t error = device->Update(&updated);
|
status_t error = device->Update(&updated);
|
||||||
printf("updated: %d\n", updated);
|
printf("updated: %d\n", updated);
|
||||||
@@ -503,9 +506,19 @@ main()
|
|||||||
KDiskDeviceManager::CreateDefault();
|
KDiskDeviceManager::CreateDefault();
|
||||||
KDiskDeviceManager::Default()->InitialDeviceScan();
|
KDiskDeviceManager::Default()->InitialDeviceScan();
|
||||||
|
|
||||||
|
// list all disk devices and partitions
|
||||||
BDiskDeviceRoster roster;
|
BDiskDeviceRoster roster;
|
||||||
DumpVisitor visitor;
|
DumpVisitor visitor;
|
||||||
roster.VisitAll(&visitor);
|
roster.VisitAll(&visitor);
|
||||||
|
// list disk systems
|
||||||
|
BDiskSystem diskSystem;
|
||||||
|
while (roster.GetNextDiskSystem(&diskSystem) == B_OK) {
|
||||||
|
printf("disk system:\n");
|
||||||
|
printf(" name: `%s'\n", diskSystem.Name());
|
||||||
|
printf(" pretty name: `%s'\n", diskSystem.PrettyName());
|
||||||
|
printf(" file system: %d (!%d)\n", diskSystem.IsFileSystem(),
|
||||||
|
diskSystem.IsPartitioningSystem());
|
||||||
|
}
|
||||||
|
|
||||||
// for userland testing only
|
// for userland testing only
|
||||||
KDiskDeviceManager::DeleteDefault();
|
KDiskDeviceManager::DeleteDefault();
|
||||||
|
|||||||
Reference in New Issue
Block a user