summaryrefslogtreecommitdiffstats
path: root/VolumeManager.cpp
diff options
context:
space:
mode:
authorSan Mehat <san@google.com>2010-02-28 20:17:20 -0800
committerSan Mehat <san@google.com>2010-02-28 20:17:20 -0800
commita1091cb0c448a933068f9120fe6946c09812bfb6 (patch)
treebeeac205b538517083eda0b1fd5917a6b1c78b8e /VolumeManager.cpp
parent55013f7131ffe094e1c7d929cfc32b3b25096a9b (diff)
downloadsystem_vold-a1091cb0c448a933068f9120fe6946c09812bfb6.zip
system_vold-a1091cb0c448a933068f9120fe6946c09812bfb6.tar.gz
system_vold-a1091cb0c448a933068f9120fe6946c09812bfb6.tar.bz2
vold: Allow creation of a container with no filesystem
Signed-off-by: San Mehat <san@google.com>
Diffstat (limited to 'VolumeManager.cpp')
-rw-r--r--VolumeManager.cpp54
1 files changed, 30 insertions, 24 deletions
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index a1323ed..ce01275 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -219,22 +219,13 @@ int VolumeManager::createAsec(const char *id, unsigned int numSectors,
strcpy(dmDevice, loopDevice);
}
- if (Fat::format(dmDevice)) {
- LOGE("ASEC FAT format failed (%s)", strerror(errno));
- if (cleanupDm) {
- Devmapper::destroy(id);
+ if (strcmp(fstype, "none")) {
+ if (strcmp(fstype, "fat")) {
+ LOGW("Unknown fstype '%s' specified for container", fstype);
}
- Loop::destroyByDevice(loopDevice);
- unlink(asecFileName);
- return -1;
- }
-
- char mountPoint[255];
- snprintf(mountPoint, sizeof(mountPoint), "%s/%s", Volume::ASECDIR, id);
- if (mkdir(mountPoint, 0777)) {
- if (errno != EEXIST) {
- LOGE("Mountpoint creation failed (%s)", strerror(errno));
+ if (Fat::format(dmDevice)) {
+ LOGE("ASEC FAT format failed (%s)", strerror(errno));
if (cleanupDm) {
Devmapper::destroy(id);
}
@@ -242,18 +233,33 @@ int VolumeManager::createAsec(const char *id, unsigned int numSectors,
unlink(asecFileName);
return -1;
}
- }
+ char mountPoint[255];
+
+ snprintf(mountPoint, sizeof(mountPoint), "%s/%s", Volume::ASECDIR, id);
+ if (mkdir(mountPoint, 0777)) {
+ if (errno != EEXIST) {
+ LOGE("Mountpoint creation failed (%s)", strerror(errno));
+ if (cleanupDm) {
+ Devmapper::destroy(id);
+ }
+ Loop::destroyByDevice(loopDevice);
+ unlink(asecFileName);
+ return -1;
+ }
+ }
- if (Fat::doMount(dmDevice, mountPoint, false, false, ownerUid,
- 0, 0000, false)) {
-// 0, 0007, false)) {
- LOGE("ASEC FAT mount failed (%s)", strerror(errno));
- if (cleanupDm) {
- Devmapper::destroy(id);
+ if (Fat::doMount(dmDevice, mountPoint, false, false, ownerUid,
+ 0, 0000, false)) {
+ LOGE("ASEC FAT mount failed (%s)", strerror(errno));
+ if (cleanupDm) {
+ Devmapper::destroy(id);
+ }
+ Loop::destroyByDevice(loopDevice);
+ unlink(asecFileName);
+ return -1;
}
- Loop::destroyByDevice(loopDevice);
- unlink(asecFileName);
- return -1;
+ } else {
+ LOGI("Created raw secure container %s (no filesystem)", id);
}
mActiveContainers->push_back(strdup(id));