From 0caf909cecb5b171e8c9e402d407e87de7d736b3 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 25 Jun 2024 19:09:38 -0400 Subject: [PATCH] Move mounting the shared_memory ramfs to launch_daemon. The directory is created there, so we should also perform the mount operation there. If we don't, the first boot of a new Haiku image will not have the ramfs shared_memory, since of course the kernel can't mount it at a nonexistent directory. --- src/servers/launch/InitSharedMemoryDirectoryJob.cpp | 11 ++++++++++- src/system/kernel/fs/vfs_boot.cpp | 4 ---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/servers/launch/InitSharedMemoryDirectoryJob.cpp b/src/servers/launch/InitSharedMemoryDirectoryJob.cpp index 00423dcb3b..f7d51715e2 100644 --- a/src/servers/launch/InitSharedMemoryDirectoryJob.cpp +++ b/src/servers/launch/InitSharedMemoryDirectoryJob.cpp @@ -7,6 +7,8 @@ //! Empty main temporary directory +#include + #include "InitSharedMemoryDirectoryJob.h" @@ -20,5 +22,12 @@ InitSharedMemoryDirectoryJob::InitSharedMemoryDirectoryJob() status_t InitSharedMemoryDirectoryJob::Execute() { - return CreateAndEmpty("/var/shared_memory"); + status_t status = CreateAndEmpty("/var/shared_memory"); + if (status != B_OK) + return status; + + status = fs_mount_volume("/var/shared_memory", NULL, "ramfs", 0, NULL); + if (status < B_OK) + return status; + return B_OK; } diff --git a/src/system/kernel/fs/vfs_boot.cpp b/src/system/kernel/fs/vfs_boot.cpp index 504d38f42f..45e7fb785a 100644 --- a/src/system/kernel/fs/vfs_boot.cpp +++ b/src/system/kernel/fs/vfs_boot.cpp @@ -555,10 +555,6 @@ vfs_mount_boot_file_system(kernel_args* args) } } - status = _kern_mount("/boot/system/var/shared_memory", NULL, "ramfs", 0, NULL, 0); - if (status < B_OK) - dprintf("Failed to mount shared memory FS: %s\n", strerror(status)); - // Now that packagefs is mounted, the boot volume is really ready. gBootDevice = bootDevice;