Tom Marshall | 55220ba | 2019-01-04 14:37:31 -0800 | [diff] [blame] | 1 | /* |
| 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 | #include <fstab/fstab.h> |
| 25 | |
| 26 | using android::fs_mgr::FstabEntry; |
| 27 | |
| 28 | namespace android { |
| 29 | namespace volmgr { |
| 30 | |
| 31 | /* |
| 32 | * Shared storage emulated on top of private storage. |
| 33 | * |
| 34 | * Knows how to spawn a FUSE daemon to synthesize permissions. ObbVolume |
| 35 | * can be stacked above it. |
| 36 | * |
| 37 | * This volume is always multi-user aware, but is only binds itself to |
| 38 | * users when its primary storage. This volume should never be presented |
| 39 | * as secondary storage, since we're strongly encouraging developers to |
| 40 | * store data local to their app. |
| 41 | */ |
| 42 | class EmulatedVolume : public VolumeBase { |
| 43 | public: |
| 44 | explicit EmulatedVolume(FstabEntry* rec, const std::string& subdir); |
| 45 | virtual ~EmulatedVolume(); |
| 46 | |
| 47 | protected: |
| 48 | status_t doMount() override; |
| 49 | status_t doUnmount(bool detach = false) override; |
| 50 | |
| 51 | private: |
| 52 | std::string mSubdir; |
| 53 | std::string mDevPath; |
| 54 | std::string mFsType; |
| 55 | unsigned long mFlags; |
| 56 | std::string mFsOptions; |
| 57 | |
Tom Marshall | 48e24e1 | 2019-07-24 21:12:07 +0200 | [diff] [blame] | 58 | bool detectMountable() override; |
| 59 | |
Tom Marshall | 55220ba | 2019-01-04 14:37:31 -0800 | [diff] [blame] | 60 | DISALLOW_COPY_AND_ASSIGN(EmulatedVolume); |
| 61 | }; |
| 62 | |
| 63 | } // namespace volmgr |
| 64 | } // namespace android |
| 65 | |
| 66 | #endif |