umount usr data partition 33/15133/1
authorByungsoo Kim <bs1770.kim@samsung.com>
Sat, 18 May 2013 05:02:19 +0000 (14:02 +0900)
committerKrzysztof Sasiak <k.sasiak@samsung.com>
Thu, 16 Jan 2014 11:03:06 +0000 (12:03 +0100)
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 <bs1770.kim@samsung.com>
src/power/power-handler.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index d0985f4..c08b956
@@ -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);
 }