|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| .github/ISSUE_TEMPLATE/ | | 07-Sep-2024 | - | 17 | 11 |
| dev-docs/ | | 07-Sep-2024 | - | 59 | 44 |
| doc/ | | 07-Sep-2024 | - | 3,493 | 2,757 |
| example/ | | 07-Sep-2024 | - | 9,959 | 7,440 |
| include/ | | 07-Sep-2024 | - | 6,150 | 1,453 |
| lib/ | | 07-Sep-2024 | - | 14,030 | 11,512 |
| signify/ | | 07-Sep-2024 | - | 6 | 4 |
| test/ | | 07-Sep-2024 | - | 4,457 | 3,701 |
| util/ | | 07-Sep-2024 | - | 2,207 | 1,797 |
| xfstests/ | | 07-Sep-2024 | - | 50 | 32 |
| .ackrc | D | 07-Sep-2024 | 41 | 3 | 2 |
| .cirrus.yml | D | 07-Sep-2024 | 336 | 13 | 10 |
| .codespellrc | D | 07-Sep-2024 | 433 | 12 | 10 |
| .dir-locals.el | D | 07-Sep-2024 | 1.8 KiB | 48 | 47 |
| .gitignore | D | 07-Sep-2024 | 574 | 41 | 40 |
| .travis.yml | D | 07-Sep-2024 | 623 | 29 | 26 |
| AUTHORS | D | 07-Sep-2024 | 8.3 KiB | 228 | 218 |
| BUILD.gn | D | 07-Sep-2024 | 2.7 KiB | 99 | 89 |
| ChangeLog.rst | D | 07-Sep-2024 | 28.3 KiB | 806 | 579 |
| GPL2.txt | D | 07-Sep-2024 | 17.7 KiB | 340 | 281 |
| LGPL2.txt | D | 07-Sep-2024 | 25.9 KiB | 503 | 418 |
| LICENSE | D | 07-Sep-2024 | 435 | 14 | 9 |
| OAT.xml | D | 07-Sep-2024 | 1.8 KiB | 44 | 25 |
| README.OpenSource | D | 07-Sep-2024 | 486 | 12 | 11 |
| README.md | D | 07-Sep-2024 | 6.2 KiB | 160 | 121 |
| README_OpenHarmony.md | D | 07-Sep-2024 | 3.1 KiB | 109 | 83 |
| SECURITY.md | D | 07-Sep-2024 | 878 | 20 | 14 |
| bundle.json | D | 07-Sep-2024 | 1.1 KiB | 44 | 44 |
| make_release_tarball.sh | D | 07-Sep-2024 | 809 | 35 | 21 |
| meson.build | D | 07-Sep-2024 | 7.3 KiB | 224 | 193 |
| meson_options.txt | D | 07-Sep-2024 | 1,010 | 25 | 16 |
| tsan_suppressions.txt | D | 07-Sep-2024 | 121 | 6 | 4 |
README.OpenSource
README.md
1libfuse
2=======
3
4About
5-----
6
7FUSE (Filesystem in Userspace) is an interface for userspace programs
8to export a filesystem to the Linux kernel. The FUSE project consists
9of two components: the *fuse* kernel module (maintained in the regular
10kernel repositories) and the *libfuse* userspace library (maintained
11in this repository). libfuse provides the reference implementation
12for communicating with the FUSE kernel module.
13
14A FUSE file system is typically implemented as a standalone
15application that links with libfuse. libfuse provides functions to
16mount the file system, unmount it, read requests from the kernel, and
17send responses back. libfuse offers two APIs: a "high-level",
18synchronous API, and a "low-level" asynchronous API. In both cases,
19incoming requests from the kernel are passed to the main program using
20callbacks. When using the high-level API, the callbacks may work with
21file names and paths instead of inodes, and processing of a request
22finishes when the callback function returns. When using the low-level
23API, the callbacks must work with inodes and responses must be sent
24explicitly using a separate set of API functions.
25
26
27Development Status
28------------------
29
30libfuse is shipped by all major Linux distributions and has been in
31production use across a wide range of systems for many years. However,
32at present libfuse does not have any active, regular contributors. The
33current maintainer continues to apply pull requests and makes regular
34releases, but unfortunately has no capacity to do any development
35beyond addressing high-impact issues. When reporting bugs, please
36understand that unless you are including a pull request or are
37reporting a critical issue, you will probably not get a response. If
38you are using libfuse, please consider contributing to the project.
39
40
41Supported Platforms
42-------------------
43
44* Linux (fully)
45* BSD (mostly/best-effort)
46* For OS-X, please use [OSXFUSE](https://osxfuse.github.io/)
47
48
49Installation
50------------
51
52You can download libfuse from https://github.com/libfuse/libfuse/releases. To build and
53install, you must use [Meson](http://mesonbuild.com/) and
54[Ninja](https://ninja-build.org). After downloading the tarball and `.sig` file, verify
55it using [signify](https://www.openbsd.org/papers/bsdcan-signify.html):
56
57 signify -V -m fuse-X.Y.Z.tar.gz -p fuse-X.Y.pub
58
59The `fuse-X.Y.pub` file contains the signing key and needs to be obtained from a
60trustworthy source. Each libfuse release contains the signing key for the release after it
61in the `signify` directory, so you only need to manually acquire this file once when you
62install libfuse for the first time.
63
64After you have validated the tarball, extract it, create a (temporary) build directory and
65run Meson:
66
67 $ tar xzf fuse-X.Y.Z.tar.gz; cd fuse-X.Y.Z
68 $ mkdir build; cd build
69 $ meson setup ..
70
71Normally, the default build options will work fine. If you
72nevertheless want to adjust them, you can do so with the
73*meson configure* command:
74
75 $ meson configure # list options
76 $ meson configure -D disable-mtab=true # set an option
77
78To build, test, and install libfuse, you then use Ninja:
79
80 $ ninja
81 $ sudo python3 -m pytest test/
82 $ sudo ninja install
83
84Running the tests requires the [py.test](http://www.pytest.org/)
85Python module. Instead of running the tests as root, the majority of
86tests can also be run as a regular user if *util/fusermount3* is made
87setuid root first:
88
89 $ sudo chown root:root util/fusermount3
90 $ sudo chmod 4755 util/fusermount3
91 $ python3 -m pytest test/
92
93Security implications
94---------------------
95
96The *fusermount3* program is installed setuid root. This is done to
97allow normal users to mount their own filesystem implementations.
98
99To limit the harm that malicious users can do this way, *fusermount3*
100enforces the following limitations:
101
102 - The user can only mount on a mountpoint for which they have write
103 permission
104
105 - The mountpoint must not be a sticky directory which isn't owned by
106 the user (like /tmp usually is)
107
108 - No other user (including root) can access the contents of the
109 mounted filesystem (though this can be relaxed by allowing the use
110 of the *allow_other* and *allow_root* mount options in
111 */etc/fuse.conf*)
112
113
114If you intend to use the *allow_other* mount options, be aware that
115FUSE has an unresolved [security
116bug](https://github.com/libfuse/libfuse/issues/15): if the
117*default_permissions* mount option is not used, the results of the
118first permission check performed by the file system for a directory
119entry will be re-used for subsequent accesses as long as the inode of
120the accessed entry is present in the kernel cache - even if the
121permissions have since changed, and even if the subsequent access is
122made by a different user. This is of little concern if the filesystem
123is accessible only to the mounting user (which has full access to the
124filesystem anyway), but becomes a security issue when other users are
125allowed to access the filesystem (since they can exploit this to
126perform operations on the filesystem that they do not actually have
127permissions for).
128
129This bug needs to be fixed in the Linux kernel and has been known
130since 2006 but unfortunately no fix has been applied yet. If you
131depend on correct permission handling for FUSE file systems, the only
132workaround is to use `default_permissions` (which does not currently
133support ACLs), or to completely disable caching of directory entry
134attributes.
135
136Building your own filesystem
137------------------------------
138
139FUSE comes with several example file systems in the `example`
140directory. For example, the *passthrough* examples mirror the contents
141of the root directory under the mountpoint. Start from there and adapt
142the code!
143
144The documentation of the API functions and necessary callbacks is
145mostly contained in the files `include/fuse.h` (for the high-level
146API) and `include/fuse_lowlevel.h` (for the low-level API). An
147autogenerated html version of the API is available in the `doc/html`
148directory and at http://libfuse.github.io/doxygen.
149
150
151Getting Help
152------------
153
154If you need help, please ask on the <fuse-devel@lists.sourceforge.net>
155mailing list (subscribe at
156https://lists.sourceforge.net/lists/listinfo/fuse-devel).
157
158Please report any bugs on the GitHub issue tracker at
159https://github.com/libfuse/libfuse/issues.
160
README_OpenHarmony.md
1# libfuse
2
3仓库包含第三方开源软件libfuse,libfuse是FUSE(用户态文件系统)框架的用户态程序接口。libfuse提供挂载、卸载文件系统、解析和传递内核的请求接口等功能。在OpenHarmony中,开发者可以通过注册回调函数的形式,实现特定的用户态文件系统功能,例如cloudfiledaemon(云端文件系统服务)等。
4
5## 目录结构
6
7```
8doc/ 文档
9example/ 样例代码
10include/ libfuse库头文件
11lib/ libfuse库源代码
12test/ 测试脚本代码
13util/ fusermount等二进制工具
14README README说明
15```
16
17## OpenHarmony如何使用libfuse
18
19OpenHarmony只编译使用libfuse仓库中lib/和include/目录下的源代码和头文件。libfuse作为cloudfiledaemon的依赖模块,来实现具体的云端文件系统功能。
20
21## OpenHarmony如何集成libfuse
22
23libfuse编译为动态链接库,打包到system分区镜像中。
24
25### 1. libfuse的编译
26
27libfuse的编译入口在其根目录下的BUILD.gn中。简单示意如下:
28
29```
30libfuse_source = [
31 "//third_party/libfuse/lib/fuse.c",
32 "//third_party/libfuse/lib/fuse_loop.c",
33 "//third_party/libfuse/lib/fuse_loop_mt.c",
34 "//third_party/libfuse/lib/fuse_lowlevel.c",
35 "//third_party/libfuse/lib/fuse_opt.c",
36 "//third_party/libfuse/lib/fuse_signals.c",
37 "//third_party/libfuse/lib/buffer.c",
38 "//third_party/libfuse/lib/compat.c",
39 "//third_party/libfuse/lib/cuse_lowlevel.c",
40 "//third_party/libfuse/lib/helper.c",
41 "//third_party/libfuse/lib/modules/subdir.c",
42 "//third_party/libfuse/lib/mount_util.c",
43 "//third_party/libfuse/lib/fuse_log.c",
44 "//third_party/libfuse/lib/mount.c",
45 "//third_party/libfuse/lib/modules/iconv.c",
46]
47
48ohos_shared_library("libfuse") {
49 configs = [ ":libfuse_config" ]
50 sources = libfuse_source
51 ldflags = [
52 "-ldl",
53 "-Wl,--version-script",
54 rebase_path("//third_party/libfuse/lib/fuse_versionscript", root_build_dir),
55 "-Wl,-soname,libfuse3.so.3",
56 "-Wl,--no-undefined",
57 "-Wl,--as-needed",
58 "-shared",
59 "-fPIC",
60 ]
61 external_deps = [ "c_utils:utils" ]
62 subsystem_name = "thirdparty"
63 part_name = "libfuse"
64 output_name = "libfuse"
65 install_enable = true
66 install_images = [ "system" ]
67}
68
69```
70
71### 2. 使用libfuse
72
73在需要使用libfuse的模块构建配置中,增加对应依赖,示例如下:
74
75```
76ohos_shared_library("cloudfiledaemon") {
77
78 sources = [
79 ......
80 ]
81
82 include_dirs = [
83 ......
84 "//third_party/libfuse/include",
85 "//third_party/libfuse/lib",
86 ]
87
88 external_deps = [
89 "//third_party/libfuse:libfuse",
90 ]
91
92...
93}
94```
95
96## libfuse相关内容
97
98[libfuse主页](https://github.com/libfuse/libfuse)
99[libfuse文档](https://libfuse.github.io/doxygen/index.html)
100
101## License
102
103- include/ 和 lib/ 目录下的源文件,使用LGPL2.1协议;
104- 其他源文件,使用GPL2协议。
105
106## 风险提示
107
108**libfuse是LGPLV2和GPLV2协议类型的三方开源软件,OpenHarmony当前仅使用LGPLV2部分。使用时需履行相应的开源义务。**
109