1 | /** @file
|
---|
2 | * Stubs for dynamically loading libfuse/libosxfuse and the symbols which are needed by
|
---|
3 | * VirtualBox.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2019-2024 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 | /** The file name of the fuse library */
|
---|
28 | #if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD) || defined(RT_OS_SOLARIS)
|
---|
29 | # define RT_RUNTIME_LOADER_LIB_NAME "libfuse.so.2"
|
---|
30 | #elif defined(RT_OS_DARWIN)
|
---|
31 | # define RT_RUNTIME_LOADER_LIB_NAME "libosxfuse.dylib"
|
---|
32 | #else
|
---|
33 | # error "Unsupported host OS, manual work required"
|
---|
34 | #endif
|
---|
35 |
|
---|
36 | /** The name of the loader function */
|
---|
37 | #define RT_RUNTIME_LOADER_FUNCTION RTFuseLoadLib
|
---|
38 |
|
---|
39 | /** The following are the symbols which we need from the fuse library. */
|
---|
40 | #define RT_RUNTIME_LOADER_INSERT_SYMBOLS \
|
---|
41 | RT_PROXY_STUB(fuse_main_real, int, (int argc, char **argv, struct fuse_operations *fuse_ops, size_t op_size, void *pv), \
|
---|
42 | (argc, argv, fuse_ops, op_size, pv)) \
|
---|
43 | RT_PROXY_STUB(fuse_opt_parse, int, (struct fuse_args *args, void *data, const struct fuse_opt opts[], fuse_opt_proc_t proc), \
|
---|
44 | (args, data, opts, proc)) \
|
---|
45 | RT_PROXY_STUB(fuse_opt_add_arg, int, (struct fuse_args *args, const char *arg), \
|
---|
46 | (args, arg)) \
|
---|
47 | RT_PROXY_STUB(fuse_opt_free_args, void, (struct fuse_args *args), \
|
---|
48 | (args))
|
---|
49 |
|
---|
50 | #ifdef VBOX_FUSE_GENERATE_HEADER
|
---|
51 | # define RT_RUNTIME_LOADER_GENERATE_HEADER
|
---|
52 | # define RT_RUNTIME_LOADER_GENERATE_DECLS
|
---|
53 | # include <iprt/runtime-loader.h>
|
---|
54 | # undef RT_RUNTIME_LOADER_GENERATE_HEADER
|
---|
55 | # undef RT_RUNTIME_LOADER_GENERATE_DECLS
|
---|
56 |
|
---|
57 | #elif defined(VBOX_FUSE_GENERATE_BODY)
|
---|
58 | # define RT_RUNTIME_LOADER_GENERATE_BODY_STUBS
|
---|
59 | # include <iprt/runtime-loader.h>
|
---|
60 | # undef RT_RUNTIME_LOADER_GENERATE_BODY_STUBS
|
---|
61 |
|
---|
62 | #else
|
---|
63 | # error This file should only be included to generate stubs for loading the Fuse library at runtime
|
---|
64 | #endif
|
---|
65 |
|
---|
66 | #undef RT_RUNTIME_LOADER_LIB_NAME
|
---|
67 | #undef RT_RUNTIME_LOADER_INSERT_SYMBOLS
|
---|