diff options
author | Kenny Root <kroot@android.com> | 2012-10-17 11:53:40 -0700 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2012-10-17 11:53:41 -0700 |
commit | fd5b29be8c572058ed9ab0198f5603e96c585d3c (patch) | |
tree | d1b3ad3fec62d318f63cfa1952ea1ab5dfbba78a | |
parent | f7e7ee969d9f286315ff153cb979e29e08cee9f4 (diff) | |
parent | a54e13a3dca8ad15141a9f1084b6e121caeddce5 (diff) | |
download | vold-tools_r21.tar.gz |
Merge "Extend vold support for creating ext4 images."tools_r21
-rw-r--r-- | Ext4.cpp | 12 | ||||
-rw-r--r-- | Ext4.h | 2 | ||||
-rw-r--r-- | VolumeManager.cpp | 9 |
3 files changed, 13 insertions, 10 deletions
@@ -67,16 +67,18 @@ int Ext4::doMount(const char *fsPath, const char *mountPoint, bool ro, bool remo return rc; } -int Ext4::format(const char *fsPath) { +int Ext4::format(const char *fsPath, const char *mountpoint) { int fd; - const char *args[4]; + const char *args[6]; int rc; args[0] = MKEXT4FS_PATH; args[1] = "-J"; - args[2] = fsPath; - args[3] = NULL; - rc = logwrap(3, args, 1); + args[2] = "-a"; + args[3] = mountpoint; + args[4] = fsPath; + args[5] = NULL; + rc = logwrap(5, args, 1); if (rc == 0) { SLOGI("Filesystem (ext4) formatted OK"); @@ -23,7 +23,7 @@ class Ext4 { public: static int doMount(const char *fsPath, const char *mountPoint, bool ro, bool remount, bool executable); - static int format(const char *fsPath); + static int format(const char *fsPath, const char *mountpoint); }; #endif diff --git a/VolumeManager.cpp b/VolumeManager.cpp index 03880101..f2e2d07c 100644 --- a/VolumeManager.cpp +++ b/VolumeManager.cpp @@ -379,8 +379,12 @@ int VolumeManager::createAsec(const char *id, unsigned int numSectors, const cha if (wantFilesystem) { int formatStatus; + char mountPoint[255]; + + snprintf(mountPoint, sizeof(mountPoint), "%s/%s", Volume::ASECDIR, id); + if (usingExt4) { - formatStatus = Ext4::format(dmDevice); + formatStatus = Ext4::format(dmDevice, mountPoint); } else { formatStatus = Fat::format(dmDevice, numImgSectors); } @@ -395,9 +399,6 @@ int VolumeManager::createAsec(const char *id, unsigned int numSectors, const cha return -1; } - char mountPoint[255]; - - snprintf(mountPoint, sizeof(mountPoint), "%s/%s", Volume::ASECDIR, id); if (mkdir(mountPoint, 0000)) { if (errno != EEXIST) { SLOGE("Mountpoint creation failed (%s)", strerror(errno)); |