tests: Fix build & link of the DiskDeviceManagerTest.

This commit is contained in:
Augustin Cavalier 2024-10-16 14:10:36 -04:00
parent 1ad8d90108
commit b0b1b524f8
11 changed files with 150 additions and 66 deletions

View File

@ -1,6 +1,5 @@
SubDir HAIKU_TOP src system kernel disk_device_manager ;
SEARCH_SOURCE += [ FDirName $(SUBDIR) jobs ] ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits storage disk_device ] ;
# DiskDeviceTypes.cpp

View File

@ -9,7 +9,7 @@
// RelocationEntryList
struct UserDataWriter::RelocationEntryList : Vector<addr_t*> {};
// constructor
UserDataWriter::UserDataWriter()
: fBuffer(NULL),
fBufferSize(0),
@ -18,7 +18,7 @@ UserDataWriter::UserDataWriter()
{
}
// constructor
UserDataWriter::UserDataWriter(user_disk_device_data *buffer,
size_t bufferSize)
: fBuffer(NULL),
@ -29,13 +29,13 @@ UserDataWriter::UserDataWriter(user_disk_device_data *buffer,
SetTo(buffer, bufferSize);
}
// destructor
UserDataWriter::~UserDataWriter()
{
delete fRelocationEntries;
}
// SetTo
status_t
UserDataWriter::SetTo(user_disk_device_data *buffer, size_t bufferSize)
{
@ -44,14 +44,14 @@ UserDataWriter::SetTo(user_disk_device_data *buffer, size_t bufferSize)
fBufferSize = bufferSize;
fAllocatedSize = 0;
if (fBuffer && fBufferSize > 0) {
fRelocationEntries = new(nothrow) RelocationEntryList;
fRelocationEntries = new(std::nothrow) RelocationEntryList;
if (!fRelocationEntries)
return B_NO_MEMORY;
}
return B_OK;
}
// Unset
void
UserDataWriter::Unset()
{
@ -62,7 +62,7 @@ UserDataWriter::Unset()
fRelocationEntries = NULL;
}
// AllocateData
void *
UserDataWriter::AllocateData(size_t size, size_t align)
{
@ -80,7 +80,7 @@ UserDataWriter::AllocateData(size_t size, size_t align)
return result;
}
// AllocatePartitionData
user_partition_data *
UserDataWriter::AllocatePartitionData(size_t childCount)
{
@ -90,7 +90,7 @@ UserDataWriter::AllocatePartitionData(size_t childCount)
sizeof(int));
}
// AllocateDeviceData
user_disk_device_data *
UserDataWriter::AllocateDeviceData(size_t childCount)
{
@ -100,7 +100,7 @@ UserDataWriter::AllocateDeviceData(size_t childCount)
sizeof(int));
}
// PlaceString
char *
UserDataWriter::PlaceString(const char *str)
{
@ -113,14 +113,14 @@ UserDataWriter::PlaceString(const char *str)
return data;
}
// AllocatedSize
size_t
UserDataWriter::AllocatedSize() const
{
return fAllocatedSize;
}
// AddRelocationEntry
status_t
UserDataWriter::AddRelocationEntry(void *address)
{
@ -131,7 +131,7 @@ UserDataWriter::AddRelocationEntry(void *address)
return B_ERROR;
}
// Relocate
status_t
UserDataWriter::Relocate(void *address)
{
@ -145,4 +145,3 @@ UserDataWriter::Relocate(void *address)
}
return B_OK;
}

View File

@ -12,20 +12,22 @@ SharedLibrary libkernelland_emu.so :
KPath.cpp
lock.cpp
low_resource_manager.cpp
MessagingService.cpp
misc.cpp
module.cpp
node_monitor.cpp
slab.cpp
smp.cpp
team.cpp
vfs.cpp
vm.cpp
list.cpp
StringHash.cpp
: be [ TargetLibstdc++ ] ;
AbsSymLink <boot!home!config!lib>libkernelland_emu.so : libkernelland_emu.so
: /boot/home/config/lib : false ;
SEARCH on [ FGristFiles
list.cpp
StringHash.cpp
] = [ FDirName $(HAIKU_TOP) src system kernel util ] ;

