diff options
author | Oran Avraham <oranav@gmail.com> | 2012-11-02 18:18:48 +0200 |
---|---|---|
committer | Oran Avraham <oranav@gmail.com> | 2012-11-02 18:18:48 +0200 |
commit | 3e61f1d12494ac0f456623681f12edf9b356245f (patch) | |
tree | 7048d110687d801d0f538bf46b96c19ac3dc0c11 /VolumeManager.cpp | |
parent | 42c34c801f918507397754f185f85d79d8558d39 (diff) | |
download | system_vold-3e61f1d12494ac0f456623681f12edf9b356245f.zip system_vold-3e61f1d12494ac0f456623681f12edf9b356245f.tar.gz system_vold-3e61f1d12494ac0f456623681f12edf9b356245f.tar.bz2 |
UMS support with any volume, not only primary (1/3)
This patch enables UMS support when any volume supports it, even when the
primary storage doesn't.
1. Vold: assign lun_numbers sequentially to the volumes being added to the
VolumeManager.
2. Fix portions of code which assume that the device has UMS support iff the
primary storage supports UMS.
Instead, determine whether the device supports UMS by checking each volume.
3. Display the UMS option in Settings.apk when any volume supports it.
Change-Id: I3976ee4a26f1ae7bd3faee814d3740312588f4c8
Signed-off-by: Oran Avraham <oranav@gmail.com>
Diffstat (limited to 'VolumeManager.cpp')
-rw-r--r-- | VolumeManager.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/VolumeManager.cpp b/VolumeManager.cpp index ca30357..040e95c 100644 --- a/VolumeManager.cpp +++ b/VolumeManager.cpp @@ -66,6 +66,7 @@ VolumeManager::VolumeManager() { mUmsSharingCount = 0; mSavedDirtyRatio = -1; mVolManagerDisabled = 0; + mNextLunNumber = 0; // set dirty ratio to ro.vold.umsdirtyratio (default 0) when UMS is active char dirtyratio[PROPERTY_VALUE_MAX]; @@ -127,6 +128,7 @@ int VolumeManager::stop() { } int VolumeManager::addVolume(Volume *v) { + v->setLunNumber(mNextLunNumber++); mVolumes->push_back(v); return 0; } @@ -1269,12 +1271,8 @@ int VolumeManager::shareVolume(const char *label, const char *method) { sizeof(nodepath), "/dev/block/vold/%d:%d", MAJOR(d), MINOR(d)); - // TODO: Currently only two mounts are supported, defaulting - // /mnt/sdcard to lun0 and anything else to lun1. Fix this. - if (v->isPrimaryStorage()) { - lun_number = 0; - } else { - lun_number = SECOND_LUN_NUM; + if ((lun_number = v->getLunNumber()) == -1) { + return -1; } if ((fd = openLun(lun_number)) < 0) { @@ -1325,14 +1323,10 @@ int VolumeManager::unshareVolume(const char *label, const char *method) { return -1; } - int fd; - int lun_number; + int fd, lun_number; - // /mnt/sdcard to lun0 and anything else to lun1. Fix this. - if (v->isPrimaryStorage()) { - lun_number = 0; - } else { - lun_number = SECOND_LUN_NUM; + if ((lun_number = v->getLunNumber()) == -1) { + return -1; } if ((fd = openLun(lun_number)) < 0) { |