summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSan Mehat <san@google.com>2010-02-04 15:07:01 -0800
committerSan Mehat <san@google.com>2010-02-04 15:07:01 -0800
commitb9aed74b146beb7499ebc5775e8ae179d16900ef (patch)
tree64c7bbb8a16c2510b648452334d25e5e6d467144
parentf5c61980969a0b49bda37b5dc94ffe675ebd5a5a (diff)
downloadsystem_vold-b9aed74b146beb7499ebc5775e8ae179d16900ef.zip
system_vold-b9aed74b146beb7499ebc5775e8ae179d16900ef.tar.gz
system_vold-b9aed74b146beb7499ebc5775e8ae179d16900ef.tar.bz2
vold: Fix a few bugs
- share command was taking wrong arguments - shared command was returning two termination codes - Force FAT32 cluster size to 4k when formatting Signed-off-by: San Mehat <san@google.com>
-rw-r--r--CommandListener.cpp6
-rw-r--r--Fat.cpp8
-rw-r--r--VolumeManager.cpp4
3 files changed, 11 insertions, 7 deletions
diff --git a/CommandListener.cpp b/CommandListener.cpp
index a40eac2..59c431f 100644
--- a/CommandListener.cpp
+++ b/CommandListener.cpp
@@ -61,9 +61,9 @@ int CommandListener::VolumeCmd::runCommand(SocketClient *cli,
} else if (!strcmp(argv[1], "format")) {
rc = vm->formatVolume(argv[2]);
} else if (!strcmp(argv[1], "share")) {
- rc = vm->shareVolume(argv[1], argv[2]);
+ rc = vm->shareVolume(argv[2], argv[3]);
} else if (!strcmp(argv[1], "unshare")) {
- rc = vm->unshareVolume(argv[1], argv[2]);
+ rc = vm->unshareVolume(argv[2], argv[3]);
} else if (!strcmp(argv[1], "shared")) {
bool enabled = false;
@@ -74,6 +74,7 @@ int CommandListener::VolumeCmd::runCommand(SocketClient *cli,
cli->sendMsg(ResponseCode::ShareEnabledResult,
(enabled ? "Share enabled" : "Share disabled"), false);
}
+ return 0;
} else {
cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown volume cmd", false);
}
@@ -93,6 +94,7 @@ int CommandListener::VolumeCmd::runCommand(SocketClient *cli,
} else if (errno == EBUSY) {
rc = ResponseCode::OpFailedVolBusy;
} else {
+ LOGW("Returning OperationFailed - no handler for errno %d", errno);
rc = ResponseCode::OperationFailed;
}
cli->sendMsg(rc, "volume operation failed", true);
diff --git a/Fat.cpp b/Fat.cpp
index 4f65d38..f934ebc 100644
--- a/Fat.cpp
+++ b/Fat.cpp
@@ -164,15 +164,17 @@ int Fat::format(const char *fsPath) {
}
close(fd);
- const char *args[7];
+ const char *args[9];
int rc;
args[0] = MKDOSFS_PATH;
args[1] = "-F";
args[2] = "32";
args[3] = "-O";
args[4] = "android";
- args[5] = fsPath;
- args[6] = NULL;
+ args[5] = "-c";
+ args[6] = "8";
+ args[7] = fsPath;
+ args[8] = NULL;
rc = logwrap(7, args, 1);
if (rc == 0) {
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index 96a691b..ba92768 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -537,9 +537,9 @@ int VolumeManager::shareEnabled(const char *label, const char *method, bool *ena
}
if (v->getState() != Volume::State_Shared) {
- *enabled = true;
- } else {
*enabled = false;
+ } else {
+ *enabled = true;
}
return 0;
}