Re-enabled Disk Device API test. Well, almost the complete old code is commented out. ;-)
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3885 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -42,4 +42,5 @@ CommonTestLib libstoragetest.so
|
|||||||
DEPENDS libstoragetest_r5.so : $(resdir_r5) ;
|
DEPENDS libstoragetest_r5.so : $(resdir_r5) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SubInclude OBOS_TOP src tests kits storage disk_device ;
|
||||||
SubInclude OBOS_TOP src tests kits storage virtualdrive ;
|
SubInclude OBOS_TOP src tests kits storage virtualdrive ;
|
||||||
|
|||||||
@@ -8,70 +8,66 @@
|
|||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <DiskDevice.h>
|
#include <DiskDevice.h>
|
||||||
#include <DiskDeviceList.h>
|
//#include <DiskDeviceList.h>
|
||||||
#include <DiskDeviceRoster.h>
|
#include <DiskDeviceRoster.h>
|
||||||
|
#include <DiskDeviceVisitor.h>
|
||||||
|
#include <KDiskDeviceManager.h> // for userland testing only
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <Messenger.h>
|
#include <Messenger.h>
|
||||||
#include <Partition.h>
|
#include <Partition.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <ObjectList.h>
|
//#include <ObjectList.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
#include <Session.h>
|
|
||||||
|
|
||||||
// DumpVisitor
|
// DumpVisitor
|
||||||
class DumpVisitor : public BDiskDeviceVisitor {
|
class DumpVisitor : public BDiskDeviceVisitor {
|
||||||
public:
|
public:
|
||||||
virtual bool Visit(BDiskDevice *device)
|
virtual bool Visit(BDiskDevice *device)
|
||||||
{
|
{
|
||||||
printf("device `%s'\n", device->Path());
|
BPath path;
|
||||||
BString name;
|
status_t error = device->GetPath(&path);
|
||||||
if (device->GetName(&name, false, false) == B_OK)
|
const char *pathString = NULL;
|
||||||
printf(" name(0,0): `%s'\n", name.String());
|
if (error == B_OK)
|
||||||
if (device->GetName(&name, false, true) == B_OK)
|
pathString = path.Path();
|
||||||
printf(" name(0,1): `%s'\n", name.String());
|
else
|
||||||
if (device->GetName(&name, true, false) == B_OK)
|
pathString = strerror(error);
|
||||||
printf(" name(1,0): `%s'\n", name.String());
|
printf("device %ld: `%s'\n", device->UniqueID(), pathString);
|
||||||
if (device->GetName(&name, true, true) == B_OK)
|
|
||||||
printf(" name(1,1): `%s'\n", name.String());
|
|
||||||
printf(" size: %lld\n", device->Size());
|
|
||||||
printf(" block size: %ld\n", device->BlockSize());
|
|
||||||
printf(" read-only: %d\n", device->IsReadOnly());
|
|
||||||
printf(" removable: %d\n", device->IsRemovable());
|
printf(" removable: %d\n", device->IsRemovable());
|
||||||
printf(" has media: %d\n", device->HasMedia());
|
printf(" has media: %d\n", device->HasMedia());
|
||||||
printf(" type: 0x%x\n", device->Type());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool Visit(BSession *session)
|
|
||||||
{
|
|
||||||
printf(" session %ld:\n", session->Index());
|
|
||||||
printf(" offset: %lld\n", session->Offset());
|
|
||||||
printf(" size: %lld\n", session->Size());
|
|
||||||
printf(" block size: %ld\n", session->BlockSize());
|
|
||||||
printf(" flags: %lx\n", session->Flags());
|
|
||||||
printf(" partitioning : `%s'\n", session->PartitioningSystem());
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool Visit(BPartition *partition)
|
virtual bool Visit(BPartition *partition)
|
||||||
{
|
{
|
||||||
printf(" partition %ld:\n", partition->Index());
|
BPath path;
|
||||||
|
status_t error = partition->GetPath(&path);
|
||||||
|
const char *pathString = NULL;
|
||||||
|
if (error == B_OK)
|
||||||
|
pathString = path.Path();
|
||||||
|
else
|
||||||
|
pathString = strerror(error);
|
||||||
|
printf(" partition %ld: `%s'\n", partition->UniqueID(), pathString);
|
||||||
printf(" offset: %lld\n", partition->Offset());
|
printf(" offset: %lld\n", partition->Offset());
|
||||||
printf(" size: %lld\n", partition->Size());
|
printf(" size: %lld\n", partition->Size());
|
||||||
// printf(" device: `%s'\n", partition->Size());
|
printf(" block size: %lu\n", partition->BlockSize());
|
||||||
|
printf(" index: %ld\n", partition->Index());
|
||||||
|
printf(" status: %lu\n", partition->Status());
|
||||||
|
printf(" mountable: %d\n", partition->IsMountable());
|
||||||
|
printf(" partitionable: %d\n", partition->IsPartitionable());
|
||||||
|
printf(" device: %d\n", partition->IsDevice());
|
||||||
|
printf(" read only: %d\n", partition->IsReadOnly());
|
||||||
|
printf(" mounted: %d\n", partition->IsMounted());
|
||||||
printf(" flags: %lx\n", partition->Flags());
|
printf(" flags: %lx\n", partition->Flags());
|
||||||
printf(" partition name: `%s'\n", partition->Name());
|
printf(" name: `%s'\n", partition->Name());
|
||||||
printf(" partition type: `%s'\n", partition->Type());
|
printf(" content name: `%s'\n", partition->ContentName());
|
||||||
printf(" FS short name: `%s'\n",
|
printf(" type: `%s'\n", partition->Type());
|
||||||
partition->FileSystemShortName());
|
printf(" content type: `%s'\n", partition->ContentType());
|
||||||
printf(" FS long name: `%s'\n",
|
// volume, icon,...
|
||||||
partition->FileSystemLongName());
|
|
||||||
printf(" volume name: `%s'\n", partition->VolumeName());
|
|
||||||
printf(" FS flags: 0x%lx\n", partition->FileSystemFlags());
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
// print_time
|
// print_time
|
||||||
void
|
void
|
||||||
print_time(const char *format, bigtime_t &time)
|
print_time(const char *format, bigtime_t &time)
|
||||||
@@ -467,6 +463,7 @@ printf("device: `%s'\n", device->Path());
|
|||||||
private:
|
private:
|
||||||
MyDeviceList fDeviceList;
|
MyDeviceList fDeviceList;
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
// main
|
// main
|
||||||
int
|
int
|
||||||
@@ -487,8 +484,21 @@ main()
|
|||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
printf("stop watching failed: %s\n", strerror(error));
|
printf("stop watching failed: %s\n", strerror(error));
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
TestApp2 app("application/x-vnd.obos-disk-device-test");
|
TestApp2 app("application/x-vnd.obos-disk-device-test");
|
||||||
app.Run();
|
app.Run();
|
||||||
return 0;
|
return 0;
|
||||||
|
*/
|
||||||
|
|
||||||
|
// for userland testing only
|
||||||
|
KDiskDeviceManager::CreateDefault();
|
||||||
|
KDiskDeviceManager::Default()->InitialDeviceScan();
|
||||||
|
|
||||||
|
BDiskDeviceRoster roster;
|
||||||
|
DumpVisitor visitor;
|
||||||
|
roster.VisitAll(&visitor);
|
||||||
|
|
||||||
|
// for userland testing only
|
||||||
|
KDiskDeviceManager::DeleteDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
SubDir OBOS_TOP src tests kits storage disk_device ;
|
SubDir OBOS_TOP src tests kits storage disk_device ;
|
||||||
|
|
||||||
#UsePrivateHeaders $(DOT) ;
|
#UsePrivateHeaders $(DOT) ;
|
||||||
UsePrivateHeaders app ;
|
#UsePrivateHeaders app ;
|
||||||
UsePrivateHeaders shared ;
|
UsePrivateHeaders [ FDirName kernel disk_device_manager ] ;
|
||||||
|
#UsePrivateHeaders shared ;
|
||||||
UsePrivateHeaders storage ;
|
UsePrivateHeaders storage ;
|
||||||
|
|
||||||
SEARCH_SOURCE += [ FDirName $(OBOS_TOP) src kernel libroot os ]
|
|
||||||
[ FDirName $(OBOS_TOP) src kits app ]
|
|
||||||
[ FDirName $(OBOS_TOP) src kits storage ] ;
|
|
||||||
|
|
||||||
SimpleTest DiskDeviceTest
|
SimpleTest DiskDeviceTest
|
||||||
: DiskDeviceTest.cpp
|
: DiskDeviceTest.cpp
|
||||||
|
|
||||||
@@ -20,7 +17,7 @@ SimpleTest DiskDeviceTest
|
|||||||
# RosterPrivate.cpp
|
# RosterPrivate.cpp
|
||||||
|
|
||||||
: <boot!home!config!lib>libdiskdevice.so be
|
: <boot!home!config!lib>libdiskdevice.so be
|
||||||
|
<boot!home!config!lib>libdisk_device_manager.so
|
||||||
;
|
;
|
||||||
|
|
||||||
Depends DiskDeviceTest : userland_disk_scanner_modules
|
Depends DiskDeviceTest : userland_disk_system_modules ;
|
||||||
gui_disk_scanner_add_ons ;
|
|
||||||
|
|||||||
Reference in New Issue
Block a user