From 1a18d5f42450b064a0707215ccca62af2d826acc Mon Sep 17 00:00:00 2001 From: Byungsoo Kim Date: Sat, 18 May 2013 14:02:19 +0900 Subject: [PATCH] umount usr data partition Because system-server connected with /opt/usr, we couldn't send sigterm signal. Instead of sending signal, use MNT_DETACH option for unmounting rw user data partition. System-server called kernel power off after unmounting /opt/usr partition successfully. Change-Id: I458f273c5855cff9499c737535d8a0a0a4e25371 Signed-off-by: Byungsoo Kim --- src/power/power-handler.c | 41 ++++++++++------------------------------- 1 file changed, 10 insertions(+), 31 deletions(-) mode change 100644 => 100755 src/power/power-handler.c diff --git a/src/power/power-handler.c b/src/power/power-handler.c old mode 100644 new mode 100755 index d0985f4..c08b956 --- a/src/power/power-handler.c +++ b/src/power/power-handler.c @@ -122,35 +122,14 @@ static void poweroff_control_cb(keynode_t *in_key, struct ss_main_data *ad) update_pm_setting(SETTING_POWEROFF, val); } -static void remount_ro() +/* umount usr data partition */ +static void unmount_rw_partition() { - struct mntent* mnt; - const char* table = "/etc/mtab"; - const char mmtpoint[10][64]; - FILE* fp; - int r = -1, foundmount=0; char buf[256]; - fp = setmntent(table, "r"); - - if (!fp) - return; - - while (mnt=getmntent(fp)) { - if (foundmount >= 10) - continue; - if (!strcmp(mnt->mnt_type, "ext4") && strstr(mnt->mnt_opts, "rw")) { - memset(mmtpoint[foundmount], 0, 64); - strncpy(mmtpoint[foundmount], mnt->mnt_dir, 63); - foundmount++; - } - } - endmntent(fp); - while (foundmount) { - foundmount--; - snprintf(buf, sizeof(buf), "fuser -c %s -k -15", mmtpoint[foundmount]); - sleep(1); - umount2(mmtpoint[foundmount], MNT_DETACH); - } + int ret; + ret = umount2("/opt/usr", MNT_DETACH); + _D("/opt/usr unmount : %d", ret); + sleep(1); } static void enter_flight_mode_cb(TapiHandle *handle, int result, void *data, void *user_data) @@ -247,7 +226,7 @@ Eina_Bool powerdown_ap_by_force(void *data) /* give a chance to be terminated for each process */ power_off = 1; sync(); - remount_ro(); + unmount_rw_partition(); reboot(RB_POWER_OFF); return EINA_TRUE; } @@ -287,7 +266,7 @@ static void powerdown_ap(TapiHandle *handle, const char *noti_id, void *data, vo /* give a chance to be terminated for each process */ power_off = 1; sync(); - remount_ro(); + unmount_rw_partition(); reboot(RB_POWER_OFF); } static void powerdown_res_cb(TapiHandle *handle, int result, void *data, void *user_data) @@ -369,7 +348,7 @@ static void restart_ap(TapiHandle *handle, const char *noti_id, void *data, void usleep(100000); gettimeofday(&now, NULL); } - remount_ro(); + unmount_rw_partition(); reboot(RB_AUTOBOOT); } @@ -404,7 +383,7 @@ static void restart_ap_by_force(void *data) usleep(100000); gettimeofday(&now, NULL); } - remount_ro(); + unmount_rw_partition(); reboot(RB_AUTOBOOT); } -- 2.7.4