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 "Disk.h" |
| 18 | #include "PublicVolume.h" |
Jeff Sharkey | 9c48498 | 2015-03-31 10:35:33 -0700 | [diff] [blame] | 19 | #include "PrivateVolume.h" |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 20 | #include "Utils.h" |
| 21 | #include "VolumeBase.h" |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 22 | #include "VolumeManager.h" |
| 23 | #include "ResponseCode.h" |
Jeff Sharkey | 1571751 | 2016-08-23 13:48:50 -0600 | [diff] [blame] | 24 | #include "Ext4Crypt.h" |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 25 | |
Elliott Hughes | 7e128fb | 2015-12-04 15:50:53 -0800 | [diff] [blame] | 26 | #include <android-base/file.h> |
Jeff Sharkey | 46bb69f | 2017-06-21 13:52:23 -0600 | [diff] [blame] | 27 | #include <android-base/properties.h> |
Elliott Hughes | 7e128fb | 2015-12-04 15:50:53 -0800 | [diff] [blame] | 28 | #include <android-base/stringprintf.h> |
| 29 | #include <android-base/logging.h> |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 30 | #include <diskconfig/diskconfig.h> |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 31 | |
Jeff Sharkey | 9c48498 | 2015-03-31 10:35:33 -0700 | [diff] [blame] | 32 | #include <vector> |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 33 | #include <fcntl.h> |
Jeff Sharkey | 38cfc02 | 2015-03-30 21:22:07 -0700 | [diff] [blame] | 34 | #include <inttypes.h> |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 35 | #include <stdio.h> |
| 36 | #include <stdlib.h> |
| 37 | #include <sys/types.h> |
| 38 | #include <sys/stat.h> |
Elliott Hughes | 0e08e84 | 2017-05-18 09:08:24 -0700 | [diff] [blame] | 39 | #include <sys/sysmacros.h> |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 40 | #include <sys/mount.h> |
| 41 | |
Dan Albert | ae9e890 | 2015-03-16 10:35:17 -0700 | [diff] [blame] | 42 | using android::base::ReadFileToString; |
Jeff Sharkey | 9c48498 | 2015-03-31 10:35:33 -0700 | [diff] [blame] | 43 | using android::base::WriteStringToFile; |
Dan Albert | ae9e890 | 2015-03-16 10:35:17 -0700 | [diff] [blame] | 44 | using android::base::StringPrintf; |
| 45 | |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 46 | namespace android { |
| 47 | namespace vold { |
| 48 | |
| 49 | static const char* kSgdiskPath = "/system/bin/sgdisk"; |
| 50 | static const char* kSgdiskToken = " \t\n"; |
| 51 | |
Jeff Sharkey | fa1c677 | 2017-03-25 22:49:13 -0600 | [diff] [blame] | 52 | static const char* kSysfsLoopMaxMinors = "/sys/module/loop/parameters/max_part"; |
Pierre-Hugues Husson | f347cd0 | 2017-11-28 15:42:56 +0100 | [diff] [blame] | 53 | static const char* kSysfsMmcMaxMinorsDeprecated = "/sys/module/mmcblk/parameters/perdev_minors"; |
| 54 | static const char* kSysfsMmcMaxMinors = "/sys/module/mmc_block/parameters/perdev_minors"; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 55 | |
Jeff Sharkey | fa1c677 | 2017-03-25 22:49:13 -0600 | [diff] [blame] | 56 | static const unsigned int kMajorBlockLoop = 7; |
Jeff Sharkey | f3ee200 | 2015-04-19 15:55:42 -0700 | [diff] [blame] | 57 | static const unsigned int kMajorBlockScsiA = 8; |
| 58 | static const unsigned int kMajorBlockScsiB = 65; |
| 59 | static const unsigned int kMajorBlockScsiC = 66; |
| 60 | static const unsigned int kMajorBlockScsiD = 67; |
| 61 | static const unsigned int kMajorBlockScsiE = 68; |
| 62 | static const unsigned int kMajorBlockScsiF = 69; |
| 63 | static const unsigned int kMajorBlockScsiG = 70; |
| 64 | static const unsigned int kMajorBlockScsiH = 71; |
| 65 | static const unsigned int kMajorBlockScsiI = 128; |
| 66 | static const unsigned int kMajorBlockScsiJ = 129; |
| 67 | static const unsigned int kMajorBlockScsiK = 130; |
| 68 | static const unsigned int kMajorBlockScsiL = 131; |
| 69 | static const unsigned int kMajorBlockScsiM = 132; |
| 70 | static const unsigned int kMajorBlockScsiN = 133; |
| 71 | static const unsigned int kMajorBlockScsiO = 134; |
| 72 | static const unsigned int kMajorBlockScsiP = 135; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 73 | static const unsigned int kMajorBlockMmc = 179; |
Yu Ning | 942d4e8 | 2016-01-08 17:36:47 +0800 | [diff] [blame] | 74 | static const unsigned int kMajorBlockExperimentalMin = 240; |
| 75 | static const unsigned int kMajorBlockExperimentalMax = 254; |
Dmitry Shmidt | 06dc6e5 | 2018-05-11 17:22:42 -0700 | [diff] [blame] | 76 | static const unsigned int kMajorBlockDynamicMin = 234; |
| 77 | static const unsigned int kMajorBlockDynamicMax = 512; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 78 | |
| 79 | static const char* kGptBasicData = "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"; |
| 80 | static const char* kGptAndroidMeta = "19A710A2-B3CA-11E4-B026-10604B889DCF"; |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 81 | static const char* kGptAndroidExpand = "193D1EA4-B3CA-11E4-B075-10604B889DCF"; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 82 | |
| 83 | enum class Table { |
| 84 | kUnknown, |
| 85 | kMbr, |
| 86 | kGpt, |
| 87 | }; |
| 88 | |
Yu Ning | 942d4e8 | 2016-01-08 17:36:47 +0800 | [diff] [blame] | 89 | static bool isVirtioBlkDevice(unsigned int major) { |
| 90 | /* |
| 91 | * The new emulator's "ranchu" virtual board no longer includes a goldfish |
| 92 | * MMC-based SD card device; instead, it emulates SD cards with virtio-blk, |
| 93 | * which has been supported by upstream kernel and QEMU for quite a while. |
| 94 | * Unfortunately, the virtio-blk block device driver does not use a fixed |
| 95 | * major number, but relies on the kernel to assign one from a specific |
| 96 | * range of block majors, which are allocated for "LOCAL/EXPERIMENAL USE" |
| 97 | * per Documentation/devices.txt. This is true even for the latest Linux |
| 98 | * kernel (4.4; see init() in drivers/block/virtio_blk.c). |
| 99 | * |
| 100 | * This makes it difficult for vold to detect a virtio-blk based SD card. |
| 101 | * The current solution checks two conditions (both must be met): |
| 102 | * |
| 103 | * a) If the running environment is the emulator; |
| 104 | * b) If the major number is an experimental block device major number (for |
| 105 | * x86/x86_64 3.10 ranchu kernels, virtio-blk always gets major number |
| 106 | * 253, but it is safer to match the range than just one value). |
| 107 | * |
| 108 | * Other conditions could be used, too, e.g. the hardware name should be |
| 109 | * "ranchu", the device's sysfs path should end with "/block/vd[d-z]", etc. |
| 110 | * But just having a) and b) is enough for now. |
| 111 | */ |
| 112 | return IsRunningInEmulator() && major >= kMajorBlockExperimentalMin |
| 113 | && major <= kMajorBlockExperimentalMax; |
| 114 | } |
| 115 | |
Dmitry Shmidt | 06dc6e5 | 2018-05-11 17:22:42 -0700 | [diff] [blame] | 116 | static bool isNvmeBlkDevice(unsigned int major, const std::string& sysPath) { |
| 117 | return sysPath.find("nvme") != std::string::npos |
| 118 | && major >= kMajorBlockDynamicMin |
| 119 | && major <= kMajorBlockDynamicMax; |
| 120 | } |
| 121 | |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 122 | Disk::Disk(const std::string& eventPath, dev_t device, |
| 123 | const std::string& nickname, int flags) : |
| 124 | mDevice(device), mSize(-1), mNickname(nickname), mFlags(flags), mCreated( |
| 125 | false), mJustPartitioned(false) { |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 126 | mId = StringPrintf("disk:%u,%u", major(device), minor(device)); |
| 127 | mEventPath = eventPath; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 128 | mSysPath = StringPrintf("/sys/%s", eventPath.c_str()); |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 129 | mDevPath = StringPrintf("/dev/block/vold/%s", mId.c_str()); |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 130 | CreateDeviceNode(mDevPath, mDevice); |
| 131 | } |
| 132 | |
| 133 | Disk::~Disk() { |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 134 | CHECK(!mCreated); |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 135 | DestroyDeviceNode(mDevPath); |
| 136 | } |
| 137 | |
| 138 | std::shared_ptr<VolumeBase> Disk::findVolume(const std::string& id) { |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 139 | for (auto vol : mVolumes) { |
| 140 | if (vol->getId() == id) { |
| 141 | return vol; |
| 142 | } |
| 143 | auto stackedVol = vol->findVolume(id); |
| 144 | if (stackedVol != nullptr) { |
| 145 | return stackedVol; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 146 | } |
| 147 | } |
| 148 | return nullptr; |
| 149 | } |
| 150 | |
Jeff Sharkey | c86ab6f | 2015-06-26 14:02:09 -0700 | [diff] [blame] | 151 | void Disk::listVolumes(VolumeBase::Type type, std::list<std::string>& list) { |
Chih-Hung Hsieh | 11a2ce8 | 2016-07-27 14:11:02 -0700 | [diff] [blame] | 152 | for (const auto& vol : mVolumes) { |
Jeff Sharkey | c86ab6f | 2015-06-26 14:02:09 -0700 | [diff] [blame] | 153 | if (vol->getType() == type) { |
| 154 | list.push_back(vol->getId()); |
| 155 | } |
| 156 | // TODO: consider looking at stacked volumes |
| 157 | } |
| 158 | } |
| 159 | |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 160 | status_t Disk::create() { |
| 161 | CHECK(!mCreated); |
| 162 | mCreated = true; |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 163 | notifyEvent(ResponseCode::DiskCreated, StringPrintf("%d", mFlags)); |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 164 | readMetadata(); |
| 165 | readPartitions(); |
| 166 | return OK; |
| 167 | } |
| 168 | |
| 169 | status_t Disk::destroy() { |
| 170 | CHECK(mCreated); |
| 171 | destroyAllVolumes(); |
| 172 | mCreated = false; |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 173 | notifyEvent(ResponseCode::DiskDestroyed); |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 174 | return OK; |
| 175 | } |
| 176 | |
| 177 | void Disk::createPublicVolume(dev_t device) { |
Jeff Sharkey | 9c48498 | 2015-03-31 10:35:33 -0700 | [diff] [blame] | 178 | auto vol = std::shared_ptr<VolumeBase>(new PublicVolume(device)); |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 179 | if (mJustPartitioned) { |
| 180 | LOG(DEBUG) << "Device just partitioned; silently formatting"; |
| 181 | vol->setSilent(true); |
| 182 | vol->create(); |
Jeff Sharkey | d0640f6 | 2015-05-21 22:35:42 -0700 | [diff] [blame] | 183 | vol->format("auto"); |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 184 | vol->destroy(); |
| 185 | vol->setSilent(false); |
| 186 | } |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 187 | |
Jeff Sharkey | 9c48498 | 2015-03-31 10:35:33 -0700 | [diff] [blame] | 188 | mVolumes.push_back(vol); |
Jeff Sharkey | f1b996d | 2015-04-17 17:35:20 -0700 | [diff] [blame] | 189 | vol->setDiskId(getId()); |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 190 | vol->create(); |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 191 | } |
| 192 | |
Jeff Sharkey | 9c48498 | 2015-03-31 10:35:33 -0700 | [diff] [blame] | 193 | void Disk::createPrivateVolume(dev_t device, const std::string& partGuid) { |
Jeff Sharkey | 9c48498 | 2015-03-31 10:35:33 -0700 | [diff] [blame] | 194 | std::string normalizedGuid; |
Jeff Sharkey | bc40cc8 | 2015-06-18 14:25:08 -0700 | [diff] [blame] | 195 | if (NormalizeHex(partGuid, normalizedGuid)) { |
Jeff Sharkey | 9c48498 | 2015-03-31 10:35:33 -0700 | [diff] [blame] | 196 | LOG(WARNING) << "Invalid GUID " << partGuid; |
| 197 | return; |
| 198 | } |
Jeff Sharkey | 9c48498 | 2015-03-31 10:35:33 -0700 | [diff] [blame] | 199 | |
| 200 | std::string keyRaw; |
| 201 | if (!ReadFileToString(BuildKeyPath(normalizedGuid), &keyRaw)) { |
| 202 | PLOG(ERROR) << "Failed to load key for GUID " << normalizedGuid; |
| 203 | return; |
| 204 | } |
| 205 | |
| 206 | LOG(DEBUG) << "Found key for GUID " << normalizedGuid; |
| 207 | |
| 208 | auto vol = std::shared_ptr<VolumeBase>(new PrivateVolume(device, keyRaw)); |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 209 | if (mJustPartitioned) { |
| 210 | LOG(DEBUG) << "Device just partitioned; silently formatting"; |
| 211 | vol->setSilent(true); |
| 212 | vol->create(); |
Jeff Sharkey | d0640f6 | 2015-05-21 22:35:42 -0700 | [diff] [blame] | 213 | vol->format("auto"); |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 214 | vol->destroy(); |
| 215 | vol->setSilent(false); |
| 216 | } |
Jeff Sharkey | 9c48498 | 2015-03-31 10:35:33 -0700 | [diff] [blame] | 217 | |
| 218 | mVolumes.push_back(vol); |
Jeff Sharkey | f1b996d | 2015-04-17 17:35:20 -0700 | [diff] [blame] | 219 | vol->setDiskId(getId()); |
Jeff Sharkey | bc40cc8 | 2015-06-18 14:25:08 -0700 | [diff] [blame] | 220 | vol->setPartGuid(partGuid); |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 221 | vol->create(); |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 222 | } |
| 223 | |
| 224 | void Disk::destroyAllVolumes() { |
Chih-Hung Hsieh | 11a2ce8 | 2016-07-27 14:11:02 -0700 | [diff] [blame] | 225 | for (const auto& vol : mVolumes) { |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 226 | vol->destroy(); |
| 227 | } |
| 228 | mVolumes.clear(); |
| 229 | } |
| 230 | |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 231 | status_t Disk::readMetadata() { |
| 232 | mSize = -1; |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 233 | mLabel.clear(); |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 234 | |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 235 | int fd = open(mDevPath.c_str(), O_RDONLY | O_CLOEXEC); |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 236 | if (fd != -1) { |
| 237 | if (ioctl(fd, BLKGETSIZE64, &mSize)) { |
| 238 | mSize = -1; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 239 | } |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 240 | close(fd); |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 241 | } |
| 242 | |
Yu Ning | 942d4e8 | 2016-01-08 17:36:47 +0800 | [diff] [blame] | 243 | unsigned int majorId = major(mDevice); |
| 244 | switch (majorId) { |
Jeff Sharkey | fa1c677 | 2017-03-25 22:49:13 -0600 | [diff] [blame] | 245 | case kMajorBlockLoop: { |
| 246 | mLabel = "Virtual"; |
| 247 | break; |
| 248 | } |
Jeff Sharkey | f3ee200 | 2015-04-19 15:55:42 -0700 | [diff] [blame] | 249 | case kMajorBlockScsiA: case kMajorBlockScsiB: case kMajorBlockScsiC: case kMajorBlockScsiD: |
| 250 | case kMajorBlockScsiE: case kMajorBlockScsiF: case kMajorBlockScsiG: case kMajorBlockScsiH: |
| 251 | case kMajorBlockScsiI: case kMajorBlockScsiJ: case kMajorBlockScsiK: case kMajorBlockScsiL: |
| 252 | case kMajorBlockScsiM: case kMajorBlockScsiN: case kMajorBlockScsiO: case kMajorBlockScsiP: { |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 253 | std::string path(mSysPath + "/device/vendor"); |
| 254 | std::string tmp; |
| 255 | if (!ReadFileToString(path, &tmp)) { |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 256 | PLOG(WARNING) << "Failed to read vendor from " << path; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 257 | return -errno; |
| 258 | } |
| 259 | mLabel = tmp; |
| 260 | break; |
| 261 | } |
| 262 | case kMajorBlockMmc: { |
| 263 | std::string path(mSysPath + "/device/manfid"); |
| 264 | std::string tmp; |
| 265 | if (!ReadFileToString(path, &tmp)) { |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 266 | PLOG(WARNING) << "Failed to read manufacturer from " << path; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 267 | return -errno; |
| 268 | } |
| 269 | uint64_t manfid = strtoll(tmp.c_str(), nullptr, 16); |
| 270 | // Our goal here is to give the user a meaningful label, ideally |
| 271 | // matching whatever is silk-screened on the card. To reduce |
| 272 | // user confusion, this list doesn't contain white-label manfid. |
| 273 | switch (manfid) { |
| 274 | case 0x000003: mLabel = "SanDisk"; break; |
| 275 | case 0x00001b: mLabel = "Samsung"; break; |
| 276 | case 0x000028: mLabel = "Lexar"; break; |
| 277 | case 0x000074: mLabel = "Transcend"; break; |
| 278 | } |
| 279 | break; |
| 280 | } |
| 281 | default: { |
Yu Ning | 942d4e8 | 2016-01-08 17:36:47 +0800 | [diff] [blame] | 282 | if (isVirtioBlkDevice(majorId)) { |
| 283 | LOG(DEBUG) << "Recognized experimental block major ID " << majorId |
| 284 | << " as virtio-blk (emulator's virtual SD card device)"; |
| 285 | mLabel = "Virtual"; |
| 286 | break; |
| 287 | } |
Dmitry Shmidt | 06dc6e5 | 2018-05-11 17:22:42 -0700 | [diff] [blame] | 288 | if (isNvmeBlkDevice(majorId, mSysPath)) { |
| 289 | std::string path(mSysPath + "/device/model"); |
| 290 | std::string tmp; |
| 291 | if (!ReadFileToString(path, &tmp)) { |
| 292 | PLOG(WARNING) << "Failed to read vendor from " << path; |
| 293 | return -errno; |
| 294 | } |
| 295 | mLabel = tmp; |
| 296 | break; |
| 297 | } |
Yu Ning | 942d4e8 | 2016-01-08 17:36:47 +0800 | [diff] [blame] | 298 | LOG(WARNING) << "Unsupported block major type " << majorId; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 299 | return -ENOTSUP; |
| 300 | } |
| 301 | } |
| 302 | |
Jeff Sharkey | d087bbc | 2016-03-10 12:11:09 -0700 | [diff] [blame] | 303 | notifyEvent(ResponseCode::DiskSizeChanged, StringPrintf("%" PRIu64, mSize)); |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 304 | notifyEvent(ResponseCode::DiskLabelChanged, mLabel); |
Jeff Sharkey | c86ab6f | 2015-06-26 14:02:09 -0700 | [diff] [blame] | 305 | notifyEvent(ResponseCode::DiskSysPathChanged, mSysPath); |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 306 | return OK; |
| 307 | } |
| 308 | |
| 309 | status_t Disk::readPartitions() { |
| 310 | int8_t maxMinors = getMaxMinors(); |
| 311 | if (maxMinors < 0) { |
| 312 | return -ENOTSUP; |
| 313 | } |
| 314 | |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 315 | destroyAllVolumes(); |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 316 | |
| 317 | // Parse partition table |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 318 | |
| 319 | std::vector<std::string> cmd; |
| 320 | cmd.push_back(kSgdiskPath); |
| 321 | cmd.push_back("--android-dump"); |
| 322 | cmd.push_back(mDevPath); |
| 323 | |
| 324 | std::vector<std::string> output; |
| 325 | status_t res = ForkExecvp(cmd, output); |
| 326 | if (res != OK) { |
| 327 | LOG(WARNING) << "sgdisk failed to scan " << mDevPath; |
Jeff Sharkey | ba6747f | 2015-04-28 21:17:43 -0700 | [diff] [blame] | 328 | notifyEvent(ResponseCode::DiskScanned); |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 329 | mJustPartitioned = false; |
| 330 | return res; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 331 | } |
| 332 | |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 333 | Table table = Table::kUnknown; |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 334 | bool foundParts = false; |
Chih-Hung Hsieh | 11a2ce8 | 2016-07-27 14:11:02 -0700 | [diff] [blame] | 335 | for (const auto& line : output) { |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 336 | char* cline = (char*) line.c_str(); |
| 337 | char* token = strtok(cline, kSgdiskToken); |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 338 | if (token == nullptr) continue; |
| 339 | |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 340 | if (!strcmp(token, "DISK")) { |
| 341 | const char* type = strtok(nullptr, kSgdiskToken); |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 342 | if (!strcmp(type, "mbr")) { |
| 343 | table = Table::kMbr; |
| 344 | } else if (!strcmp(type, "gpt")) { |
| 345 | table = Table::kGpt; |
| 346 | } |
| 347 | } else if (!strcmp(token, "PART")) { |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 348 | foundParts = true; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 349 | int i = strtol(strtok(nullptr, kSgdiskToken), nullptr, 10); |
| 350 | if (i <= 0 || i > maxMinors) { |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 351 | LOG(WARNING) << mId << " is ignoring partition " << i |
| 352 | << " beyond max supported devices"; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 353 | continue; |
| 354 | } |
| 355 | dev_t partDevice = makedev(major(mDevice), minor(mDevice) + i); |
| 356 | |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 357 | if (table == Table::kMbr) { |
| 358 | const char* type = strtok(nullptr, kSgdiskToken); |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 359 | |
| 360 | switch (strtol(type, nullptr, 16)) { |
| 361 | case 0x06: // FAT16 |
| 362 | case 0x0b: // W95 FAT32 (LBA) |
| 363 | case 0x0c: // W95 FAT32 (LBA) |
| 364 | case 0x0e: // W95 FAT16 (LBA) |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 365 | createPublicVolume(partDevice); |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 366 | break; |
| 367 | } |
| 368 | } else if (table == Table::kGpt) { |
| 369 | const char* typeGuid = strtok(nullptr, kSgdiskToken); |
| 370 | const char* partGuid = strtok(nullptr, kSgdiskToken); |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 371 | |
| 372 | if (!strcasecmp(typeGuid, kGptBasicData)) { |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 373 | createPublicVolume(partDevice); |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 374 | } else if (!strcasecmp(typeGuid, kGptAndroidExpand)) { |
Jeff Sharkey | 9c48498 | 2015-03-31 10:35:33 -0700 | [diff] [blame] | 375 | createPrivateVolume(partDevice, partGuid); |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 376 | } |
| 377 | } |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 378 | } |
| 379 | } |
| 380 | |
| 381 | // Ugly last ditch effort, treat entire disk as partition |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 382 | if (table == Table::kUnknown || !foundParts) { |
| 383 | LOG(WARNING) << mId << " has unknown partition table; trying entire device"; |
Jeff Sharkey | 63123c0 | 2015-06-26 11:16:14 -0700 | [diff] [blame] | 384 | |
| 385 | std::string fsType; |
| 386 | std::string unused; |
| 387 | if (ReadMetadataUntrusted(mDevPath, fsType, unused, unused) == OK) { |
| 388 | createPublicVolume(mDevice); |
| 389 | } else { |
| 390 | LOG(WARNING) << mId << " failed to identify, giving up"; |
| 391 | } |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 392 | } |
Jeff Sharkey | f1b996d | 2015-04-17 17:35:20 -0700 | [diff] [blame] | 393 | |
Jeff Sharkey | 613b26f | 2015-04-19 14:57:55 -0700 | [diff] [blame] | 394 | notifyEvent(ResponseCode::DiskScanned); |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 395 | mJustPartitioned = false; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 396 | return OK; |
| 397 | } |
| 398 | |
Jeff Sharkey | 9c48498 | 2015-03-31 10:35:33 -0700 | [diff] [blame] | 399 | status_t Disk::unmountAll() { |
Chih-Hung Hsieh | 11a2ce8 | 2016-07-27 14:11:02 -0700 | [diff] [blame] | 400 | for (const auto& vol : mVolumes) { |
Jeff Sharkey | 9c48498 | 2015-03-31 10:35:33 -0700 | [diff] [blame] | 401 | vol->unmount(); |
| 402 | } |
| 403 | return OK; |
| 404 | } |
| 405 | |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 406 | status_t Disk::partitionPublic() { |
Jeff Sharkey | dadccee | 2015-09-23 14:13:45 -0700 | [diff] [blame] | 407 | int res; |
| 408 | |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 409 | // TODO: improve this code |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 410 | destroyAllVolumes(); |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 411 | mJustPartitioned = true; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 412 | |
Jeff Sharkey | dadccee | 2015-09-23 14:13:45 -0700 | [diff] [blame] | 413 | // First nuke any existing partition table |
| 414 | std::vector<std::string> cmd; |
| 415 | cmd.push_back(kSgdiskPath); |
| 416 | cmd.push_back("--zap-all"); |
| 417 | cmd.push_back(mDevPath); |
| 418 | |
| 419 | // Zap sometimes returns an error when it actually succeeded, so |
| 420 | // just log as warning and keep rolling forward. |
| 421 | if ((res = ForkExecvp(cmd)) != 0) { |
| 422 | LOG(WARNING) << "Failed to zap; status " << res; |
| 423 | } |
| 424 | |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 425 | struct disk_info dinfo; |
| 426 | memset(&dinfo, 0, sizeof(dinfo)); |
| 427 | |
| 428 | if (!(dinfo.part_lst = (struct part_info *) malloc( |
| 429 | MAX_NUM_PARTS * sizeof(struct part_info)))) { |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 430 | return -1; |
| 431 | } |
| 432 | |
| 433 | memset(dinfo.part_lst, 0, MAX_NUM_PARTS * sizeof(struct part_info)); |
| 434 | dinfo.device = strdup(mDevPath.c_str()); |
| 435 | dinfo.scheme = PART_SCHEME_MBR; |
| 436 | dinfo.sect_size = 512; |
| 437 | dinfo.skip_lba = 2048; |
| 438 | dinfo.num_lba = 0; |
| 439 | dinfo.num_parts = 1; |
| 440 | |
| 441 | struct part_info *pinfo = &dinfo.part_lst[0]; |
| 442 | |
| 443 | pinfo->name = strdup("android_sdcard"); |
| 444 | pinfo->flags |= PART_ACTIVE_FLAG; |
| 445 | pinfo->type = PC_PART_TYPE_FAT32; |
| 446 | pinfo->len_kb = -1; |
| 447 | |
| 448 | int rc = apply_disk_config(&dinfo, 0); |
| 449 | if (rc) { |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 450 | LOG(ERROR) << "Failed to apply disk configuration: " << rc; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 451 | goto out; |
| 452 | } |
| 453 | |
| 454 | out: |
| 455 | free(pinfo->name); |
| 456 | free(dinfo.device); |
| 457 | free(dinfo.part_lst); |
| 458 | |
| 459 | return rc; |
| 460 | } |
| 461 | |
| 462 | status_t Disk::partitionPrivate() { |
Jeff Sharkey | 9c48498 | 2015-03-31 10:35:33 -0700 | [diff] [blame] | 463 | return partitionMixed(0); |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 464 | } |
| 465 | |
| 466 | status_t Disk::partitionMixed(int8_t ratio) { |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 467 | int res; |
Jeff Sharkey | 9c48498 | 2015-03-31 10:35:33 -0700 | [diff] [blame] | 468 | |
Jeff Sharkey | 46bb69f | 2017-06-21 13:52:23 -0600 | [diff] [blame] | 469 | if (e4crypt_is_native() |
| 470 | && !android::base::GetBoolProperty("persist.sys.adoptable_fbe", false)) { |
Jeff Sharkey | 1571751 | 2016-08-23 13:48:50 -0600 | [diff] [blame] | 471 | LOG(ERROR) << "Private volumes not yet supported on FBE devices"; |
| 472 | return -EINVAL; |
| 473 | } |
| 474 | |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 475 | destroyAllVolumes(); |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 476 | mJustPartitioned = true; |
Jeff Sharkey | 9c48498 | 2015-03-31 10:35:33 -0700 | [diff] [blame] | 477 | |
| 478 | // First nuke any existing partition table |
| 479 | std::vector<std::string> cmd; |
| 480 | cmd.push_back(kSgdiskPath); |
| 481 | cmd.push_back("--zap-all"); |
| 482 | cmd.push_back(mDevPath); |
| 483 | |
Jeff Sharkey | ffeb007 | 2015-04-14 22:22:34 -0700 | [diff] [blame] | 484 | // Zap sometimes returns an error when it actually succeeded, so |
| 485 | // just log as warning and keep rolling forward. |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 486 | if ((res = ForkExecvp(cmd)) != 0) { |
Jeff Sharkey | ffeb007 | 2015-04-14 22:22:34 -0700 | [diff] [blame] | 487 | LOG(WARNING) << "Failed to zap; status " << res; |
Jeff Sharkey | 9c48498 | 2015-03-31 10:35:33 -0700 | [diff] [blame] | 488 | } |
| 489 | |
| 490 | // We've had some success above, so generate both the private partition |
| 491 | // GUID and encryption key and persist them. |
| 492 | std::string partGuidRaw; |
Jeff Sharkey | 46bb69f | 2017-06-21 13:52:23 -0600 | [diff] [blame] | 493 | if (GenerateRandomUuid(partGuidRaw) != OK) { |
| 494 | LOG(ERROR) << "Failed to generate GUID"; |
| 495 | return -EIO; |
| 496 | } |
| 497 | |
Jeff Sharkey | 9c48498 | 2015-03-31 10:35:33 -0700 | [diff] [blame] | 498 | std::string keyRaw; |
Jeff Sharkey | 46bb69f | 2017-06-21 13:52:23 -0600 | [diff] [blame] | 499 | if (ReadRandomBytes(16, keyRaw) != OK) { |
| 500 | LOG(ERROR) << "Failed to generate key"; |
Jeff Sharkey | 9c48498 | 2015-03-31 10:35:33 -0700 | [diff] [blame] | 501 | return -EIO; |
| 502 | } |
| 503 | |
| 504 | std::string partGuid; |
| 505 | StrToHex(partGuidRaw, partGuid); |
| 506 | |
| 507 | if (!WriteStringToFile(keyRaw, BuildKeyPath(partGuid))) { |
| 508 | LOG(ERROR) << "Failed to persist key"; |
| 509 | return -EIO; |
| 510 | } else { |
| 511 | LOG(DEBUG) << "Persisted key for GUID " << partGuid; |
| 512 | } |
| 513 | |
| 514 | // Now let's build the new GPT table. We heavily rely on sgdisk to |
| 515 | // force optimal alignment on the created partitions. |
| 516 | cmd.clear(); |
| 517 | cmd.push_back(kSgdiskPath); |
| 518 | |
| 519 | // If requested, create a public partition first. Mixed-mode partitioning |
| 520 | // like this is an experimental feature. |
| 521 | if (ratio > 0) { |
| 522 | if (ratio < 10 || ratio > 90) { |
| 523 | LOG(ERROR) << "Mixed partition ratio must be between 10-90%"; |
| 524 | return -EINVAL; |
| 525 | } |
| 526 | |
| 527 | uint64_t splitMb = ((mSize / 100) * ratio) / 1024 / 1024; |
| 528 | cmd.push_back(StringPrintf("--new=0:0:+%" PRId64 "M", splitMb)); |
| 529 | cmd.push_back(StringPrintf("--typecode=0:%s", kGptBasicData)); |
| 530 | cmd.push_back("--change-name=0:shared"); |
| 531 | } |
| 532 | |
| 533 | // Define a metadata partition which is designed for future use; there |
| 534 | // should only be one of these per physical device, even if there are |
| 535 | // multiple private volumes. |
| 536 | cmd.push_back("--new=0:0:+16M"); |
| 537 | cmd.push_back(StringPrintf("--typecode=0:%s", kGptAndroidMeta)); |
| 538 | cmd.push_back("--change-name=0:android_meta"); |
| 539 | |
| 540 | // Define a single private partition filling the rest of disk. |
| 541 | cmd.push_back("--new=0:0:-0"); |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 542 | cmd.push_back(StringPrintf("--typecode=0:%s", kGptAndroidExpand)); |
Jeff Sharkey | 9c48498 | 2015-03-31 10:35:33 -0700 | [diff] [blame] | 543 | cmd.push_back(StringPrintf("--partition-guid=0:%s", partGuid.c_str())); |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 544 | cmd.push_back("--change-name=0:android_expand"); |
Jeff Sharkey | 9c48498 | 2015-03-31 10:35:33 -0700 | [diff] [blame] | 545 | |
| 546 | cmd.push_back(mDevPath); |
| 547 | |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 548 | if ((res = ForkExecvp(cmd)) != 0) { |
| 549 | LOG(ERROR) << "Failed to partition; status " << res; |
| 550 | return res; |
Jeff Sharkey | 9c48498 | 2015-03-31 10:35:33 -0700 | [diff] [blame] | 551 | } |
| 552 | |
| 553 | return OK; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 554 | } |
| 555 | |
Jeff Sharkey | ce6a913 | 2015-04-08 21:07:21 -0700 | [diff] [blame] | 556 | void Disk::notifyEvent(int event) { |
| 557 | VolumeManager::Instance()->getBroadcaster()->sendBroadcast(event, |
| 558 | getId().c_str(), false); |
| 559 | } |
| 560 | |
| 561 | void Disk::notifyEvent(int event, const std::string& value) { |
| 562 | VolumeManager::Instance()->getBroadcaster()->sendBroadcast(event, |
| 563 | StringPrintf("%s %s", getId().c_str(), value.c_str()).c_str(), false); |
| 564 | } |
| 565 | |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 566 | int Disk::getMaxMinors() { |
| 567 | // Figure out maximum partition devices supported |
Yu Ning | 942d4e8 | 2016-01-08 17:36:47 +0800 | [diff] [blame] | 568 | unsigned int majorId = major(mDevice); |
| 569 | switch (majorId) { |
Jeff Sharkey | fa1c677 | 2017-03-25 22:49:13 -0600 | [diff] [blame] | 570 | case kMajorBlockLoop: { |
| 571 | std::string tmp; |
| 572 | if (!ReadFileToString(kSysfsLoopMaxMinors, &tmp)) { |
| 573 | LOG(ERROR) << "Failed to read max minors"; |
| 574 | return -errno; |
| 575 | } |
| 576 | return atoi(tmp.c_str()); |
| 577 | } |
Jeff Sharkey | f3ee200 | 2015-04-19 15:55:42 -0700 | [diff] [blame] | 578 | case kMajorBlockScsiA: case kMajorBlockScsiB: case kMajorBlockScsiC: case kMajorBlockScsiD: |
| 579 | case kMajorBlockScsiE: case kMajorBlockScsiF: case kMajorBlockScsiG: case kMajorBlockScsiH: |
| 580 | case kMajorBlockScsiI: case kMajorBlockScsiJ: case kMajorBlockScsiK: case kMajorBlockScsiL: |
| 581 | case kMajorBlockScsiM: case kMajorBlockScsiN: case kMajorBlockScsiO: case kMajorBlockScsiP: { |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 582 | // Per Documentation/devices.txt this is static |
| 583 | return 15; |
| 584 | } |
| 585 | case kMajorBlockMmc: { |
| 586 | // Per Documentation/devices.txt this is dynamic |
| 587 | std::string tmp; |
Pierre-Hugues Husson | f347cd0 | 2017-11-28 15:42:56 +0100 | [diff] [blame] | 588 | if (!ReadFileToString(kSysfsMmcMaxMinors, &tmp) && |
| 589 | !ReadFileToString(kSysfsMmcMaxMinorsDeprecated, &tmp)) { |
Jeff Sharkey | 36801cc | 2015-03-13 16:09:20 -0700 | [diff] [blame] | 590 | LOG(ERROR) << "Failed to read max minors"; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 591 | return -errno; |
| 592 | } |
| 593 | return atoi(tmp.c_str()); |
| 594 | } |
Yu Ning | 942d4e8 | 2016-01-08 17:36:47 +0800 | [diff] [blame] | 595 | default: { |
| 596 | if (isVirtioBlkDevice(majorId)) { |
| 597 | // drivers/block/virtio_blk.c has "#define PART_BITS 4", so max is |
| 598 | // 2^4 - 1 = 15 |
| 599 | return 15; |
| 600 | } |
Dmitry Shmidt | 06dc6e5 | 2018-05-11 17:22:42 -0700 | [diff] [blame] | 601 | if (isNvmeBlkDevice(majorId, mSysPath)) { |
| 602 | // despite kernel nvme driver supports up to 1M minors, |
| 603 | // #define NVME_MINORS (1U << MINORBITS) |
| 604 | // sgdisk can not support more than 127 partitions, due to |
| 605 | // #define MAX_MBR_PARTS 128 |
| 606 | return 127; |
| 607 | } |
Yu Ning | 942d4e8 | 2016-01-08 17:36:47 +0800 | [diff] [blame] | 608 | } |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 609 | } |
| 610 | |
Yu Ning | 942d4e8 | 2016-01-08 17:36:47 +0800 | [diff] [blame] | 611 | LOG(ERROR) << "Unsupported block major type " << majorId; |
Jeff Sharkey | deb2405 | 2015-03-02 21:01:40 -0800 | [diff] [blame] | 612 | return -ENOTSUP; |
| 613 | } |
| 614 | |
| 615 | } // namespace vold |
| 616 | } // namespace android |