Support container path when checking "opt/user" is mounted. 41/260841/2 accepted/tizen/6.5/unified/20211028.114951 accepted/tizen/unified/20210707.070859 submit/tizen/20210706.074949 submit/tizen_6.5/20211028.162501 tizen_6.5.m2_release
authorYunmi Ha <yunmi.ha@samsung.com>
Mon, 5 Jul 2021 11:42:02 +0000 (20:42 +0900)
committerYunmi Ha <yunmi.ha@samsung.com>
Tue, 6 Jul 2021 06:23:11 +0000 (15:23 +0900)
Change-Id: Ie0c1474258eafcd93634784fed58da74703544ca
Signed-off-by: Yunmi Ha <yunmi.ha@samsung.com>
CMakeLists.txt
src/storage-inhouse.c

index 539311a..1f6875c 100644 (file)
@@ -22,7 +22,7 @@ SET(dependents
                capi-system-info
                libsyscommon
 )
-SET(pc_dependents "capi-base-common")
+SET(PC_REQUIRED "capi-base-common")
 
 INCLUDE(FindPkgConfig)
 pkg_check_modules(rpkgs REQUIRED ${dependents})
index 1d89af4..45aba82 100755 (executable)
@@ -24,6 +24,7 @@
 #include <tzplatform_config.h>
 #include <blkid.h>
 #include <libsyscommon/libgdbus.h>
+#include <libsyscommon/common.h>
 
 #include "common.h"
 #include "log.h"
@@ -32,6 +33,7 @@
 
 #define FORMAT_TIMEOUT (120*1000)
 #define USER_PARTITION "user"
+#define CONTAINER_USER_PARTITION "contain-user"
 
 /*
        Get compat path from origin Multi-user path
@@ -454,10 +456,12 @@ API int storage_is_mounted_opt_usr(storage_part_mount_e *mounted)
        blkid_dev dev;
        int ret_val;
        bool found = false;
+       char *user_label = is_container()? CONTAINER_USER_PARTITION: USER_PARTITION;
 
        if (!mounted)
                return STORAGE_ERROR_INVALID_PARAMETER;
 
+       _D("Find user partition label: %s", user_label);
        ret_val = blkid_get_cache(&cache, NULL);
        if (ret_val < 0) {
                _E("Failed to get cache"); //LCOV_EXCL_LINE
@@ -479,12 +483,12 @@ API int storage_is_mounted_opt_usr(storage_part_mount_e *mounted)
                return STORAGE_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
        }
 
-       ret_val = blkid_dev_set_search(iter, "LABEL", USER_PARTITION);
+       ret_val = blkid_dev_set_search(iter, "LABEL", user_label);
        if (blkid_dev_next(iter, &dev) == 0) {
                dev = blkid_verify(cache, dev);
                if (dev) {
                        found = true;
-                       _D("Partition for user data is found(LABEL=user)");
+                       _D("Partition for user data is found(LABEL=%s)", user_label);
                }
        }
        blkid_dev_iterate_end(iter);
@@ -497,12 +501,12 @@ API int storage_is_mounted_opt_usr(storage_part_mount_e *mounted)
                        return STORAGE_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
                }
 
-               ret_val = blkid_dev_set_search(iter, "PARTLABEL", USER_PARTITION);
+               ret_val = blkid_dev_set_search(iter, "PARTLABEL", user_label);
                if (blkid_dev_next(iter, &dev) == 0) {
                        dev = blkid_verify(cache, dev);
                        if (dev) {
                                found = true;
-                               _D("Partition for user data is found(PARTLABEL=user)");
+                               _D("Partition for user data is found(PARTLABEL=%s)", user_label);
                        }
                }
                blkid_dev_iterate_end(iter);