1 //----------------------------------------------------------------------
2 // This software is part of the OpenBeOS distribution and is covered
4 //---------------------------------------------------------------------
11 #include <KDiskDevice.h>
12 #include <KFileDiskDevice.h>
13 #include <KDiskDeviceManager.h>
14 #include <KDiskDeviceUtils.h>
16 const char *kTestFileDevice
= "/boot/home/tmp/test-file-device";
20 main(int argc
, char **argv
)
22 const char *testFileDevice
= kTestFileDevice
;
25 testFileDevice
= argv
[1];
27 KDiskDeviceManager::CreateDefault();
28 KDiskDeviceManager
*manager
= KDiskDeviceManager::Default();
29 manager
->InitialDeviceScan();
30 partition_id id
= manager
->CreateFileDevice(testFileDevice
);
32 printf("creating the file device failed: %s\n", strerror(id
));
34 // wait for scanning jobs to finish
35 // (that's hopefully a hack :-))
37 if (ManagerLocker locker
= manager
) {
38 if (manager
->CountJobs() == 0)
45 for (int32 cookie
= 0;
46 KDiskDevice
*device
= manager
->RegisterNextDevice(&cookie
); ) {
47 PartitionRegistrar
_(device
, true);
48 if (DeviceReadLocker locker
= device
) {
54 // error = manager->DeleteFileDevice(kTestFileDevice);
56 // printf("deleting the file device failed: %s\n", strerror(error));
59 KDiskDeviceManager::DeleteDefault();