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 | |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 17 | #include "EmulatedVolume.h" |
Zim | 3623a21 | 2019-07-19 16:46:53 +0100 | [diff] [blame] | 18 | |
| 19 | #include "AppFuseUtil.h" |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 20 | #include "Utils.h" |
Sudheer Shanka | 40ab674 | 2018-09-18 13:07:45 -0700 | [diff] [blame] | 21 | #include "VolumeManager.h" |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 22 | |
Elliott Hughes | 7e128fb | 2015-12-04 15:50:53 -0800 | [diff] [blame] | 23 | #include <android-base/logging.h> |
Zim | 3623a21 | 2019-07-19 16:46:53 +0100 | [diff] [blame] | 24 | #include <android-base/properties.h> |
Sudheer Shanka | 53947a3 | 2018-08-01 10:24:13 -0700 | [diff] [blame] | 25 | #include <android-base/stringprintf.h> |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 26 | #include <cutils/fs.h> |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 27 | #include <private/android_filesystem_config.h> |
Jeff Sharkey | 7bdf4d5 | 2017-09-18 14:47:10 -0600 | [diff] [blame] | 28 | #include <utils/Timers.h> |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 29 | |
| 30 | #include <fcntl.h> |
| 31 | #include <stdlib.h> |
| 32 | #include <sys/mount.h> |
| 33 | #include <sys/stat.h> |
Elliott Hughes | 0e08e84 | 2017-05-18 09:08:24 -0700 | [diff] [blame] | 34 | #include <sys/sysmacros.h> |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 35 | #include <sys/types.h> |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 36 | #include <sys/wait.h> |
| 37 | |
Dan Albert | ae9e890 | 2015-03-16 10:35:17 -0700 | [diff] [blame] | 38 | using android::base::StringPrintf; |
| 39 | |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 40 | namespace android { |
| 41 | namespace vold { |
| 42 | |
Martijn Coenen | adcc845 | 2019-12-09 14:18:01 +0100 | [diff] [blame] | 43 | static const char* kSdcardFsPath = "/system/bin/sdcard"; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 44 | |
Zim | a438b24 | 2019-09-25 14:37:38 +0100 | [diff] [blame] | 45 | EmulatedVolume::EmulatedVolume(const std::string& rawPath, int userId) |
Martijn Coenen | adcc845 | 2019-12-09 14:18:01 +0100 | [diff] [blame] | 46 | : VolumeBase(Type::kEmulated) { |
Zim | a438b24 | 2019-09-25 14:37:38 +0100 | [diff] [blame] | 47 | setId(StringPrintf("emulated;%u", userId)); |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 48 | mRawPath = rawPath; |
Jeff Sharkey | 66270a2 | 2015-06-24 11:49:24 -0700 | [diff] [blame] | 49 | mLabel = "emulated"; |
Martijn Coenen | fd7362d | 2019-12-11 14:57:59 +0100 | [diff] [blame] | 50 | mFuseMounted = false; |
Martijn Coenen | 86f21a2 | 2020-01-06 09:48:14 +0100 | [diff] [blame] | 51 | mUseSdcardFs = IsFilesystemSupported("sdcardfs"); |
Jeff Sharkey | 3161fb3 | 2015-04-12 16:03:33 -0700 | [diff] [blame] | 52 | } |
| 53 | |
Zim | a438b24 | 2019-09-25 14:37:38 +0100 | [diff] [blame] | 54 | EmulatedVolume::EmulatedVolume(const std::string& rawPath, dev_t device, const std::string& fsUuid, |
| 55 | int userId) |
Martijn Coenen | adcc845 | 2019-12-09 14:18:01 +0100 | [diff] [blame] | 56 | : VolumeBase(Type::kEmulated) { |
Zim | a438b24 | 2019-09-25 14:37:38 +0100 | [diff] [blame] | 57 | setId(StringPrintf("emulated:%u,%u;%u", major(device), minor(device), userId)); |
Jeff Sharkey | 3161fb3 | 2015-04-12 16:03:33 -0700 | [diff] [blame] | 58 | mRawPath = rawPath; |
Jeff Sharkey | 66270a2 | 2015-06-24 11:49:24 -0700 | [diff] [blame] | 59 | mLabel = fsUuid; |
Greg Kaiser | 5298ccc | 2019-12-12 05:41:46 -0800 | [diff] [blame] | 60 | mFuseMounted = false; |
Martijn Coenen | 86f21a2 | 2020-01-06 09:48:14 +0100 | [diff] [blame] | 61 | mUseSdcardFs = IsFilesystemSupported("sdcardfs"); |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 62 | } |
| 63 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 64 | EmulatedVolume::~EmulatedVolume() {} |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 65 | |
Martijn Coenen | 6f5802e | 2019-11-28 11:53:53 +0100 | [diff] [blame] | 66 | std::string EmulatedVolume::getLabel() { |
Jeff Sharkey | 81f55c6 | 2015-07-07 14:37:03 -0700 | [diff] [blame] | 67 | // We could have migrated storage to an adopted private volume, so always |
| 68 | // call primary storage "emulated" to avoid media rescans. |
Jeff Sharkey | 81f55c6 | 2015-07-07 14:37:03 -0700 | [diff] [blame] | 69 | if (getMountFlags() & MountFlags::kPrimary) { |
Martijn Coenen | 6f5802e | 2019-11-28 11:53:53 +0100 | [diff] [blame] | 70 | return "emulated"; |
| 71 | } else { |
| 72 | return mLabel; |
Jeff Sharkey | 81f55c6 | 2015-07-07 14:37:03 -0700 | [diff] [blame] | 73 | } |
Martijn Coenen | 6f5802e | 2019-11-28 11:53:53 +0100 | [diff] [blame] | 74 | } |
| 75 | |
Martijn Coenen | 3a2dbfe | 2020-01-11 19:38:37 +0100 | [diff] [blame] | 76 | // Creates a bind mount from source to target, creating the source (!) directory |
| 77 | // if not yet present. |
| 78 | static status_t doFuseBindMount(const std::string& source, const std::string& target) { |
| 79 | if (access(source.c_str(), F_OK) != 0) { |
| 80 | // Android path may not exist yet if users has just been created; create it on |
| 81 | // the lower fs. |
| 82 | if (fs_prepare_dir(source.c_str(), 0771, AID_MEDIA_RW, AID_MEDIA_RW) != 0) { |
| 83 | PLOG(ERROR) << "Failed to create " << source; |
| 84 | return -errno; |
| 85 | } |
| 86 | } |
| 87 | LOG(INFO) << "Bind mounting " << source << " on " << target; |
| 88 | auto status = BindMount(source, target); |
| 89 | if (status != OK) { |
| 90 | return status; |
| 91 | } |
| 92 | LOG(INFO) << "Bind mounted " << source << " on " << target; |
| 93 | return OK; |
| 94 | } |
| 95 | |
Martijn Coenen | 86f21a2 | 2020-01-06 09:48:14 +0100 | [diff] [blame] | 96 | status_t EmulatedVolume::mountFuseBindMounts() { |
| 97 | std::string androidSource; |
| 98 | std::string label = getLabel(); |
| 99 | int userId = getMountUserId(); |
| 100 | |
| 101 | if (mUseSdcardFs) { |
| 102 | androidSource = StringPrintf("/mnt/runtime/default/%s/%d/Android", label.c_str(), userId); |
| 103 | } else { |
| 104 | androidSource = StringPrintf("/%s/%d/Android", mRawPath.c_str(), userId); |
| 105 | } |
Martijn Coenen | 5700261 | 2019-11-28 11:56:13 +0100 | [diff] [blame] | 106 | std::string androidTarget( |
| 107 | StringPrintf("/mnt/user/%d/%s/%d/Android", userId, label.c_str(), userId)); |
| 108 | |
Martijn Coenen | 3a2dbfe | 2020-01-11 19:38:37 +0100 | [diff] [blame] | 109 | auto status = doFuseBindMount(androidSource, androidTarget); |
Martijn Coenen | 5700261 | 2019-11-28 11:56:13 +0100 | [diff] [blame] | 110 | if (status != OK) { |
| 111 | return status; |
| 112 | } |
Martijn Coenen | 5700261 | 2019-11-28 11:56:13 +0100 | [diff] [blame] | 113 | |
Martijn Coenen | 3a2dbfe | 2020-01-11 19:38:37 +0100 | [diff] [blame] | 114 | // Installers get the same view as all other apps, with the sole exception that the |
| 115 | // OBB dirs (Android/obb) are writable to them. On sdcardfs devices, this requires |
| 116 | // a special bind mount, since app-private and OBB dirs share the same GID, but we |
| 117 | // only want to give access to the latter. |
| 118 | if (!mUseSdcardFs) { |
| 119 | return OK; |
| 120 | } |
| 121 | std::string installerSource( |
| 122 | StringPrintf("/mnt/runtime/write/%s/%d/Android/obb", label.c_str(), userId)); |
| 123 | std::string installerTarget( |
| 124 | StringPrintf("/mnt/installer/%d/%s/%d/Android/obb", userId, label.c_str(), userId)); |
| 125 | |
| 126 | status = doFuseBindMount(installerSource, installerTarget); |
| 127 | if (status != OK) { |
| 128 | return status; |
| 129 | } |
Martijn Coenen | 5700261 | 2019-11-28 11:56:13 +0100 | [diff] [blame] | 130 | return OK; |
| 131 | } |
| 132 | |
Martijn Coenen | 86f21a2 | 2020-01-06 09:48:14 +0100 | [diff] [blame] | 133 | status_t EmulatedVolume::unmountFuseBindMounts() { |
| 134 | std::string label = getLabel(); |
| 135 | int userId = getMountUserId(); |
| 136 | |
Martijn Coenen | 3a2dbfe | 2020-01-11 19:38:37 +0100 | [diff] [blame] | 137 | if (mUseSdcardFs) { |
| 138 | std::string installerTarget( |
| 139 | StringPrintf("/mnt/installer/%d/%s/%d/Android/obb", userId, label.c_str(), userId)); |
| 140 | LOG(INFO) << "Unmounting " << installerTarget; |
| 141 | auto status = UnmountTree(installerTarget); |
| 142 | if (status != OK) { |
| 143 | LOG(ERROR) << "Failed to unmount " << installerTarget; |
| 144 | // Intentional continue to try to unmount the other bind mount |
| 145 | } |
| 146 | } |
| 147 | |
Martijn Coenen | 5700261 | 2019-11-28 11:56:13 +0100 | [diff] [blame] | 148 | std::string androidTarget( |
| 149 | StringPrintf("/mnt/user/%d/%s/%d/Android", userId, label.c_str(), userId)); |
| 150 | |
| 151 | LOG(INFO) << "Unmounting " << androidTarget; |
| 152 | auto status = UnmountTree(androidTarget); |
| 153 | if (status != OK) { |
| 154 | return status; |
| 155 | } |
| 156 | LOG(INFO) << "Unmounted " << androidTarget; |
| 157 | |
| 158 | return OK; |
| 159 | } |
| 160 | |
Martijn Coenen | 6f5802e | 2019-11-28 11:53:53 +0100 | [diff] [blame] | 161 | status_t EmulatedVolume::doMount() { |
| 162 | std::string label = getLabel(); |
| 163 | bool isVisible = getMountFlags() & MountFlags::kVisible; |
Jeff Sharkey | 81f55c6 | 2015-07-07 14:37:03 -0700 | [diff] [blame] | 164 | |
Martijn Coenen | adcc845 | 2019-12-09 14:18:01 +0100 | [diff] [blame] | 165 | mSdcardFsDefault = StringPrintf("/mnt/runtime/default/%s", label.c_str()); |
| 166 | mSdcardFsRead = StringPrintf("/mnt/runtime/read/%s", label.c_str()); |
| 167 | mSdcardFsWrite = StringPrintf("/mnt/runtime/write/%s", label.c_str()); |
| 168 | mSdcardFsFull = StringPrintf("/mnt/runtime/full/%s", label.c_str()); |
Jeff Sharkey | 66270a2 | 2015-06-24 11:49:24 -0700 | [diff] [blame] | 169 | |
| 170 | setInternalPath(mRawPath); |
Jeff Sharkey | 81f55c6 | 2015-07-07 14:37:03 -0700 | [diff] [blame] | 171 | setPath(StringPrintf("/storage/%s", label.c_str())); |
Jeff Sharkey | 66270a2 | 2015-06-24 11:49:24 -0700 | [diff] [blame] | 172 | |
Martijn Coenen | adcc845 | 2019-12-09 14:18:01 +0100 | [diff] [blame] | 173 | if (fs_prepare_dir(mSdcardFsDefault.c_str(), 0700, AID_ROOT, AID_ROOT) || |
| 174 | fs_prepare_dir(mSdcardFsRead.c_str(), 0700, AID_ROOT, AID_ROOT) || |
| 175 | fs_prepare_dir(mSdcardFsWrite.c_str(), 0700, AID_ROOT, AID_ROOT) || |
| 176 | fs_prepare_dir(mSdcardFsFull.c_str(), 0700, AID_ROOT, AID_ROOT)) { |
Jeff Sharkey | 66270a2 | 2015-06-24 11:49:24 -0700 | [diff] [blame] | 177 | PLOG(ERROR) << getId() << " failed to create mount points"; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 178 | return -errno; |
| 179 | } |
| 180 | |
Martijn Coenen | adcc845 | 2019-12-09 14:18:01 +0100 | [diff] [blame] | 181 | dev_t before = GetDevice(mSdcardFsFull); |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 182 | |
Abhijeet Kaur | 01fa0e0 | 2019-12-13 10:26:32 +0000 | [diff] [blame] | 183 | bool isFuse = base::GetBoolProperty(kPropFuse, false); |
Zim | 3623a21 | 2019-07-19 16:46:53 +0100 | [diff] [blame] | 184 | |
Martijn Coenen | 6f5802e | 2019-11-28 11:53:53 +0100 | [diff] [blame] | 185 | // Mount sdcardfs regardless of FUSE, since we need it to bind-mount on top of the |
| 186 | // FUSE volume for various reasons. |
Martijn Coenen | 86f21a2 | 2020-01-06 09:48:14 +0100 | [diff] [blame] | 187 | if (mUseSdcardFs && getMountUserId() == 0) { |
Martijn Coenen | 6f5802e | 2019-11-28 11:53:53 +0100 | [diff] [blame] | 188 | LOG(INFO) << "Executing sdcardfs"; |
| 189 | int sdcardFsPid; |
| 190 | if (!(sdcardFsPid = fork())) { |
| 191 | // clang-format off |
| 192 | if (execl(kSdcardFsPath, kSdcardFsPath, |
| 193 | "-u", "1023", // AID_MEDIA_RW |
| 194 | "-g", "1023", // AID_MEDIA_RW |
| 195 | "-m", |
| 196 | "-w", |
| 197 | "-G", |
| 198 | "-i", |
| 199 | "-o", |
| 200 | mRawPath.c_str(), |
| 201 | label.c_str(), |
| 202 | NULL)) { |
| 203 | // clang-format on |
| 204 | PLOG(ERROR) << "Failed to exec"; |
| 205 | } |
| 206 | |
| 207 | LOG(ERROR) << "sdcardfs exiting"; |
| 208 | _exit(1); |
| 209 | } |
| 210 | |
| 211 | if (sdcardFsPid == -1) { |
| 212 | PLOG(ERROR) << getId() << " failed to fork"; |
| 213 | return -errno; |
| 214 | } |
| 215 | |
| 216 | nsecs_t start = systemTime(SYSTEM_TIME_BOOTTIME); |
| 217 | while (before == GetDevice(mSdcardFsFull)) { |
| 218 | LOG(DEBUG) << "Waiting for sdcardfs to spin up..."; |
| 219 | usleep(50000); // 50ms |
| 220 | |
| 221 | nsecs_t now = systemTime(SYSTEM_TIME_BOOTTIME); |
| 222 | if (nanoseconds_to_milliseconds(now - start) > 5000) { |
| 223 | LOG(WARNING) << "Timed out while waiting for sdcardfs to spin up"; |
| 224 | return -ETIMEDOUT; |
| 225 | } |
| 226 | } |
| 227 | /* sdcardfs will have exited already. The filesystem will still be running */ |
| 228 | TEMP_FAILURE_RETRY(waitpid(sdcardFsPid, nullptr, 0)); |
| 229 | sdcardFsPid = 0; |
| 230 | } |
| 231 | if (isFuse && isVisible) { |
Zim | 3623a21 | 2019-07-19 16:46:53 +0100 | [diff] [blame] | 232 | LOG(INFO) << "Mounting emulated fuse volume"; |
Nandana Dutt | a914cc7 | 2019-08-29 15:22:42 +0100 | [diff] [blame] | 233 | android::base::unique_fd fd; |
Zim | 981222f | 2019-09-09 10:24:44 +0100 | [diff] [blame] | 234 | int user_id = getMountUserId(); |
Zim | a438b24 | 2019-09-25 14:37:38 +0100 | [diff] [blame] | 235 | int result = MountUserFuse(user_id, getInternalPath(), label, &fd); |
Zim | 981222f | 2019-09-09 10:24:44 +0100 | [diff] [blame] | 236 | |
Zim | 3623a21 | 2019-07-19 16:46:53 +0100 | [diff] [blame] | 237 | if (result != 0) { |
| 238 | PLOG(ERROR) << "Failed to mount emulated fuse volume"; |
| 239 | return -result; |
| 240 | } |
Zim | 5048b4b | 2019-11-19 09:16:03 +0000 | [diff] [blame] | 241 | |
Martijn Coenen | 6f5802e | 2019-11-28 11:53:53 +0100 | [diff] [blame] | 242 | mFuseMounted = true; |
Zim | 5048b4b | 2019-11-19 09:16:03 +0000 | [diff] [blame] | 243 | auto callback = getMountCallback(); |
| 244 | if (callback) { |
| 245 | bool is_ready = false; |
| 246 | callback->onVolumeChecking(std::move(fd), getPath(), getInternalPath(), &is_ready); |
| 247 | if (!is_ready) { |
Zim | df073f5 | 2020-01-15 15:00:07 +0000 | [diff] [blame^] | 248 | fd.reset(); |
| 249 | doUnmount(); |
Zim | 5048b4b | 2019-11-19 09:16:03 +0000 | [diff] [blame] | 250 | return -EIO; |
| 251 | } |
| 252 | } |
Martijn Coenen | 5700261 | 2019-11-28 11:56:13 +0100 | [diff] [blame] | 253 | |
| 254 | // Only do the bind-mounts when we know for sure the FUSE daemon can resolve the path. |
Zim | df073f5 | 2020-01-15 15:00:07 +0000 | [diff] [blame^] | 255 | status_t res = mountFuseBindMounts(); |
| 256 | if (res != OK) { |
| 257 | fd.reset(); |
| 258 | doUnmount(); |
| 259 | } |
| 260 | return res; |
Zim | 3623a21 | 2019-07-19 16:46:53 +0100 | [diff] [blame] | 261 | } |
| 262 | |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 263 | return OK; |
| 264 | } |
| 265 | |
| 266 | status_t EmulatedVolume::doUnmount() { |
Martijn Coenen | 8f1e7f2 | 2019-11-29 15:38:55 +0100 | [diff] [blame] | 267 | int userId = getMountUserId(); |
| 268 | |
| 269 | // Kill all processes using the filesystem before we unmount it. If we |
| 270 | // unmount the filesystem first, most file system operations will return |
Narayan Kamath | ea243a3 | 2016-01-21 12:26:05 +0000 | [diff] [blame] | 271 | // ENOTCONN until the unmount completes. This is an exotic and unusual |
| 272 | // error code and might cause broken behaviour in applications. |
Martijn Coenen | 8f1e7f2 | 2019-11-29 15:38:55 +0100 | [diff] [blame] | 273 | if (mFuseMounted) { |
| 274 | // For FUSE specifically, we have an emulated volume per user, so only kill |
| 275 | // processes using files from this particular user. |
| 276 | std::string user_path(StringPrintf("%s/%d", getPath().c_str(), getMountUserId())); |
| 277 | LOG(INFO) << "Killing all processes referencing " << user_path; |
| 278 | KillProcessesUsingPath(user_path); |
| 279 | } else { |
| 280 | KillProcessesUsingPath(getPath()); |
| 281 | } |
Zim | 3623a21 | 2019-07-19 16:46:53 +0100 | [diff] [blame] | 282 | |
Martijn Coenen | 6f5802e | 2019-11-28 11:53:53 +0100 | [diff] [blame] | 283 | if (mFuseMounted) { |
| 284 | std::string label = getLabel(); |
Martijn Coenen | 5700261 | 2019-11-28 11:56:13 +0100 | [diff] [blame] | 285 | // Ignoring unmount return status because we do want to try to unmount |
| 286 | // the rest cleanly. |
Zim | a438b24 | 2019-09-25 14:37:38 +0100 | [diff] [blame] | 287 | |
Martijn Coenen | 86f21a2 | 2020-01-06 09:48:14 +0100 | [diff] [blame] | 288 | unmountFuseBindMounts(); |
Martijn Coenen | 5700261 | 2019-11-28 11:56:13 +0100 | [diff] [blame] | 289 | if (UnmountUserFuse(userId, getInternalPath(), label) != OK) { |
Zim | a438b24 | 2019-09-25 14:37:38 +0100 | [diff] [blame] | 290 | PLOG(INFO) << "UnmountUserFuse failed on emulated fuse volume"; |
| 291 | return -errno; |
Zim | 3623a21 | 2019-07-19 16:46:53 +0100 | [diff] [blame] | 292 | } |
| 293 | |
Martijn Coenen | 6f5802e | 2019-11-28 11:53:53 +0100 | [diff] [blame] | 294 | mFuseMounted = false; |
| 295 | } |
Martijn Coenen | 86f21a2 | 2020-01-06 09:48:14 +0100 | [diff] [blame] | 296 | if (getMountUserId() != 0 || !mUseSdcardFs) { |
Zim | 2d45d9b | 2019-11-14 16:19:05 +0000 | [diff] [blame] | 297 | // For sdcardfs, only unmount for user 0, since user 0 will always be running |
| 298 | // and the paths don't change for different users. |
| 299 | return OK; |
Zim | 3623a21 | 2019-07-19 16:46:53 +0100 | [diff] [blame] | 300 | } |
| 301 | |
Martijn Coenen | adcc845 | 2019-12-09 14:18:01 +0100 | [diff] [blame] | 302 | ForceUnmount(mSdcardFsDefault); |
| 303 | ForceUnmount(mSdcardFsRead); |
| 304 | ForceUnmount(mSdcardFsWrite); |
| 305 | ForceUnmount(mSdcardFsFull); |
Narayan Kamath | ea243a3 | 2016-01-21 12:26:05 +0000 | [diff] [blame] | 306 | |
Martijn Coenen | adcc845 | 2019-12-09 14:18:01 +0100 | [diff] [blame] | 307 | rmdir(mSdcardFsDefault.c_str()); |
| 308 | rmdir(mSdcardFsRead.c_str()); |
| 309 | rmdir(mSdcardFsWrite.c_str()); |
| 310 | rmdir(mSdcardFsFull.c_str()); |
Jeff Sharkey | 66270a2 | 2015-06-24 11:49:24 -0700 | [diff] [blame] | 311 | |
Martijn Coenen | adcc845 | 2019-12-09 14:18:01 +0100 | [diff] [blame] | 312 | mSdcardFsDefault.clear(); |
| 313 | mSdcardFsRead.clear(); |
| 314 | mSdcardFsWrite.clear(); |
| 315 | mSdcardFsFull.clear(); |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 316 | |
| 317 | return OK; |
| 318 | } |
| 319 | |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 320 | } // namespace vold |
| 321 | } // namespace android |