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-2020 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 | /** The file name of the fuse library */
|
---|
18 | #if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD) || defined(RT_OS_SOLARIS)
|
---|
19 | # define RT_RUNTIME_LOADER_LIB_NAME "libfuse.so.2"
|
---|
20 | #elif defined(RT_OS_DARWIN)
|
---|
21 | # define RT_RUNTIME_LOADER_LIB_NAME "libosxfuse.dylib"
|
---|
22 | #else
|
---|
23 | # error "Unsupported host OS, manual work required"
|
---|
24 | #endif
|
---|
25 |
|
---|
26 | /** The name of the loader function */
|
---|
27 | #define RT_RUNTIME_LOADER_FUNCTION RTFuseLoadLib
|
---|
28 |
|
---|
29 | /** The following are the symbols which we need from the fuse library. */
|
---|
30 | #define RT_RUNTIME_LOADER_INSERT_SYMBOLS \
|
---|
31 | RT_PROXY_STUB(fuse_main_real, int, (int argc, char **argv, struct fuse_operations *fuse_ops, size_t op_size, void *pv), \
|
---|
32 | (argc, argv, fuse_ops, op_size, pv)) \
|
---|
33 | RT_PROXY_STUB(fuse_opt_parse, int, (struct fuse_args *args, void *data, const struct fuse_opt opts[], fuse_opt_proc_t proc), \
|
---|
34 | (args, data, opts, proc)) \
|
---|
35 | RT_PROXY_STUB(fuse_opt_add_arg, int, (struct fuse_args *args, const char *arg), \
|
---|
36 | (args, arg)) \
|
---|
37 | RT_PROXY_STUB(fuse_opt_free_args, void, (struct fuse_args *args), \
|
---|
38 | (args))
|
---|
39 |
|
---|
40 | #ifdef VBOX_FUSE_GENERATE_HEADER
|
---|
41 | # define RT_RUNTIME_LOADER_GENERATE_HEADER
|
---|
42 | # define RT_RUNTIME_LOADER_GENERATE_DECLS
|
---|
43 | # include <iprt/runtime-loader.h>
|
---|
44 | # undef RT_RUNTIME_LOADER_GENERATE_HEADER
|
---|
45 | # undef RT_RUNTIME_LOADER_GENERATE_DECLS
|
---|
46 |
|
---|
47 | #elif defined(VBOX_FUSE_GENERATE_BODY)
|
---|
48 | # define RT_RUNTIME_LOADER_GENERATE_BODY_STUBS
|
---|
49 | # include <iprt/runtime-loader.h>
|
---|
50 | # undef RT_RUNTIME_LOADER_GENERATE_BODY_STUBS
|
---|
51 |
|
---|
52 | #else
|
---|
53 | # error This file should only be included to generate stubs for loading the Fuse library at runtime
|
---|
54 | #endif
|
---|
55 |
|
---|
56 | #undef RT_RUNTIME_LOADER_LIB_NAME
|
---|
57 | #undef RT_RUNTIME_LOADER_INSERT_SYMBOLS
|
---|