vold: Internally use sector counts for asec lengths
Signed-off-by: San Mehat <san@google.com>
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index 201ad98..9bdc980 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -171,7 +171,7 @@
return 0;
}
-int VolumeManager::createAsec(const char *id, int sizeMb,
+int VolumeManager::createAsec(const char *id, unsigned int numSectors,
const char *fstype, const char *key, int ownerUid) {
mkdir("/sdcard/android_secure", 0777);
@@ -193,7 +193,7 @@
return -1;
}
- if (Loop::createImageFile(asecFileName, sizeMb)) {
+ if (Loop::createImageFile(asecFileName, numSectors)) {
LOGE("ASEC image file creation failed (%s)", strerror(errno));
return -1;
}
@@ -209,7 +209,7 @@
bool cleanupDm = false;
if (strcmp(key, "none")) {
- if (Devmapper::create(id, loopDevice, key, sizeMb, dmDevice,
+ if (Devmapper::create(id, loopDevice, key, numSectors, dmDevice,
sizeof(dmDevice))) {
LOGE("ASEC device mapping failed (%s)", strerror(errno));
Loop::destroyByDevice(loopDevice);
@@ -397,8 +397,7 @@
return -1;
}
close(fd);
- if (Devmapper::create(id, loopDevice, key,
- (nr_sec * 512) / (1024 * 1024),
+ if (Devmapper::create(id, loopDevice, key, nr_sec,
dmDevice, sizeof(dmDevice))) {
LOGE("ASEC device mapping failed (%s)", strerror(errno));
Loop::destroyByDevice(loopDevice);