diff options
author | Ken Sumrall <ksumrall@android.com> | 2011-06-03 13:21:55 -0700 |
---|---|---|
committer | Ken Sumrall <ksumrall@android.com> | 2011-06-03 15:46:35 -0700 |
commit | c6c66f422b08cc0c080457d1378fb595cd5dfd82 (patch) | |
tree | c6477ae1d0e3e1df7da922d0d28612289fd270fe | |
parent | 4a4ccb43b1806bcff0e033db7dd38c5f02114b61 (diff) | |
download | device_samsung_crespo-c6c66f422b08cc0c080457d1378fb595cd5dfd82.zip device_samsung_crespo-c6c66f422b08cc0c080457d1378fb595cd5dfd82.tar.gz device_samsung_crespo-c6c66f422b08cc0c080457d1378fb595cd5dfd82.tar.bz2 |
Remove setup_fs from crespo specific code.
It was moved to system/extras/ext4_utils
Change-Id: I8e9e102203e65edd35cef9901ffaf09e49b21654
-rw-r--r-- | Android.mk | 11 | ||||
-rw-r--r-- | setup_fs.c | 79 |
2 files changed, 0 insertions, 90 deletions
@@ -14,17 +14,6 @@ LOCAL_PATH := $(call my-dir) -ifneq ($(filter crespo crespo4g,$(TARGET_DEVICE)),) - -include $(CLEAR_VARS) -LOCAL_SRC_FILES := setup_fs.c -LOCAL_MODULE := setup_fs -LOCAL_MODULE_TAGS := optional -LOCAL_SHARED_LIBRARIES += libcutils -include $(BUILD_EXECUTABLE) - -endif - ifneq ($(TARGET_SIMULATOR),true) include $(call all-makefiles-under,$(LOCAL_PATH)) endif diff --git a/setup_fs.c b/setup_fs.c deleted file mode 100644 index 380c0df..0000000 --- a/setup_fs.c +++ /dev/null @@ -1,79 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/reboot.h> -#include <sys/wait.h> -#include <cutils/android_reboot.h> -#include <cutils/partition_utils.h> - -const char *mkfs = "/system/bin/make_ext4fs"; - -int setup_fs(const char *blockdev) -{ - char buf[256], path[128]; - pid_t child; - int status, n; - - /* we might be looking at an indirect reference */ - n = readlink(blockdev, path, sizeof(path) - 1); - if (n > 0) { - path[n] = 0; - if (!memcmp(path, "/dev/block/", 11)) - blockdev = path + 11; - } - - if (strchr(blockdev,'/')) { - fprintf(stderr,"not a block device name: %s\n", blockdev); - return 0; - } - - sprintf(buf,"/sys/fs/ext4/%s", blockdev); - if (access(buf, F_OK) == 0) { - fprintf(stderr,"device %s already has a filesystem\n", blockdev); - return 0; - } - sprintf(buf,"/dev/block/%s", blockdev); - - if (!partition_wiped(buf)) { - fprintf(stderr,"device %s not wiped, probably encrypted, not wiping\n", blockdev); - return 0; - } - - fprintf(stderr,"+++\n"); - - child = fork(); - if (child < 0) { - fprintf(stderr,"error: fork failed\n"); - return 0; - } - if (child == 0) { - execl(mkfs, mkfs, buf, NULL); - exit(-1); - } - - while (waitpid(-1, &status, 0) != child) ; - - fprintf(stderr,"---\n"); - return 1; -} - - -int main(int argc, char **argv) -{ - int need_reboot = 0; - - while (argc > 1) { - if (strlen(argv[1]) < 128) - need_reboot |= setup_fs(argv[1]); - argv++; - argc--; - } - - if (need_reboot) { - fprintf(stderr,"REBOOT!\n"); - android_reboot(ANDROID_RB_RESTART, 0, 0); - exit(-1); - } - return 0; -} |