summaryrefslogtreecommitdiffstats
path: root/Volume.cpp
diff options
context:
space:
mode:
authorkallt_kaffe <kallt_kaffe@apedroid.com>2012-03-07 10:42:19 +0100
committerRicardo Cerqueira <cyanogenmod@cerqueira.org>2012-07-10 20:10:35 +0100
commitce7457dfe9706b24bbfe98af82adceab50c2198e (patch)
tree8a1ba0e83189c4e3a0dfee5602f311e84cd9a539 /Volume.cpp
parent75da9e2314889eef40836c56e232d9eb14e4afae (diff)
downloadsystem_vold-ce7457dfe9706b24bbfe98af82adceab50c2198e.zip
system_vold-ce7457dfe9706b24bbfe98af82adceab50c2198e.tar.gz
system_vold-ce7457dfe9706b24bbfe98af82adceab50c2198e.tar.bz2
vold: Add ntfs (read-only) support.
See http://review.cyanogenmod.com/#change,7457 for more info. Change-Id: Ic841e73be6435e8bbbb22984cc749e27c46826e8
Diffstat (limited to 'Volume.cpp')
-rw-r--r--Volume.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/Volume.cpp b/Volume.cpp
index 6421e09..624c3f0 100644
--- a/Volume.cpp
+++ b/Volume.cpp
@@ -44,6 +44,7 @@
#include "VolumeManager.h"
#include "ResponseCode.h"
#include "Fat.h"
+#include "Ntfs.h"
#include "Process.h"
#include "cryptfs.h"
@@ -411,16 +412,18 @@ int Volume::mountVol() {
errno = 0;
setState(Volume::State_Checking);
+ bool isFatFs = true;
if (Fat::check(devicePath)) {
if (errno == ENODATA) {
SLOGW("%s does not contain a FAT filesystem\n", devicePath);
- continue;
+ isFatFs = false;
+ } else {
+ errno = EIO;
+ /* Badness - abort the mount */
+ SLOGE("%s failed FS checks (%s)", devicePath, strerror(errno));
+ setState(Volume::State_Idle);
+ return -1;
}
- errno = EIO;
- /* Badness - abort the mount */
- SLOGE("%s failed FS checks (%s)", devicePath, strerror(errno));
- setState(Volume::State_Idle);
- return -1;
}
/*
@@ -434,10 +437,18 @@ int Volume::mountVol() {
// prevented users from writing to it. We don't want that.
gid = AID_SDCARD_RW;
- if (Fat::doMount(devicePath, "/mnt/secure/staging", false, false, false,
- AID_SYSTEM, gid, 0702, true)) {
- SLOGE("%s failed to mount via VFAT (%s)\n", devicePath, strerror(errno));
- continue;
+ if (isFatFs) {
+ if (Fat::doMount(devicePath, "/mnt/secure/staging", false, false, false,
+ AID_SYSTEM, gid, 0702, true)) {
+ SLOGE("%s failed to mount via VFAT (%s)\n", devicePath, strerror(errno));
+ continue;
+ }
+ } else {
+ if (Ntfs::doMount(devicePath, "/mnt/secure/staging", false, false, false,
+ AID_SYSTEM, gid, 0702, true)) {
+ SLOGE("%s failed to mount via NTFS (%s)\n", devicePath, strerror(errno));
+ continue;
+ }
}
SLOGI("Device %s, target %s mounted @ /mnt/secure/staging", devicePath, getMountpoint());