Made all necessary changes to build the DiskDeviceManager as part of the kernel.

Removed KFileDiskDevice functionality for now (since it would have required more changes).
Also disabled actual partition publishing/unpublishing, because this will
be done differently.
This change will temporarily break the DiskDeviceManagerTest build.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7914 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-06-11 21:03:31 +00:00
parent 960371b741
commit 499b29e3ea
20 changed files with 66 additions and 36 deletions

View File

@ -7,14 +7,11 @@ SEARCH_SOURCE += [ FDirName $(OBOS_TOP) src kits storage ] ;
UsePrivateHeaders [ FDirName kernel boot platform $(OBOS_BOOT_PLATFORM) ] ;
UsePrivateHeaders [ FDirName kernel disk_device_manager ] ;
UsePrivateHeaders [ FDirName kernel util ] ;
UsePrivateHeaders [ FDirName kernel ] ;
UsePrivateHeaders shared ;
UsePrivateHeaders storage ;
# As long as we compile for R5 userland, we define the following macros.
SubDirCcFlags [ FDefines USER R5_MEMORY_LAYOUT ] ;
SubDirC++Flags [ FDefines USER R5_MEMORY_LAYOUT ] ;
SharedLibrary disk_device_manager :
KernelStaticLibrary libdisk_device_manager :
ddm_operation_validation.cpp
ddm_userland_interface.cpp
disk_device_manager.cpp
@ -24,7 +21,7 @@ SharedLibrary disk_device_manager :
KDiskDeviceJobGenerator.cpp
KDiskDeviceJobQueue.cpp
KDiskDeviceManager.cpp
KFileDiskDevice.cpp
# KFileDiskDevice.cpp
KDiskSystem.cpp
KFileSystem.cpp
KPartition.cpp
@ -55,14 +52,6 @@ SharedLibrary disk_device_manager :
DiskDeviceTypes.cpp
;
LinkSharedOSLibs libdisk_device_manager.so
: <boot!home!config!lib>libkernelland_emu.so ;
# Hack to enable ddm_userland_interface.cpp to include vm.h but not make
# kernel/stdio.h shadow the real stdio.h
ObjectHdrs [ FGristFiles ddm_userland_interface$(SUFOBJ) ]
: [ PrivateHeaders kernel [ FDirName kernel arch $(OBOS_ARCH) ] ] ;
# KFileDiskDevice.cpp needs the virtualdrive.h Header. Add it here to not
# contaminate the include paths for the other files.
ObjectHdrs [ FGristFiles KFileDiskDevice$(SUFOBJ) ]

View File

@ -5,6 +5,7 @@
#include <stdio.h>
#include <unistd.h>
#include <KernelExport.h>
#include <Drivers.h>
#include "ddm_userland_interface.h"
@ -16,7 +17,7 @@
// debugging
//#define DBG(x)
#define DBG(x) x
#define OUT printf
#define OUT dprintf
// constructor
KDiskDevice::KDiskDevice(partition_id id)

View File

