diff options
author | Pawit Pornkitprasan <p.pawit@gmail.com> | 2011-11-29 16:17:59 +0700 |
---|---|---|
committer | Pawit Pornkitprasan <p.pawit@gmail.com> | 2011-11-29 16:17:59 +0700 |
commit | d8cb569d51ff58e56354a418c48c06b20b3bf2f5 (patch) | |
tree | 8281e60f11dc2b7f6561b65eb7c9334699b7ab3c | |
parent | 68923695687ebc3ba8bdc39437a233df10f65fa8 (diff) | |
download | device_samsung_galaxysmtd-d8cb569d51ff58e56354a418c48c06b20b3bf2f5.zip device_samsung_galaxysmtd-d8cb569d51ff58e56354a418c48c06b20b3bf2f5.tar.gz device_samsung_galaxysmtd-d8cb569d51ff58e56354a418c48c06b20b3bf2f5.tar.bz2 |
Removed unused setup_fs.c
-rw-r--r-- | Android.mk | 7 | ||||
-rw-r--r-- | setup_fs.c | 75 |
2 files changed, 0 insertions, 82 deletions
@@ -26,13 +26,6 @@ LOCAL_SRC_FILES := cypress-touchkey.kcm LOCAL_MODULE_TAGS := optional include $(BUILD_KEY_CHAR_MAP) -#include $(CLEAR_VARS) -#LOCAL_SRC_FILES := setup_fs.c -#LOCAL_MODULE := setup_fs -#LOCAL_MODULE_TAGS := optional -##LOCAL_SHARED_LIBRARIES += libext4_utils libz -#include $(BUILD_EXECUTABLE) - 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 0acf026..0000000 --- a/setup_fs.c +++ /dev/null @@ -1,75 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/reboot.h> -#include <sys/wait.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); - - 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) { - sync(); - sync(); - sync(); - fprintf(stderr,"REBOOT!\n"); - reboot(RB_AUTOBOOT); - exit(-1); - } - return 0; -} |