San Mehat | f1b736b | 2009-10-10 17:22:08 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 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 | #include <stdio.h> |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 18 | #include <stdlib.h> |
San Mehat | f1b736b | 2009-10-10 17:22:08 -0700 | [diff] [blame] | 19 | #include <string.h> |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 20 | #include <errno.h> |
San Mehat | f1b736b | 2009-10-10 17:22:08 -0700 | [diff] [blame] | 21 | |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 22 | #include <linux/kdev_t.h> |
| 23 | |
| 24 | #define LOG_TAG "DirectVolume" |
San Mehat | f1b736b | 2009-10-10 17:22:08 -0700 | [diff] [blame] | 25 | |
| 26 | #include <cutils/log.h> |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 27 | #include <sysutils/NetlinkEvent.h> |
San Mehat | f1b736b | 2009-10-10 17:22:08 -0700 | [diff] [blame] | 28 | |
San Mehat | ae10b91 | 2009-10-12 14:57:05 -0700 | [diff] [blame] | 29 | #include "DirectVolume.h" |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 30 | #include "VolumeManager.h" |
| 31 | #include "ResponseCode.h" |
San Mehat | f1b736b | 2009-10-10 17:22:08 -0700 | [diff] [blame] | 32 | |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 33 | // #define PARTITION_DEBUG |
| 34 | |
| 35 | DirectVolume::DirectVolume(VolumeManager *vm, const char *label, |
| 36 | const char *mount_point, int partIdx) : |
| 37 | Volume(vm, label, mount_point) { |
San Mehat | f1b736b | 2009-10-10 17:22:08 -0700 | [diff] [blame] | 38 | mPartIdx = partIdx; |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 39 | |
San Mehat | f1b736b | 2009-10-10 17:22:08 -0700 | [diff] [blame] | 40 | mPaths = new PathCollection(); |
San Mehat | dd9b8e9 | 2009-10-21 11:06:52 -0700 | [diff] [blame] | 41 | for (int i = 0; i < MAX_PARTITIONS; i++) |
| 42 | mPartMinors[i] = -1; |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 43 | mPendingPartMap = 0; |
| 44 | mDiskMajor = -1; |
| 45 | mDiskMinor = -1; |
| 46 | mDiskNumParts = 0; |
| 47 | |
| 48 | setState(Volume::State_NoMedia); |
San Mehat | f1b736b | 2009-10-10 17:22:08 -0700 | [diff] [blame] | 49 | } |
| 50 | |
San Mehat | ae10b91 | 2009-10-12 14:57:05 -0700 | [diff] [blame] | 51 | DirectVolume::~DirectVolume() { |
San Mehat | f1b736b | 2009-10-10 17:22:08 -0700 | [diff] [blame] | 52 | PathCollection::iterator it; |
| 53 | |
| 54 | for (it = mPaths->begin(); it != mPaths->end(); ++it) |
| 55 | free(*it); |
| 56 | delete mPaths; |
| 57 | } |
| 58 | |
San Mehat | ae10b91 | 2009-10-12 14:57:05 -0700 | [diff] [blame] | 59 | int DirectVolume::addPath(const char *path) { |
San Mehat | f1b736b | 2009-10-10 17:22:08 -0700 | [diff] [blame] | 60 | mPaths->push_back(strdup(path)); |
| 61 | return 0; |
| 62 | } |
| 63 | |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 64 | dev_t DirectVolume::getDiskDevice() { |
| 65 | return MKDEV(mDiskMajor, mDiskMinor); |
| 66 | } |
| 67 | |
| 68 | void DirectVolume::handleVolumeShared() { |
| 69 | setState(Volume::State_Shared); |
| 70 | } |
| 71 | |
| 72 | void DirectVolume::handleVolumeUnshared() { |
| 73 | setState(Volume::State_Idle); |
| 74 | } |
| 75 | |
San Mehat | ae10b91 | 2009-10-12 14:57:05 -0700 | [diff] [blame] | 76 | int DirectVolume::handleBlockEvent(NetlinkEvent *evt) { |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 77 | const char *dp = evt->findParam("DEVPATH"); |
San Mehat | f1b736b | 2009-10-10 17:22:08 -0700 | [diff] [blame] | 78 | |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 79 | PathCollection::iterator it; |
San Mehat | f1b736b | 2009-10-10 17:22:08 -0700 | [diff] [blame] | 80 | for (it = mPaths->begin(); it != mPaths->end(); ++it) { |
San Mehat | f1b736b | 2009-10-10 17:22:08 -0700 | [diff] [blame] | 81 | if (!strncmp(dp, *it, strlen(*it))) { |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 82 | /* We can handle this disk */ |
| 83 | int action = evt->getAction(); |
| 84 | const char *devtype = evt->findParam("DEVTYPE"); |
| 85 | |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 86 | if (action == NetlinkEvent::NlActionAdd) { |
| 87 | int major = atoi(evt->findParam("MAJOR")); |
| 88 | int minor = atoi(evt->findParam("MINOR")); |
| 89 | char nodepath[255]; |
| 90 | |
| 91 | snprintf(nodepath, |
| 92 | sizeof(nodepath), "/dev/block/vold/%d:%d", |
| 93 | major, minor); |
| 94 | if (createDeviceNode(nodepath, major, minor)) { |
| 95 | LOGE("Error making device node '%s' (%s)", nodepath, |
| 96 | strerror(errno)); |
| 97 | } |
| 98 | if (!strcmp(devtype, "disk")) { |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 99 | handleDiskAdded(dp, evt); |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 100 | } else { |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 101 | handlePartitionAdded(dp, evt); |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 102 | } |
| 103 | } else if (action == NetlinkEvent::NlActionRemove) { |
| 104 | if (!strcmp(devtype, "disk")) { |
| 105 | handleDiskRemoved(dp, evt); |
| 106 | } else { |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 107 | handlePartitionRemoved(dp, evt); |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 108 | } |
| 109 | } else if (action == NetlinkEvent::NlActionChange) { |
| 110 | if (!strcmp(devtype, "disk")) { |
| 111 | handleDiskChanged(dp, evt); |
| 112 | } else { |
| 113 | handlePartitionChanged(dp, evt); |
| 114 | } |
| 115 | } else { |
| 116 | LOGW("Ignoring non add/remove/change event"); |
San Mehat | f1b736b | 2009-10-10 17:22:08 -0700 | [diff] [blame] | 117 | } |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 118 | |
San Mehat | f1b736b | 2009-10-10 17:22:08 -0700 | [diff] [blame] | 119 | return 0; |
| 120 | } |
| 121 | } |
| 122 | errno = ENODEV; |
| 123 | return -1; |
| 124 | } |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 125 | |
San Mehat | ae10b91 | 2009-10-12 14:57:05 -0700 | [diff] [blame] | 126 | void DirectVolume::handleDiskAdded(const char *devpath, NetlinkEvent *evt) { |
Kenny Root | da62e7c | 2010-03-24 20:18:00 -0700 | [diff] [blame^] | 127 | mDiskMajor = atoi(evt->findParam("MAJOR")); |
| 128 | mDiskMinor = atoi(evt->findParam("MINOR")); |
San Mehat | 7b8f2db | 2010-01-04 14:03:36 -0800 | [diff] [blame] | 129 | |
| 130 | const char *tmp = evt->findParam("NPARTS"); |
| 131 | if (tmp) { |
| 132 | mDiskNumParts = atoi(tmp); |
| 133 | } else { |
| 134 | LOGW("Kernel block uevent missing 'NPARTS'"); |
| 135 | mDiskNumParts = 1; |
| 136 | } |
| 137 | |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 138 | char msg[255]; |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 139 | |
| 140 | int partmask = 0; |
| 141 | int i; |
San Mehat | 59abc3c | 2009-10-12 14:48:47 -0700 | [diff] [blame] | 142 | for (i = 1; i <= mDiskNumParts; i++) { |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 143 | partmask |= (1 << i); |
| 144 | } |
| 145 | mPendingPartMap = partmask; |
| 146 | |
| 147 | if (mDiskNumParts == 0) { |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 148 | #ifdef PARTITION_DEBUG |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 149 | LOGD("Dv::diskIns - No partitions - good to go son!"); |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 150 | #endif |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 151 | setState(Volume::State_Idle); |
| 152 | } else { |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 153 | #ifdef PARTITION_DEBUG |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 154 | LOGD("Dv::diskIns - waiting for %d partitions (mask 0x%x)", |
| 155 | mDiskNumParts, mPendingPartMap); |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 156 | #endif |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 157 | setState(Volume::State_Pending); |
| 158 | } |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 159 | |
| 160 | snprintf(msg, sizeof(msg), "Volume %s %s disk inserted (%d:%d)", |
| 161 | getLabel(), getMountpoint(), mDiskMajor, mDiskMinor); |
| 162 | mVm->getBroadcaster()->sendBroadcast(ResponseCode::VolumeDiskInserted, |
| 163 | msg, false); |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 164 | } |
| 165 | |
San Mehat | ae10b91 | 2009-10-12 14:57:05 -0700 | [diff] [blame] | 166 | void DirectVolume::handlePartitionAdded(const char *devpath, NetlinkEvent *evt) { |
Kenny Root | da62e7c | 2010-03-24 20:18:00 -0700 | [diff] [blame^] | 167 | int major = atoi(evt->findParam("MAJOR")); |
| 168 | int minor = atoi(evt->findParam("MINOR")); |
San Mehat | 7b8f2db | 2010-01-04 14:03:36 -0800 | [diff] [blame] | 169 | |
| 170 | int part_num; |
| 171 | |
| 172 | const char *tmp = evt->findParam("PARTN"); |
| 173 | |
| 174 | if (tmp) { |
| 175 | part_num = atoi(tmp); |
| 176 | } else { |
| 177 | LOGW("Kernel block uevent missing 'PARTN'"); |
| 178 | part_num = 1; |
| 179 | } |
San Mehat | 59abc3c | 2009-10-12 14:48:47 -0700 | [diff] [blame] | 180 | |
San Mehat | 2a5b8ce | 2010-03-10 12:48:57 -0800 | [diff] [blame] | 181 | if (part_num > mDiskNumParts) { |
| 182 | mDiskNumParts = part_num; |
| 183 | } |
| 184 | |
San Mehat | dd9b8e9 | 2009-10-21 11:06:52 -0700 | [diff] [blame] | 185 | if (major != mDiskMajor) { |
| 186 | LOGE("Partition '%s' has a different major than its disk!", devpath); |
| 187 | return; |
| 188 | } |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 189 | #ifdef PARTITION_DEBUG |
| 190 | LOGD("Dv:partAdd: part_num = %d, minor = %d\n", part_num, minor); |
| 191 | #endif |
San Mehat | dd9b8e9 | 2009-10-21 11:06:52 -0700 | [diff] [blame] | 192 | mPartMinors[part_num -1] = minor; |
| 193 | |
San Mehat | 59abc3c | 2009-10-12 14:48:47 -0700 | [diff] [blame] | 194 | mPendingPartMap &= ~(1 << part_num); |
| 195 | if (!mPendingPartMap) { |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 196 | #ifdef PARTITION_DEBUG |
San Mehat | 59abc3c | 2009-10-12 14:48:47 -0700 | [diff] [blame] | 197 | LOGD("Dv:partAdd: Got all partitions - ready to rock!"); |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 198 | #endif |
San Mehat | 2a5b8ce | 2010-03-10 12:48:57 -0800 | [diff] [blame] | 199 | if (getState() != Volume::State_Formatting) { |
| 200 | setState(Volume::State_Idle); |
| 201 | } |
San Mehat | 59abc3c | 2009-10-12 14:48:47 -0700 | [diff] [blame] | 202 | } else { |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 203 | #ifdef PARTITION_DEBUG |
San Mehat | 59abc3c | 2009-10-12 14:48:47 -0700 | [diff] [blame] | 204 | LOGD("Dv:partAdd: pending mask now = 0x%x", mPendingPartMap); |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 205 | #endif |
San Mehat | 59abc3c | 2009-10-12 14:48:47 -0700 | [diff] [blame] | 206 | } |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 207 | } |
| 208 | |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 209 | void DirectVolume::handleDiskChanged(const char *devpath, NetlinkEvent *evt) { |
Kenny Root | da62e7c | 2010-03-24 20:18:00 -0700 | [diff] [blame^] | 210 | int major = atoi(evt->findParam("MAJOR")); |
| 211 | int minor = atoi(evt->findParam("MINOR")); |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 212 | |
| 213 | if ((major != mDiskMajor) || (minor != mDiskMinor)) { |
| 214 | return; |
| 215 | } |
| 216 | |
| 217 | LOGI("Volume %s disk has changed", getLabel()); |
San Mehat | 7b8f2db | 2010-01-04 14:03:36 -0800 | [diff] [blame] | 218 | const char *tmp = evt->findParam("NPARTS"); |
| 219 | if (tmp) { |
| 220 | mDiskNumParts = atoi(tmp); |
| 221 | } else { |
| 222 | LOGW("Kernel block uevent missing 'NPARTS'"); |
| 223 | mDiskNumParts = 1; |
| 224 | } |
| 225 | |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 226 | int partmask = 0; |
| 227 | int i; |
| 228 | for (i = 1; i <= mDiskNumParts; i++) { |
| 229 | partmask |= (1 << i); |
| 230 | } |
| 231 | mPendingPartMap = partmask; |
| 232 | |
San Mehat | 2a5b8ce | 2010-03-10 12:48:57 -0800 | [diff] [blame] | 233 | if (getState() != Volume::State_Formatting) { |
| 234 | if (mDiskNumParts == 0) { |
| 235 | setState(Volume::State_Idle); |
| 236 | } else { |
| 237 | setState(Volume::State_Pending); |
| 238 | } |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 239 | } |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 240 | } |
| 241 | |
| 242 | void DirectVolume::handlePartitionChanged(const char *devpath, NetlinkEvent *evt) { |
Kenny Root | da62e7c | 2010-03-24 20:18:00 -0700 | [diff] [blame^] | 243 | int major = atoi(evt->findParam("MAJOR")); |
| 244 | int minor = atoi(evt->findParam("MINOR")); |
San Mehat | 2a5b8ce | 2010-03-10 12:48:57 -0800 | [diff] [blame] | 245 | LOGD("Volume %s %s partition %d:%d changed\n", getLabel(), getMountpoint(), major, minor); |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 246 | } |
| 247 | |
San Mehat | ae10b91 | 2009-10-12 14:57:05 -0700 | [diff] [blame] | 248 | void DirectVolume::handleDiskRemoved(const char *devpath, NetlinkEvent *evt) { |
Kenny Root | da62e7c | 2010-03-24 20:18:00 -0700 | [diff] [blame^] | 249 | int major = atoi(evt->findParam("MAJOR")); |
| 250 | int minor = atoi(evt->findParam("MINOR")); |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 251 | char msg[255]; |
| 252 | |
| 253 | LOGD("Volume %s %s disk %d:%d removed\n", getLabel(), getMountpoint(), major, minor); |
| 254 | snprintf(msg, sizeof(msg), "Volume %s %s disk removed (%d:%d)", |
| 255 | getLabel(), getMountpoint(), major, minor); |
| 256 | mVm->getBroadcaster()->sendBroadcast(ResponseCode::VolumeDiskRemoved, |
| 257 | msg, false); |
| 258 | setState(Volume::State_NoMedia); |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 259 | } |
| 260 | |
San Mehat | ae10b91 | 2009-10-12 14:57:05 -0700 | [diff] [blame] | 261 | void DirectVolume::handlePartitionRemoved(const char *devpath, NetlinkEvent *evt) { |
Kenny Root | da62e7c | 2010-03-24 20:18:00 -0700 | [diff] [blame^] | 262 | int major = atoi(evt->findParam("MAJOR")); |
| 263 | int minor = atoi(evt->findParam("MINOR")); |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 264 | char msg[255]; |
| 265 | |
| 266 | LOGD("Volume %s %s partition %d:%d removed\n", getLabel(), getMountpoint(), major, minor); |
| 267 | |
| 268 | /* |
| 269 | * The framework doesn't need to get notified of |
| 270 | * partition removal unless it's mounted. Otherwise |
| 271 | * the removal notification will be sent on the Disk |
| 272 | * itself |
| 273 | */ |
| 274 | if (getState() != Volume::State_Mounted) { |
| 275 | return; |
| 276 | } |
| 277 | |
| 278 | if ((dev_t) MKDEV(major, minor) == mCurrentlyMountedKdev) { |
| 279 | /* |
| 280 | * Yikes, our mounted partition is going away! |
| 281 | */ |
| 282 | |
| 283 | snprintf(msg, sizeof(msg), "Volume %s %s bad removal (%d:%d)", |
| 284 | getLabel(), getMountpoint(), major, minor); |
| 285 | mVm->getBroadcaster()->sendBroadcast(ResponseCode::VolumeBadRemoval, |
| 286 | msg, false); |
San Mehat | 4ba8948 | 2010-02-18 09:00:18 -0800 | [diff] [blame] | 287 | if (Volume::unmountVol(true)) { |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 288 | LOGE("Failed to unmount volume on bad removal (%s)", |
| 289 | strerror(errno)); |
| 290 | // XXX: At this point we're screwed for now |
| 291 | } else { |
| 292 | LOGD("Crisis averted"); |
| 293 | } |
| 294 | } |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 295 | } |
San Mehat | 49e2bce | 2009-10-12 16:29:01 -0700 | [diff] [blame] | 296 | |
San Mehat | dd9b8e9 | 2009-10-21 11:06:52 -0700 | [diff] [blame] | 297 | /* |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 298 | * Called from base to get a list of devicenodes for mounting |
San Mehat | dd9b8e9 | 2009-10-21 11:06:52 -0700 | [diff] [blame] | 299 | */ |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 300 | int DirectVolume::getDeviceNodes(dev_t *devs, int max) { |
San Mehat | dd9b8e9 | 2009-10-21 11:06:52 -0700 | [diff] [blame] | 301 | |
| 302 | if (mPartIdx == -1) { |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 303 | // If the disk has no partitions, try the disk itself |
San Mehat | dd9b8e9 | 2009-10-21 11:06:52 -0700 | [diff] [blame] | 304 | if (!mDiskNumParts) { |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 305 | devs[0] = MKDEV(mDiskMajor, mDiskMinor); |
| 306 | return 1; |
San Mehat | dd9b8e9 | 2009-10-21 11:06:52 -0700 | [diff] [blame] | 307 | } |
| 308 | |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 309 | int i; |
| 310 | for (i = 0; i < mDiskNumParts; i++) { |
| 311 | if (i == max) |
| 312 | break; |
| 313 | devs[i] = MKDEV(mDiskMajor, mPartMinors[i]); |
| 314 | } |
| 315 | return mDiskNumParts; |
San Mehat | dd9b8e9 | 2009-10-21 11:06:52 -0700 | [diff] [blame] | 316 | } |
San Mehat | a2677e4 | 2009-12-13 10:40:18 -0800 | [diff] [blame] | 317 | devs[0] = MKDEV(mDiskMajor, mPartMinors[mPartIdx -1]); |
| 318 | return 1; |
San Mehat | 49e2bce | 2009-10-12 16:29:01 -0700 | [diff] [blame] | 319 | } |