@ -4,13 +4,14 @@
#include "ddm_userland_interface.h"
#include <util/kernel_cpp.h>
#include <KDiskDeviceJob.h>
#include <KDiskDeviceUtils.h>
// debugging
//#define DBG(x)
#define DBG(x) x
#define OUT printf
#define OUT dprintf
// constructor
KDiskDeviceJob::KDiskDeviceJob(uint32 type, partition_id partitionID,

View File

@ -1,6 +1,6 @@
// KDiskDeviceJobFactory.cpp
#include <new>
#include <util/kernel_cpp.h>
#include "KDiskDeviceJob.h"
#include "KDiskDeviceJobFactory.h"

View File

@ -453,7 +453,9 @@ KDiskDeviceJobGenerator::_GenerateRemainingJobs(KShadowPartition *parent,
}
// recurse
for (int32 i = 0; KPartition *_child = partition->ChildAt(i); i++) {
KShadowPartition *child = dynamic_cast<KShadowPartition *>(_child);
// ToDo: was:
// KShadowPartition *child = dynamic_cast<KShadowPartition *>(_child);
KShadowPartition *child = static_cast<KShadowPartition *>(_child);
if (!child)
return B_BAD_VALUE;
status_t error = _GenerateRemainingJobs(partition, child);

View File

@ -1,12 +1,12 @@
// KDiskDeviceJobQueue.cpp
#include <new>
#include <stdio.h>
#include <string.h>
#include <Vector.h>
#include <KernelExport.h>
#include <util/kernel_cpp.h>
#include "KDiskDevice.h"
#include "KDiskDeviceJob.h"
@ -17,7 +17,7 @@
// debugging
//#define DBG(x)
#define DBG(x) x
#define OUT printf
#define OUT dprintf
using namespace std;

View File

@ -1,5 +1,8 @@
// KDiskDeviceManager.cpp
#include <KernelExport.h>
#include <util/kernel_cpp.h>
#include <dirent.h>
#include <errno.h>
#include <module.h>
@ -28,7 +31,7 @@
// debugging
//#define DBG(x)
#define DBG(x) x
#define OUT printf
#define OUT dprintf
// directories for partitioning and file system modules
static const char *kPartitioningSystemPrefix = "partitioning_systems";
@ -305,6 +308,8 @@ 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<KFileDiskDevice*>(device);
if (fileDevice && fileDevice->FilePath()
@ -312,6 +317,7 @@ KDiskDeviceManager::FindFileDevice(const char *filePath)
return fileDevice;
}
}
#endif
return NULL;
}
@ -487,6 +493,9 @@ KDiskDeviceManager::WriteLockPartition(partition_id id)
partition_id
KDiskDeviceManager::CreateFileDevice(const char *filePath)
{
// ToDo!
return B_ERROR;
#if 0
if (!filePath)
return B_BAD_VALUE;
status_t error = B_ERROR;
@ -517,12 +526,14 @@ KDiskDeviceManager::CreateFileDevice(const char *filePath)
delete device;
}
return error;
#endif
}
// DeleteFileDevice
status_t
KDiskDeviceManager::DeleteFileDevice(const char *filePath)
{
#if 0
if (KFileDiskDevice *device = RegisterFileDevice(filePath)) {
PartitionRegistrar _(device, true);
if (DeviceWriteLocker locker = device) {
@ -530,6 +541,7 @@ KDiskDeviceManager::DeleteFileDevice(const char *filePath)
return B_OK;
}
}
#endif
return B_ERROR;
}
@ -537,6 +549,8 @@ 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<KFileDiskDevice*>(device) || id != device->ID())
@ -546,6 +560,7 @@ KDiskDeviceManager::DeleteFileDevice(partition_id id)
return B_OK;
}
}
#endif
return B_ERROR;
}

View File

@ -3,6 +3,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <util/kernel_cpp.h>
#include "ddm_userland_interface.h"
#include "KDiskDeviceManager.h"
#include "KDiskDeviceUtils.h"
@ -11,7 +13,7 @@
// debugging
//#define DBG(x)
#define DBG(x) x
#define OUT printf
#define OUT dprintf
// constructor
KDiskSystem::KDiskSystem(const char *name)

View File

@ -5,6 +5,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <KernelExport.h>
#include <Drivers.h>
#include <KDiskDeviceUtils.h>
@ -15,7 +16,7 @@
// debugging
//#define DBG(x)
#define DBG(x) x
#define OUT printf
#define OUT dprintf
static const char *kFileDevicesDir = "/dev/disk/virtual/files";

View File

@ -2,13 +2,14 @@
#include <errno.h>
#include <fcntl.h>
#include <new>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <KernelExport.h>
#include <Drivers.h>
#include <Errors.h>
#include <util/kernel_cpp.h>
#include <ddm_userland_interface.h>
#include <KDiskDevice.h>
@ -27,7 +28,7 @@ using namespace std;
// debugging
//#define DBG(x)
#define DBG(x) x
#define OUT printf
#define OUT dprintf
// ListenerSet
struct KPartition::ListenerSet : VectorSet<KPartitionListener*> {};
@ -163,6 +164,8 @@ status_t
KPartition::PublishDevice()
{
// prepare a partition_info
// ToDo!
#if 0
partition_info info;
info.offset = Offset();
info.size = Size();
@ -187,12 +190,16 @@ KPartition::PublishDevice()
error = errno;
close(fd);
return error;
#endif
return B_ERROR;
}
// UnpublishDevice
status_t
KPartition::UnpublishDevice()
{
return B_OK;
#if 0
// get the entry path
char path[B_PATH_NAME_LENGTH];
status_t error = GetPath(path);
@ -202,6 +209,7 @@ KPartition::UnpublishDevice()
if (remove(path) < 0)
return errno;
return B_OK;
#endif
}
// SetBusy

