summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcodeworkx <daniel.hillenbrand@codeworkx.de>2012-04-19 10:50:22 +0200
committerRicardo Cerqueira <cyanogenmod@cerqueira.org>2012-07-10 20:10:35 +0100
commit3ec68c97e4a1407b5a7d8b4954b4cbf90c189538 (patch)
treebdbbe5936f1dac800b2eac164e5185854ce009eb
parentdc8d157d73fb88ee33b38e724a8aabe7d5e53eee (diff)
downloadsystem_vold-3ec68c97e4a1407b5a7d8b4954b4cbf90c189538.zip
system_vold-3ec68c97e4a1407b5a7d8b4954b4cbf90c189538.tar.gz
system_vold-3ec68c97e4a1407b5a7d8b4954b4cbf90c189538.tar.bz2
vold: fix handling of discs with multiple majors on DirectVolume::getShareDevice()
The method DirectVolume::getShareDevice() returns an invalid device if the partition referenced by mPartIdx is bad. A bad partition is one where the major/minor numbers on disk don't match what is expected. The original major number is stored for bad partitions so the fix attempts to retrieve it and return it if applicable. This fix is one part of fixing ICS encryption on the i777 (and possibly other devices) where bad partitions may exist. Change-Id: Ic3b05dbf45315bde502c151f53928ca1891483f0
-rw-r--r--DirectVolume.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/DirectVolume.cpp b/DirectVolume.cpp
index fab7c12..e463446 100644
--- a/DirectVolume.cpp
+++ b/DirectVolume.cpp
@@ -72,6 +72,14 @@ dev_t DirectVolume::getDiskDevice() {
dev_t DirectVolume::getShareDevice() {
if (mPartIdx != -1) {
+#ifdef VOLD_DISC_HAS_MULTIPLE_MAJORS
+ int major = getMajorNumberForBadPartition(mPartIdx);
+ if(major != -1) {
+ SLOGE("getShareDevice() returning correct major: %d, minor: %d", major, mPartMinors[mPartIdx - 1]);
+ return MKDEV(major, mPartMinors[mPartIdx - 1]);
+ }
+ else
+#endif
return MKDEV(mDiskMajor, mPartIdx);
} else {
return MKDEV(mDiskMajor, mDiskMinor);