From da87ac8c9a68b69a90fdfcb13488dad8b37e7b1c Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Thu, 28 Oct 2004 16:05:22 +0000 Subject: [PATCH] Added KFileDiskDevice to the build again. Fixed compile errors. It won't work yet, though. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9566 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/core/disk_device_manager/Jamfile | 2 +- .../core/disk_device_manager/KDiskDeviceManager.cpp | 8 -------- .../core/disk_device_manager/KFileDiskDevice.cpp | 11 +++++++---- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/kernel/core/disk_device_manager/Jamfile b/src/kernel/core/disk_device_manager/Jamfile index 0a9be8e874..d756156521 100644 --- a/src/kernel/core/disk_device_manager/Jamfile +++ b/src/kernel/core/disk_device_manager/Jamfile @@ -22,7 +22,7 @@ KernelMergeObject kernel_disk_device_manager.o : KDiskDeviceJobGenerator.cpp KDiskDeviceJobQueue.cpp KDiskDeviceManager.cpp -# KFileDiskDevice.cpp + KFileDiskDevice.cpp KDiskSystem.cpp KFileSystem.cpp KPartition.cpp diff --git a/src/kernel/core/disk_device_manager/KDiskDeviceManager.cpp b/src/kernel/core/disk_device_manager/KDiskDeviceManager.cpp index 0922723b1b..a288e9f77d 100644 --- a/src/kernel/core/disk_device_manager/KDiskDeviceManager.cpp +++ b/src/kernel/core/disk_device_manager/KDiskDeviceManager.cpp @@ -313,8 +313,6 @@ KDiskDeviceManager::FindDevice(partition_id id, bool deviceOnly) return NULL; } -//#include "AutoDeleter.h" - // FindPartition KPartition * KDiskDeviceManager::FindPartition(const char *path, bool noShadow) @@ -354,8 +352,6 @@ KDiskDeviceManager::FindPartition(partition_id id, bool noShadow) KFileDiskDevice * KDiskDeviceManager::FindFileDevice(const char *filePath) { - // ToDo: this solution makes use of dynamic_cast! -#if 0 for (int32 cookie = 0; KDiskDevice *device = NextDevice(&cookie); ) { KFileDiskDevice *fileDevice = dynamic_cast(device); if (fileDevice && fileDevice->FilePath() @@ -363,7 +359,6 @@ KDiskDeviceManager::FindFileDevice(const char *filePath) return fileDevice; } } -#endif return NULL; } @@ -595,8 +590,6 @@ KDiskDeviceManager::DeleteFileDevice(const char *filePath) status_t KDiskDeviceManager::DeleteFileDevice(partition_id id) { - // ToDo: there is no dynamic_cast in the kernel! -#if 0 if (KDiskDevice *device = RegisterDevice(id)) { PartitionRegistrar _(device, true); if (!dynamic_cast(device) || id != device->ID()) @@ -606,7 +599,6 @@ KDiskDeviceManager::DeleteFileDevice(partition_id id) return B_OK; } } -#endif return B_ERROR; } diff --git a/src/kernel/core/disk_device_manager/KFileDiskDevice.cpp b/src/kernel/core/disk_device_manager/KFileDiskDevice.cpp index c53ef926f2..f061bbe38f 100644 --- a/src/kernel/core/disk_device_manager/KFileDiskDevice.cpp +++ b/src/kernel/core/disk_device_manager/KFileDiskDevice.cpp @@ -75,7 +75,7 @@ KFileDiskDevice::SetTo(const char *filePath, const char *devicePath) return errno; } // make the directory - status_t error = _GetDirectoryPath(ID(), tmpDevicePath); + status_t error = _GetDirectoryPath(ID(), &tmpDevicePath); if (error != B_OK) return error; if (mkdir(tmpDevicePath.Path(), 0777) != 0) @@ -85,7 +85,7 @@ KFileDiskDevice::SetTo(const char *filePath, const char *devicePath) return B_BUFFER_OVERFLOW; devicePath = tmpDevicePath.Path(); // register the file as virtual drive - status_t error = _RegisterDevice(filePath, devicePath); + error = _RegisterDevice(filePath, devicePath); if (error != B_OK) return error; } @@ -176,6 +176,8 @@ KFileDiskDevice::_RegisterDevice(const char *file, const char *device) status_t KFileDiskDevice::_UnregisterDevice(const char *_device) { +return B_ERROR; +#if 0 // read the symlink to get the path of the virtualdrive device char device[B_PATH_NAME_LENGTH]; ssize_t bytesRead = readlink(_device, device, sizeof(device) - 1); @@ -198,6 +200,7 @@ KFileDiskDevice::_UnregisterDevice(const char *_device) error = errno; } return error; +#endif } // _GetDirectoryPath @@ -206,9 +209,9 @@ KFileDiskDevice::_GetDirectoryPath(partition_id id, KPath *path) { if (!path || path->InitCheck() != B_OK) return path->InitCheck(); - status_t error = path->SetString(kFileDevicesDir); + status_t error = path->SetPath(kFileDevicesDir); if (error == B_OK) { - char idBuffer[12] + char idBuffer[12]; sprintf(idBuffer, "%ld", id); error = path->Append(idBuffer); }