View File

@ -1,6 +1,8 @@
// KPartitionListener.cpp
#include <KPartitionListener.h>
#include <util/kernel_cpp.h>
// constructor
KPartitionListener::KPartitionListener()

View File

@ -1,6 +1,7 @@
// KPartitionVisitor.cpp
#include "KPartitionVisitor.h"
#include <util/kernel_cpp.h>
// constructor
KPartitionVisitor::KPartitionVisitor()

View File

@ -2,13 +2,13 @@
#include <errno.h>
#include <fcntl.h>
#include <new>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <Drivers.h>
#include <Errors.h>
#include <util/kernel_cpp.h>
#include "KDiskDevice.h"
#include "KDiskDeviceManager.h"
@ -21,7 +21,7 @@ using namespace std;
// debugging
//#define DBG(x)
#define DBG(x) x
#define OUT printf
#define OUT dprintf
// constructor
KPhysicalPartition::KPhysicalPartition(partition_id id)
@ -70,6 +70,9 @@ KPhysicalPartition::Open(int flags, int *fd)
status_t
KPhysicalPartition::PublishDevice()
{
// ToDo!
return B_ERROR;
#if 0
// prepare a partition_info
partition_info info;
info.offset = Offset();
@ -95,12 +98,14 @@ KPhysicalPartition::PublishDevice()
error = errno;
close(fd);
return error;
#endif
}
// UnpublishDevice
status_t
KPhysicalPartition::UnpublishDevice()
{
#if 0
// get the entry path
char path[B_PATH_NAME_LENGTH];
status_t error = GetPath(path);
@ -109,6 +114,7 @@ KPhysicalPartition::UnpublishDevice()
// remove the entry
if (remove(path) < 0)
return errno;
#endif
return B_OK;
}

View File

@ -2,13 +2,13 @@
#include <errno.h>
#include <fcntl.h>
#include <new>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <Drivers.h>
#include <Errors.h>
#include <util/kernel_cpp.h>
#include "ddm_userland_interface.h"
#include "KDiskDevice.h"
@ -21,7 +21,7 @@ using namespace std;
// debugging
//#define DBG(x)
#define DBG(x) x
#define OUT printf
#define OUT dprintf
// constructor
KShadowPartition::KShadowPartition(KPhysicalPartition *partition)

View File

@ -1,6 +1,6 @@
// RWLocker.cpp
#include <new>
#include <util/kernel_cpp.h>
#include "RWLocker.h"

View File

@ -1,7 +1,6 @@
// UserDataWriter.cpp
#include <new>
#include <util/kernel_cpp.h>
#include <ddm_userland_interface.h>
#include <Vector.h>

View File

@ -1,5 +1,6 @@
// disk_device_manager.cpp
#include <KernelExport.h>
#include <stdio.h>
#include "disk_device_manager.h"
@ -14,7 +15,7 @@
// debugging
//#define DBG(x)
#define DBG(x) x
#define OUT printf
#define OUT dprintf
// write_lock_disk_device
disk_device_data *

View File

@ -2,6 +2,7 @@
#include <stdio.h>
#include <KernelExport.h>
#include <DiskDeviceDefs.h>
#include <KDiskDevice.h>
#include <KDiskDeviceManager.h>
@ -16,7 +17,7 @@
// debugging
//#define DBG(x)
#define DBG(x) x
#define OUT printf
#define OUT dprintf
// constructor
KResizeJob::KResizeJob(partition_id parentID, partition_id partitionID,

View File

@ -13,7 +13,7 @@
// debugging
#define DBG(x)
//#define DBG(x) x
#define OUT printf
#define OUT dprintf
// constructor
KScanPartitionJob::KScanPartitionJob(partition_id partitionID)

View File

@ -2,6 +2,7 @@
#include <stdio.h>
#include <KernelExport.h>
#include <DiskDeviceDefs.h>
#include <KDiskDevice.h>
#include <KDiskDeviceManager.h>
@ -14,7 +15,7 @@
// debugging
//#define DBG(x)
#define DBG(x) x
#define OUT printf
#define OUT dprintf
// constructor
KUninitializeJob::KUninitializeJob(partition_id partitionID)