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
This commit is contained in:
@@ -22,7 +22,7 @@ KernelMergeObject kernel_disk_device_manager.o :
|
|||||||
KDiskDeviceJobGenerator.cpp
|
KDiskDeviceJobGenerator.cpp
|
||||||
KDiskDeviceJobQueue.cpp
|
KDiskDeviceJobQueue.cpp
|
||||||
KDiskDeviceManager.cpp
|
KDiskDeviceManager.cpp
|
||||||
# KFileDiskDevice.cpp
|
KFileDiskDevice.cpp
|
||||||
KDiskSystem.cpp
|
KDiskSystem.cpp
|
||||||
KFileSystem.cpp
|
KFileSystem.cpp
|
||||||
KPartition.cpp
|
KPartition.cpp
|
||||||
|
|||||||
@@ -313,8 +313,6 @@ KDiskDeviceManager::FindDevice(partition_id id, bool deviceOnly)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#include "AutoDeleter.h"
|
|
||||||
|
|
||||||
// FindPartition
|
// FindPartition
|
||||||
KPartition *
|
KPartition *
|
||||||
KDiskDeviceManager::FindPartition(const char *path, bool noShadow)
|
KDiskDeviceManager::FindPartition(const char *path, bool noShadow)
|
||||||
@@ -354,8 +352,6 @@ KDiskDeviceManager::FindPartition(partition_id id, bool noShadow)
|
|||||||
KFileDiskDevice *
|
KFileDiskDevice *
|
||||||
KDiskDeviceManager::FindFileDevice(const char *filePath)
|
KDiskDeviceManager::FindFileDevice(const char *filePath)
|
||||||
{
|
{
|
||||||
// ToDo: this solution makes use of dynamic_cast!
|
|
||||||
#if 0
|
|
||||||
for (int32 cookie = 0; KDiskDevice *device = NextDevice(&cookie); ) {
|
for (int32 cookie = 0; KDiskDevice *device = NextDevice(&cookie); ) {
|
||||||
KFileDiskDevice *fileDevice = dynamic_cast<KFileDiskDevice*>(device);
|
KFileDiskDevice *fileDevice = dynamic_cast<KFileDiskDevice*>(device);
|
||||||
if (fileDevice && fileDevice->FilePath()
|
if (fileDevice && fileDevice->FilePath()
|
||||||
@@ -363,7 +359,6 @@ KDiskDeviceManager::FindFileDevice(const char *filePath)
|
|||||||
return fileDevice;
|
return fileDevice;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -595,8 +590,6 @@ KDiskDeviceManager::DeleteFileDevice(const char *filePath)
|
|||||||
status_t
|
status_t
|
||||||
KDiskDeviceManager::DeleteFileDevice(partition_id id)
|
KDiskDeviceManager::DeleteFileDevice(partition_id id)
|
||||||
{
|
{
|
||||||
// ToDo: there is no dynamic_cast in the kernel!
|
|
||||||
#if 0
|
|
||||||
if (KDiskDevice *device = RegisterDevice(id)) {
|
if (KDiskDevice *device = RegisterDevice(id)) {
|
||||||
PartitionRegistrar _(device, true);
|
PartitionRegistrar _(device, true);
|
||||||
if (!dynamic_cast<KFileDiskDevice*>(device) || id != device->ID())
|
if (!dynamic_cast<KFileDiskDevice*>(device) || id != device->ID())
|
||||||
@@ -606,7 +599,6 @@ KDiskDeviceManager::DeleteFileDevice(partition_id id)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ KFileDiskDevice::SetTo(const char *filePath, const char *devicePath)
|
|||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
// make the directory
|
// make the directory
|
||||||
status_t error = _GetDirectoryPath(ID(), tmpDevicePath);
|
status_t error = _GetDirectoryPath(ID(), &tmpDevicePath);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
if (mkdir(tmpDevicePath.Path(), 0777) != 0)
|
if (mkdir(tmpDevicePath.Path(), 0777) != 0)
|
||||||
@@ -85,7 +85,7 @@ KFileDiskDevice::SetTo(const char *filePath, const char *devicePath)
|
|||||||
return B_BUFFER_OVERFLOW;
|
return B_BUFFER_OVERFLOW;
|
||||||
devicePath = tmpDevicePath.Path();
|
devicePath = tmpDevicePath.Path();
|
||||||
// register the file as virtual drive
|
// register the file as virtual drive
|
||||||
status_t error = _RegisterDevice(filePath, devicePath);
|
error = _RegisterDevice(filePath, devicePath);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
@@ -176,6 +176,8 @@ KFileDiskDevice::_RegisterDevice(const char *file, const char *device)
|
|||||||
status_t
|
status_t
|
||||||
KFileDiskDevice::_UnregisterDevice(const char *_device)
|
KFileDiskDevice::_UnregisterDevice(const char *_device)
|
||||||
{
|
{
|
||||||
|
return B_ERROR;
|
||||||
|
#if 0
|
||||||
// read the symlink to get the path of the virtualdrive device
|
// read the symlink to get the path of the virtualdrive device
|
||||||
char device[B_PATH_NAME_LENGTH];
|
char device[B_PATH_NAME_LENGTH];
|
||||||
ssize_t bytesRead = readlink(_device, device, sizeof(device) - 1);
|
ssize_t bytesRead = readlink(_device, device, sizeof(device) - 1);
|
||||||
@@ -198,6 +200,7 @@ KFileDiskDevice::_UnregisterDevice(const char *_device)
|
|||||||
error = errno;
|
error = errno;
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// _GetDirectoryPath
|
// _GetDirectoryPath
|
||||||
@@ -206,9 +209,9 @@ KFileDiskDevice::_GetDirectoryPath(partition_id id, KPath *path)
|
|||||||
{
|
{
|
||||||
if (!path || path->InitCheck() != B_OK)
|
if (!path || path->InitCheck() != B_OK)
|
||||||
return path->InitCheck();
|
return path->InitCheck();
|
||||||
status_t error = path->SetString(kFileDevicesDir);
|
status_t error = path->SetPath(kFileDevicesDir);
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
char idBuffer[12]
|
char idBuffer[12];
|
||||||
sprintf(idBuffer, "%ld", id);
|
sprintf(idBuffer, "%ld", id);
|
||||||
error = path->Append(idBuffer);
|
error = path->Append(idBuffer);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user