mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-30 21:24:44 +00:00
4370bbb3ad
This new syscall will be used by the upcoming runc (run-container) utility. In addition to that, this syscall allows userspace to neatly copy RAMFS instances to other places, which was not possible in the past.
30 lines
1,018 B
C++
30 lines
1,018 B
C++
/*
|
|
* Copyright (c) 2024, Liav A. <liavalb@hotmail.co.il>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibCore/ArgsParser.h>
|
|
#include <LibCore/System.h>
|
|
#include <LibMain/Main.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
|
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|
{
|
|
StringView original_mountpoint;
|
|
StringView target_mountpoint;
|
|
|
|
Core::ArgsParser args_parser;
|
|
// FIXME: Possibly allow to pass VFS root context IDs and flags?
|
|
args_parser.add_positional_argument(original_mountpoint, "Source path", "source", Core::ArgsParser::Required::Yes);
|
|
args_parser.add_positional_argument(target_mountpoint, "Mount point", "mountpoint", Core::ArgsParser::Required::Yes);
|
|
args_parser.parse(arguments);
|
|
|
|
VERIFY(!(original_mountpoint.is_null() || original_mountpoint.is_empty()));
|
|
VERIFY(!(target_mountpoint.is_null() || target_mountpoint.is_empty()));
|
|
TRY(Core::System::copy_mount({}, {}, original_mountpoint, target_mountpoint, 0));
|
|
return 0;
|
|
}
|