summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaichi Hirono2016-10-27 00:57:55 -0500
committerDaichi Hirono2016-10-27 01:04:15 -0500
commitc6134762975204ceebcf7949e364484833714345 (patch)
treeed01ec85a5175e2985e5e62986500da138d09d1d /libappfuse/include
parent7f8e819ded361e963df7aa648ca2c6d49c7b46b6 (diff)
downloadplatform-system-core-c6134762975204ceebcf7949e364484833714345.tar.gz
platform-system-core-c6134762975204ceebcf7949e364484833714345.tar.xz
platform-system-core-c6134762975204ceebcf7949e364484833714345.zip
Add FuseBridgeLoop to libappfuse.
The CL adds FuseBridgeLoop class to libappfuse, which is used in the system service to proxy fuse commands to applications. Bug: 29970149 Test: libappfuse_test Change-Id: I0708f608b3868721ab16ba4028fd2c17a6735af7
Diffstat (limited to 'libappfuse/include')
-rw-r--r--libappfuse/include/libappfuse/FuseBridgeLoop.h40
-rw-r--r--libappfuse/include/libappfuse/FuseBuffer.h (renamed from libappfuse/include/libappfuse/AppFuse.h)21
2 files changed, 57 insertions, 4 deletions
diff --git a/libappfuse/include/libappfuse/FuseBridgeLoop.h b/libappfuse/include/libappfuse/FuseBridgeLoop.h
new file mode 100644
index 000000000..200653252
--- /dev/null
+++ b/libappfuse/include/libappfuse/FuseBridgeLoop.h
@@ -0,0 +1,40 @@
1/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specic language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_LIBAPPFUSE_FUSEBRIDGELOOP_H_
18#define ANDROID_LIBAPPFUSE_FUSEBRIDGELOOP_H_
19
20#include "libappfuse/FuseBuffer.h"
21
22namespace android {
23
24class FuseBridgeLoop {
25 public:
26 class Callback {
27 public:
28 virtual void OnMount() = 0;
29 virtual ~Callback() = default;
30 };
31
32 bool Start(int dev_fd, int proxy_fd, Callback* callback);
33
34 private:
35 FuseBuffer buffer_;
36};
37
38} // namespace android
39
40#endif // ANDROID_LIBAPPFUSE_FUSEBRIDGELOOP_H_
diff --git a/libappfuse/include/libappfuse/AppFuse.h b/libappfuse/include/libappfuse/FuseBuffer.h
index b6af48d78..071b77715 100644
--- a/libappfuse/include/libappfuse/AppFuse.h
+++ b/libappfuse/include/libappfuse/FuseBuffer.h
@@ -14,8 +14,8 @@
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 16
17#ifndef ANDROID_LIBAPPFUSE_APPFUSE_H_ 17#ifndef ANDROID_LIBAPPFUSE_FUSEBUFFER_H_
18#define ANDROID_LIBAPPFUSE_APPFUSE_H_ 18#define ANDROID_LIBAPPFUSE_FUSEBUFFER_H_
19 19
20#include <linux/fuse.h> 20#include <linux/fuse.h>
21 21
@@ -46,7 +46,7 @@ struct FuseRequest : public FuseMessage<FuseRequest, fuse_in_header> {
46 fuse_open_in open_in; 46 fuse_open_in open_in;
47 fuse_init_in init_in; 47 fuse_init_in init_in;
48 fuse_read_in read_in; 48 fuse_read_in read_in;
49 char lookup_name[]; 49 char lookup_name[0];
50 }; 50 };
51}; 51};
52 52
@@ -71,6 +71,19 @@ union FuseBuffer {
71 void HandleNotImpl(); 71 void HandleNotImpl();
72}; 72};
73 73
74class FuseProxyLoop {
75 class IFuseProxyLoopCallback {
76 public:
77 virtual void OnMount() = 0;
78 virtual ~IFuseProxyLoopCallback() = default;
79 };
80
81 bool Start(int dev_fd, int proxy_fd, IFuseProxyLoopCallback* callback);
82
83 private:
84 FuseBuffer buffer_;
85};
86
74} // namespace android 87} // namespace android
75 88
76#endif // ANDROID_LIBAPPFUSE_APPFUSE_H_ 89#endif // ANDROID_LIBAPPFUSE_FUSEBUFFER_H_