View File

@ -0,0 +1,14 @@
/*
* Copyright 2024, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
*/
#include <messaging.h>
extern "C" status_t
send_message(const void *message, int32 messageSize,
const messaging_target *targets, int32 targetCount)
{
return B_NOT_SUPPORTED;
}

View File

@ -12,6 +12,22 @@
#include <fs/devfs.h>
extern "C" status_t
devfs_unpublish_file_device(const char* path)
{
printf("ubpublish file device: path \"%s\"\n", path);
return B_OK;
}
extern "C" status_t
devfs_publish_file_device(const char* path, const char* filePath)
{
printf("publish file device: path \"%s\" (file path \"%s\")\n", path, filePath);
return B_OK;
}
extern "C" status_t
devfs_unpublish_partition(const char *path)
{
@ -29,3 +45,12 @@ devfs_publish_partition(const char *path, const partition_info *info)
printf("publish partition: %s (device \"%s\", size %lld)\n", path, info->device, info->size);
return B_OK;
}
extern "C" status_t
devfs_rename_partition(const char* devicePath, const char* oldName, const char* newName)
{
printf("rename partition: %s (oldName \"%s\", newName \"%s\")\n",
devicePath, oldName, newName);
return B_OK;
}

View File

@ -16,8 +16,10 @@
#include <Entry.h>
#include <KernelExport.h>
#include <module.h>
#include <kmodule.h>
#include <List.h>
#include <Locker.h>
#include <Notifications.h>
#include <ObjectList.h>
#include <Path.h>
#include <String.h>
@ -801,3 +803,17 @@ close_module_list(void *cookie)
return ModuleManager::Default()->CloseModuleList(
(module_name_list*)cookie);
}
status_t
start_watching_modules(const char* prefix, NotificationListener& listener)
{
return B_NOT_SUPPORTED;
}
status_t
stop_watching_modules(const char* prefix, NotificationListener& listener)
{
return B_NOT_SUPPORTED;
}

View File

@ -0,0 +1,21 @@
/*
* Copyright 2024, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
*/
#include <fs/node_monitor.h>
status_t
remove_node_listener(dev_t device, ino_t node, NotificationListener& listener)
{
return B_NOT_SUPPORTED;
}
status_t
add_node_listener(dev_t device, ino_t node, uint32 flags,
NotificationListener& listener)
{
return B_NOT_SUPPORTED;
}

View File

@ -0,0 +1,36 @@
/*
* Copyright 2024, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
*/
#include <vfs.h>
extern "C" status_t
vfs_stat_node_ref(dev_t device, ino_t inode, struct stat *stat)
{
return B_NOT_SUPPORTED;
}
extern "C" status_t
vfs_normalize_path(const char* path, char* buffer, size_t bufferSize,
bool traverseLink, bool kernel)
{
return B_NOT_SUPPORTED;
}
extern "C" status_t
vfs_entry_ref_to_path(dev_t device, ino_t inode, const char *leaf,
bool kernel, char *path, size_t pathLength)
{
return B_NOT_SUPPORTED;
}
extern "C" status_t
vfs_unmount(dev_t mountID, uint32 flags)
{
return B_NOT_SUPPORTED;
}

View File

@ -93,7 +93,7 @@ SimpleTest sigsuspend_test : sigsuspend_test.cpp ;
SubInclude HAIKU_TOP src tests system kernel cache ;
SubInclude HAIKU_TOP src tests system kernel fs ;
#SubInclude HAIKU_TOP src tests system kernel disk_device_manager ;
SubInclude HAIKU_TOP src tests system kernel disk_device_manager ;
SubInclude HAIKU_TOP src tests system kernel device_manager ;
SubInclude HAIKU_TOP src tests system kernel file_corruption ;
SubInclude HAIKU_TOP src tests system kernel scheduler ;

View File

