summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Marshall <tdm@cyngn.com>2014-11-10 16:06:22 -0800
committerSteve Kondik <steve@cyngn.com>2015-03-22 03:32:47 -0700
commit9b85cb4be106dd7af7d3354027597186e6ef0ed9 (patch)
treec6eea103e9a05bcc60853968b7442cf81bb7aa14
parent769fd6f54d252264680559d15c545badd6ce29c1 (diff)
downloadandroid_system_vold-9b85cb4be106dd7af7d3354027597186e6ef0ed9.tar.gz
android_system_vold-9b85cb4be106dd7af7d3354027597186e6ef0ed9.tar.bz2
android_system_vold-9b85cb4be106dd7af7d3354027597186e6ef0ed9.zip
vold: Fix build for minivold and general cleanup
Change-Id: Ibc450dd86b77a0c4a25de08b2f07dfb9b2c70871
-rw-r--r--Android.mk23
-rwxr-xr-xcryptfs.c7
-rw-r--r--main.cpp2
-rw-r--r--vdc.c7
-rw-r--r--vold.c21
-rw-r--r--vold.h30
6 files changed, 76 insertions, 14 deletions
diff --git a/Android.mk b/Android.mk
index 17ae0d6..f3a06f7 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,5 +1,7 @@
LOCAL_PATH:= $(call my-dir)
+common_cflags := -Werror -Wno-unused-parameter
+
common_src_files := \
VolumeManager.cpp \
CommandListener.cpp \
@@ -20,7 +22,8 @@ common_src_files := \
CheckBattery.cpp \
VoldUtil.c \
fstrim.c \
- cryptfs.c
+ cryptfs.c \
+ main.cpp
common_c_includes := \
system/extras/ext4_utils \
@@ -60,7 +63,9 @@ common_static_libraries := \
libext4_utils_static \
libscrypt_static \
libminshacrypt \
- libbatteryservice
+ libbatteryservice \
+ libext2_blkid \
+ libext2_uuid_static
include $(CLEAR_VARS)
@@ -82,6 +87,8 @@ LOCAL_SRC_FILES := $(common_src_files)
LOCAL_C_INCLUDES := $(common_c_includes)
+LOCAL_CFLAGS := $(common_cflags)
+
LOCAL_SHARED_LIBRARIES := $(common_shared_libraries)
LOCAL_STATIC_LIBRARIES := $(common_static_libraries)
@@ -94,9 +101,7 @@ include $(CLEAR_VARS)
LOCAL_MODULE:= vold
-LOCAL_SRC_FILES := \
- main.cpp \
- $(common_src_files)
+LOCAL_SRC_FILES := vold.c
LOCAL_C_INCLUDES := $(common_c_includes)
@@ -122,7 +127,7 @@ endif
LOCAL_SHARED_LIBRARIES := $(common_shared_libraries)
-LOCAL_STATIC_LIBRARIES := $(common_static_libraries)
+LOCAL_STATIC_LIBRARIES := libvold $(common_static_libraries)
include $(BUILD_EXECUTABLE)
@@ -134,7 +139,7 @@ LOCAL_MODULE:= vdc
LOCAL_C_INCLUDES :=
-LOCAL_CFLAGS :=
+LOCAL_CFLAGS := $(common_cflags)
LOCAL_SHARED_LIBRARIES := libcutils
@@ -150,13 +155,13 @@ include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE:= minivold
-LOCAL_SRC_FILES := main.cpp
+LOCAL_SRC_FILES := vold.c
LOCAL_C_INCLUDES := $(common_c_includes)
LOCAL_CFLAGS := $(common_cflags) -DMINIVOLD
LOCAL_STATIC_LIBRARIES := libminivold
LOCAL_STATIC_LIBRARIES += libc libstdc++ libstlport_static
LOCAL_STATIC_LIBRARIES += $(common_static_libraries) $(common_libraries)
-LOCAL_STATIC_LIBRARIES += libcrypto_static libext2_uuid libvold
+LOCAL_STATIC_LIBRARIES += libcrypto_static libvold
LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
diff --git a/cryptfs.c b/cryptfs.c
index b70d471..e67dc67 100755
--- a/cryptfs.c
+++ b/cryptfs.c
@@ -132,12 +132,12 @@ out:
/* Should we use keymaster? */
static int keymaster_check_compatibility()
{
+#ifdef MINIVOLD
+ return -1;
+#else
keymaster_device_t *keymaster_dev = 0;
int rc = 0;
-#ifdef MINIVOLD
- return -1;
-#endif
if (keymaster_init(&keymaster_dev)) {
SLOGE("Failed to init keymaster");
rc = -1;
@@ -160,6 +160,7 @@ static int keymaster_check_compatibility()
out:
keymaster_close(keymaster_dev);
return rc;
+#endif
}
/* Create a new keymaster key and store it in this footer */
diff --git a/main.cpp b/main.cpp
index 1e70e48..54e8c14 100644
--- a/main.cpp
+++ b/main.cpp
@@ -43,7 +43,7 @@ static void coldboot(const char *path);
#define FSTAB_PREFIX "/fstab."
struct fstab *fstab;
-int main() {
+extern "C" int vold_main() {
VolumeManager *vm;
CommandListener *cl;
diff --git a/vdc.c b/vdc.c
index dcd2bc3..f44852f 100644
--- a/vdc.c
+++ b/vdc.c
@@ -36,7 +36,7 @@ static void usage(char *progname);
static int do_monitor(int sock, int stop_after_cmd);
static int do_cmd(int sock, int argc, char **argv);
-int main(int argc, char **argv) {
+int vdc_main(int argc, char **argv) {
int sock;
int wait_for_socket;
char *progname;
@@ -168,3 +168,8 @@ static void usage(char *progname) {
"Usage: %s [--wait] <monitor>|<cmd> [arg1] [arg2...]\n", progname);
}
+#ifndef MINIVOLD
+int main(int argc, char **argv) {
+ return vdc_main(argc, argv);
+}
+#endif
diff --git a/vold.c b/vold.c
new file mode 100644
index 0000000..689b2e6
--- /dev/null
+++ b/vold.c
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2013 The CyanogenMod Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "vold.h"
+
+int main(int argc, char **argv) {
+ return vold_main();
+}
diff --git a/vold.h b/vold.h
new file mode 100644
index 0000000..9e7ce66
--- /dev/null
+++ b/vold.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2013 The CyanogenMod Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _VOLD_H
+#define _VOLD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int vold_main();
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+