blob: 2d2ec6b77e6d025398634346fbcdf9222ae98d15 [file] [log] [blame]
Jeff Sharkeydeb24052015-03-02 21:01:40 -08001/*
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_PUBLIC_VOLUME_H
18#define ANDROID_VOLD_PUBLIC_VOLUME_H
19
20#include "VolumeBase.h"
21
22#include <cutils/multiuser.h>
23
24namespace android {
25namespace vold {
26
27/*
28 * Shared storage provided by public (vfat) partition.
29 *
30 * Knows how to mount itself and then spawn a FUSE daemon to synthesize
31 * permissions. AsecVolume and ObbVolume can be stacked above it.
32 *
33 * This volume is not inherently multi-user aware, so it has two possible
34 * modes of operation:
35 * 1. If primary storage for the device, it only binds itself to the
36 * owner user.
37 * 2. If secondary storage, it binds itself for all users, but masks
38 * away the Android directory for secondary users.
39 */
40class PublicVolume : public VolumeBase {
41public:
42 explicit PublicVolume(dev_t device);
43 virtual ~PublicVolume();
44
Jeff Sharkey36801cc2015-03-13 16:09:20 -070045protected:
46 status_t doMount() override;
47 status_t doUnmount() override;
48 status_t doFormat() override;
49
Jeff Sharkeydeb24052015-03-02 21:01:40 -080050 status_t readMetadata();
51 status_t initAsecStage();
52
Jeff Sharkeydeb24052015-03-02 21:01:40 -080053private:
54 /* Kernel device representing partition */
55 dev_t mDevice;
56 /* Block device path */
57 std::string mDevPath;
58 /* Mount point of raw partition */
59 std::string mRawPath;
60 /* Mount point of FUSE wrapper */
61 std::string mFusePath;
62 /* PID of FUSE wrapper */
63 pid_t mFusePid;
Jeff Sharkeydeb24052015-03-02 21:01:40 -080064
Jeff Sharkey36801cc2015-03-13 16:09:20 -070065 /* Filesystem type */
66 std::string mFsType;
67 /* Filesystem UUID */
Jeff Sharkeydeb24052015-03-02 21:01:40 -080068 std::string mFsUuid;
Jeff Sharkey36801cc2015-03-13 16:09:20 -070069 /* User-visible filesystem label */
Jeff Sharkeydeb24052015-03-02 21:01:40 -080070 std::string mFsLabel;
71
72 DISALLOW_COPY_AND_ASSIGN(PublicVolume);
73};
74
75} // namespace vold
76} // namespace android
77
78#endif