Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 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 specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ANDROID_VOLD_EMULATED_VOLUME_H |
| 18 | #define ANDROID_VOLD_EMULATED_VOLUME_H |
| 19 | |
| 20 | #include "VolumeBase.h" |
| 21 | |
| 22 | #include <cutils/multiuser.h> |
| 23 | |
| 24 | namespace android { |
| 25 | namespace vold { |
| 26 | |
| 27 | /* |
| 28 | * Shared storage emulated on top of private storage. |
| 29 | * |
| 30 | * Knows how to spawn a FUSE daemon to synthesize permissions. ObbVolume |
| 31 | * can be stacked above it. |
| 32 | * |
| 33 | * This volume is always multi-user aware, but is only binds itself to |
| 34 | * users when its primary storage. This volume should never be presented |
| 35 | * as secondary storage, since we're strongly encouraging developers to |
| 36 | * store data local to their app. |
| 37 | */ |
| 38 | class EmulatedVolume : public VolumeBase { |
| 39 | public: |
Chih-Hung Hsieh | a435367 | 2016-08-02 11:41:54 -0700 | [diff] [blame] | 40 | explicit EmulatedVolume(const std::string& rawPath); |
Jeff Sharkey | 3161fb3 | 2015-04-12 16:03:33 -0700 | [diff] [blame] | 41 | EmulatedVolume(const std::string& rawPath, dev_t device, const std::string& fsUuid); |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 42 | virtual ~EmulatedVolume(); |
| 43 | |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 44 | protected: |
| 45 | status_t doMount() override; |
| 46 | status_t doUnmount() override; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 47 | |
| 48 | private: |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 49 | std::string mRawPath; |
Jeff Sharkey | 66270a2 | 2015-06-24 11:49:24 -0700 | [diff] [blame] | 50 | std::string mLabel; |
| 51 | |
| 52 | std::string mFuseDefault; |
| 53 | std::string mFuseRead; |
| 54 | std::string mFuseWrite; |
| 55 | |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 56 | /* PID of FUSE wrapper */ |
| 57 | pid_t mFusePid; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 58 | |
| 59 | DISALLOW_COPY_AND_ASSIGN(EmulatedVolume); |
| 60 | }; |
| 61 | |
| 62 | } // namespace vold |
| 63 | } // namespace android |
| 64 | |
| 65 | #endif |