@ -31,6 +31,7 @@ main(int argc, char **argv)
if (id < B_OK)
printf("creating the file device failed: %s\n", strerror(id));
#if 0
// wait for scanning jobs to finish
// (that's hopefully a hack :-))
for (;;) {
@ -40,6 +41,7 @@ main(int argc, char **argv)
}
snooze(50000);
}
#endif
// print devices
for (int32 cookie = 0;

View File

@ -1,36 +1,27 @@
SubDir HAIKU_TOP src tests system kernel disk_device_manager ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src system kernel disk_device_manager jobs ] ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src system kernel disk_device_manager ] ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src system kernel fs ] ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits storage ] ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits storage disk_device ] ;
# DiskDeviceTypes.cpp
#UsePrivateHeaders $(DOT) ;
UsePrivateHeaders shared ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src system kernel events ] ;
# Notifications.cpp
UsePrivateKernelHeaders ;
UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_KERNEL_PLATFORM) ] ;
UsePrivateHeaders [ FDirName kernel disk_device_manager ] ;
UsePrivateHeaders [ FDirName kernel arch $(TARGET_KERNEL_ARCH_DIR) ] ;
UsePrivateHeaders [ FDirName kernel fs ] ;
UsePrivateHeaders [ FDirName kernel ] ;
UsePrivateHeaders [ FDirName kernel util ] ;
UsePrivateHeaders storage ;
UsePrivateHeaders kernel ;
UseHeaders [ FDirName $(HAIKU_TOP) src system kernel disk_device_manager ] ;
# 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 ] ;
DEFINES += _KERNEL_MODE ;
SharedLibrary libdisk_device_manager.so :
ddm_operation_validation.cpp
SharedLibrary test_disk_device_manager.so :
# ddm_userland_interface.cpp
disk_device_manager.cpp
KDiskDevice.cpp
KDiskDeviceJob.cpp
KDiskDeviceJobFactory.cpp
KDiskDeviceJobGenerator.cpp
KDiskDeviceJobQueue.cpp
KDiskDeviceManager.cpp
KFileDiskDevice.cpp
KDiskSystem.cpp
@ -39,53 +30,32 @@ SharedLibrary libdisk_device_manager.so :
KPartitioningSystem.cpp
KPartitionListener.cpp
KPartitionVisitor.cpp
KPhysicalPartition.cpp
KShadowPartition.cpp
UserDataWriter.cpp
# disk device types
DiskDeviceTypes.cpp
# fs
KPath.cpp
# jobs
KCreateChildJob.cpp
KDefragmentJob.cpp
KDeleteChildJob.cpp
KInitializeJob.cpp
KMoveJob.cpp
KRepairJob.cpp
KResizeJob.cpp
KScanPartitionJob.cpp
KSetParametersJob.cpp
KUninitializeJob.cpp
# notifications
Notifications.cpp
# utilities
Locker.cpp
RWLocker.cpp
# disk device types
DiskDeviceTypes.cpp
: be libkernelland_emu.so [ TargetLibsupc++ ]
;
LinkAgainst libdisk_device_manager.so
: <boot!home!config!lib>libkernelland_emu.so ;
AbsSymLink <boot!home!config!lib>libdisk_device_manager.so
: libdisk_device_manager.so : /boot/home/config/lib ;
SimpleTest DiskDeviceManagerTest
: DiskDeviceManagerTest.cpp
: <boot!home!config!lib>libdisk_device_manager.so be
SimpleTest DiskDeviceManagerTest :
DiskDeviceManagerTest.cpp
: test_disk_device_manager.so be
;
Depends DiskDeviceManagerTest : <boot!home!config!lib>libkernelland_emu.so ;
# Also build all modules:
Depends DiskDeviceManagerTest : userland_disk_system_modules ;
# Pseudo target for disk system modules.
NotFile userland_disk_system_modules ;
Depends userland_disk_system_modules :
<boot!home!config!lib>libkernelland_emu.so
libkernelland_emu.so
<file_system>bfs
<partitioning_system>intel
<partitioning_system>amiga_rdb