summaryrefslogtreecommitdiffstats
path: root/Volume.cpp
diff options
context:
space:
mode:
authorSan Mehat <san@google.com>2010-03-12 13:32:47 -0800
committerSan Mehat <san@google.com>2010-03-13 16:42:19 -0800
commitd9a4e358614a0c5f60cc76c0636ee4bb02004a32 (patch)
tree00aaf23db6a1d1f4d385c5ed0ccfa8e711f41e19 /Volume.cpp
parent2a5b8ce09b8836a8463ef9beaaff865c36ca5e6a (diff)
downloadsystem_vold-d9a4e358614a0c5f60cc76c0636ee4bb02004a32.zip
system_vold-d9a4e358614a0c5f60cc76c0636ee4bb02004a32.tar.gz
system_vold-d9a4e358614a0c5f60cc76c0636ee4bb02004a32.tar.bz2
vold: Bugfixes & cleanups
- Fix issue where container-names > 64 bytes were getting truncated in the kernel. lo_name is only 64 bytes in length, so we now hash the container id via md5 - Add 'dump' command to dump loop and devicemapper status - Add 'debug' command to enable more detailed logging at runtime - Log vold IPC arguments (minus encryption keys) - Fix premature return from Loop::lookupActive() and friends Change-Id: I0e833261a445ce9dc1a8187e5501d27daba1ca76 Signed-off-by: San Mehat <san@google.com>
Diffstat (limited to 'Volume.cpp')
-rw-r--r--Volume.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/Volume.cpp b/Volume.cpp
index d592c5f..80a8bf1 100644
--- a/Volume.cpp
+++ b/Volume.cpp
@@ -100,6 +100,7 @@ static const char *stateToStr(int state) {
Volume::Volume(VolumeManager *vm, const char *label, const char *mount_point) {
mVm = vm;
+ mDebug = false;
mLabel = strdup(label);
mMountpoint = strdup(mount_point);
mState = Volume::State_Init;
@@ -111,6 +112,10 @@ Volume::~Volume() {
free(mMountpoint);
}
+void Volume::setDebug(bool enable) {
+ mDebug = enable;
+}
+
dev_t Volume::getDiskDevice() {
return MKDEV(0, 0);
};
@@ -184,7 +189,9 @@ int Volume::formatVol() {
sprintf(devicePath, "/dev/block/vold/%d:%d",
MAJOR(diskNode), MINOR(diskNode));
- LOGI("Formatting volume %s (%s)", getLabel(), devicePath);
+ if (mDebug) {
+ LOGI("Formatting volume %s (%s)", getLabel(), devicePath);
+ }
setState(Volume::State_Formatting);
if (initializeMbr(devicePath)) {
@@ -396,7 +403,9 @@ int Volume::doMoveMount(const char *src, const char *dst, bool force) {
while(retries--) {
if (!mount(src, dst, "", flags, NULL)) {
- LOGD("Moved mount %s -> %s sucessfully", src, dst);
+ if (mDebug) {
+ LOGD("Moved mount %s -> %s sucessfully", src, dst);
+ }
return 0;
} else if (errno != EBUSY) {
LOGE("Failed to move mount %s -> %s (%s)", src, dst, strerror(errno));
@@ -425,7 +434,10 @@ int Volume::doMoveMount(const char *src, const char *dst, bool force) {
int Volume::doUnmount(const char *path, bool force) {
int retries = 10;
- LOGD("Unmounting {%s}, force = %d", path, force);
+ if (mDebug) {
+ LOGD("Unmounting {%s}, force = %d", path, force);
+ }
+
while (retries--) {
if (!umount(path) || errno == EINVAL || errno == ENOENT) {
LOGI("%s sucessfully unmounted", path);