blob: cece26b44c31f6d687e86f740f4633bdcab746ec [file] [log] [blame]
Tom Marshalla08c6f12019-01-04 14:37:31 -08001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 * Copyright (C) 2019 The LineageOS Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef ANDROID_VOLMGR_EMULATED_VOLUME_H
19#define ANDROID_VOLMGR_EMULATED_VOLUME_H
20
21#include "VolumeBase.h"
22
23#include <cutils/multiuser.h>
24
25struct fstab_rec;
26
27namespace android {
28namespace volmgr {
29
30/*
31 * Shared storage emulated on top of private storage.
32 *
33 * Knows how to spawn a FUSE daemon to synthesize permissions. ObbVolume
34 * can be stacked above it.
35 *
36 * This volume is always multi-user aware, but is only binds itself to
37 * users when its primary storage. This volume should never be presented
38 * as secondary storage, since we're strongly encouraging developers to
39 * store data local to their app.
40 */
41class EmulatedVolume : public VolumeBase {
42 public:
43 explicit EmulatedVolume(fstab_rec* rec, const std::string& subdir);
44 virtual ~EmulatedVolume();
45
46 protected:
47 status_t doMount() override;
48 status_t doUnmount(bool detach = false) override;
Nolen Johnson8efd2e42019-03-29 22:45:56 +000049 int createMountPointRecursive(const std::string&, mode_t, uid_t, gid_t);
Tom Marshalla08c6f12019-01-04 14:37:31 -080050
51 private:
52 std::string mSubdir;
53 std::string mDevPath;
54 std::string mFsType;
55 unsigned long mFlags;
56 std::string mFsOptions;
57
58 DISALLOW_COPY_AND_ASSIGN(EmulatedVolume);
59};
60
61} // namespace volmgr
62} // namespace android
63
64#endif