summaryrefslogtreecommitdiffstats
path: root/Loop.cpp
diff options
context:
space:
mode:
authorSan Mehat <san@google.com>2010-01-11 09:17:25 -0800
committerSan Mehat <san@google.com>2010-01-11 09:17:25 -0800
commit8b8f71b1d760411279f3b07a5c97709f052c689e (patch)
tree42b1009d8619b23173b15aa0c9386e184d40f9ed /Loop.cpp
parentb78a32c1d5eeb243bdac0eaf18effb1897f1ee67 (diff)
downloadandroid_system_vold-8b8f71b1d760411279f3b07a5c97709f052c689e.tar.gz
android_system_vold-8b8f71b1d760411279f3b07a5c97709f052c689e.tar.bz2
android_system_vold-8b8f71b1d760411279f3b07a5c97709f052c689e.zip
vold: Internally use sector counts for asec lengths
Signed-off-by: San Mehat <san@google.com>
Diffstat (limited to 'Loop.cpp')
-rw-r--r--Loop.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Loop.cpp b/Loop.cpp
index b8106ef..a54d73e 100644
--- a/Loop.cpp
+++ b/Loop.cpp
@@ -181,17 +181,17 @@ int Loop::destroyByFile(const char *loopFile) {
return -1;
}
-int Loop::createImageFile(const char *file, size_t sizeMb) {
+int Loop::createImageFile(const char *file, unsigned int numSectors) {
int fd;
- LOGD("Creating ASEC image file %s (%d mb)", file, sizeMb);
+ LOGD("Creating ASEC image file %s (%u sectors)", file, numSectors);
if ((fd = creat(file, 0600)) < 0) {
LOGE("Error creating imagefile (%s)", strerror(errno));
return -1;
}
- if (ftruncate(fd, 1024 + (sizeMb * (1024 * 1024))) < 0) {
+ if (ftruncate(fd, numSectors * 512) < 0) {
LOGE("Error truncating imagefile (%s)", strerror(errno));
close(fd);
return -1;