Set hardcoded path for multiuser database 91/324091/2
authorinkyun.kil <inkyun.kil@samsung.com>
Tue, 13 May 2025 01:08:32 +0000 (10:08 +0900)
committerInkyun Kil <inkyun.kil@samsung.com>
Tue, 13 May 2025 05:19:18 +0000 (05:19 +0000)
Change-Id: I8d6d87d2784932a3ef0ae5c9b6675c855dea0b05
Signed-off-by: inkyun.kil <inkyun.kil@samsung.com>
common/direct.c
lib/CMakeLists.txt

index 4806fd2624ccb7c2ecdfdc8c34f13c4b06c300a0..7d394145ba59f88a9d4c3f1002f0b106c328394a 100644 (file)
@@ -37,7 +37,9 @@
 #include "serialize.h"
 #include "cache.h"
 
-static int get_path(uid_t uid, enum layer_attribute_type type,
+#define BXT_DEFAULT_USER tzplatform_getuid(TZ_SYS_DEFAULT_USER)
+
+static int get_path(enum layer_attribute_type type,
                const struct layer *ly, const char *user, char *path, int sz)
 {
        const char *prefix;
@@ -55,7 +57,7 @@ static int get_path(uid_t uid, enum layer_attribute_type type,
        if (ly->type == LAYER_USER) {
                if (user != NULL && user[0] != '\0' && type == LAYER_ATTRIBUTE_RW) {
                        snprintf(path, sz, "%s/user/%u/subsession/%s/%s.db",
-                                       prefix, uid, user, ly->name);
+                                       prefix, BXT_DEFAULT_USER, user, ly->name);
                } else {
                        snprintf(path, sz, "%s/%s.db", prefix, ly->name);
                }
@@ -113,7 +115,7 @@ static int get_raw(const struct layer *ly, uid_t uid, const char *user,
        if (cache_get(type, key, (void **)data, len) == BUXTON_ERROR_NONE)
                return BUXTON_ERROR_NONE;
 
-       r = get_path(uid, type, ly, user, path, sizeof(path));
+       r = get_path(type, ly, user, path, sizeof(path));
        if (r != BUXTON_ERROR_NONE)
                return r;
 
@@ -297,7 +299,7 @@ static int set_raw(const struct layer *ly, uid_t uid, const char *user,
                return BUXTON_ERROR_NONE;
        }
 
-       r = get_path(uid, type, ly, user, path, sizeof(path));
+       r = get_path(type, ly, user, path, sizeof(path));
        if (r != BUXTON_ERROR_NONE)
                return r;
 
@@ -427,7 +429,7 @@ static int direct_close(const struct buxton_layer *layer, const struct layer *ly
                return BUXTON_ERROR_INVALID_OPERATION;
        }
 
-       r = get_path(layer->uid, LAYER_ATTRIBUTE_RO, ly, layer->user, path,
+       r = get_path(LAYER_ATTRIBUTE_RO, ly, layer->user, path,
                        sizeof(path));
        if (r != BUXTON_ERROR_NONE)
                return r;
@@ -513,7 +515,7 @@ static int unset_with_layer(const struct layer *ly,
                return BUXTON_ERROR_INVALID_OPERATION;
        }
 
-       r = get_path(bxt_layer->uid, bxt_layer->type, ly, bxt_layer->user, path,
+       r = get_path(bxt_layer->type, ly, bxt_layer->user, path,
                        sizeof(path));
        if (r != BUXTON_ERROR_NONE)
                return r;
@@ -597,7 +599,7 @@ int direct_list(const struct buxton_layer *layer,
                return BUXTON_ERROR_INVALID_OPERATION;
        }
 
-       r = get_path(layer->uid, is_base ?
+       r = get_path(is_base ?
                        LAYER_ATTRIBUTE_RO : LAYER_ATTRIBUTE_RW,
                        ly, layer->user, path, sizeof(path));
        if (r != BUXTON_ERROR_NONE)
@@ -653,7 +655,7 @@ int direct_dump(const struct buxton_layer *layer,
                return BUXTON_ERROR_INVALID_OPERATION;
        }
 
-       ret = get_path(layer->uid, LAYER_ATTRIBUTE_RO,
+       ret = get_path(LAYER_ATTRIBUTE_RO,
                        ly, layer->user, path, sizeof(path));
        if (ret != BUXTON_ERROR_NONE)
                return ret;
@@ -670,7 +672,7 @@ int direct_dump(const struct buxton_layer *layer,
                return ret;
        }
 
-       ret = get_path(layer->uid, LAYER_ATTRIBUTE_RW,
+       ret = get_path(LAYER_ATTRIBUTE_RW,
                        ly, layer->user, path, sizeof(path));
        if (ret != BUXTON_ERROR_NONE) {
                bxt_err("dump: get_path failed");
@@ -877,7 +879,7 @@ int direct_remove_db(const struct buxton_layer *layer)
                return BUXTON_ERROR_INVALID_OPERATION;
        }
 
-       r = get_path(layer->uid, layer->type, ly, layer->user, path,
+       r = get_path(layer->type, ly, layer->user, path,
                        sizeof(path));
        if (r != BUXTON_ERROR_NONE)
                return r;
@@ -916,7 +918,7 @@ int direct_db_check(const char *layer_name)
                return BUXTON_ERROR_INVALID_OPERATION;
        }
 
-       r = get_path(0, LAYER_ATTRIBUTE_RW, ly, NULL, path, sizeof(path));
+       r = get_path(LAYER_ATTRIBUTE_RW, ly, NULL, path, sizeof(path));
        if (r != BUXTON_ERROR_NONE)
                return r;
 
@@ -999,7 +1001,7 @@ int direct_copy_user_db(const char *layer_name, uid_t uid, const char *name)
                return BUXTON_ERROR_INVALID_OPERATION;
        }
 
-       r = get_path(uid, LAYER_ATTRIBUTE_RW, ly, name, dst_path, sizeof(dst_path));
+       r = get_path(LAYER_ATTRIBUTE_RW, ly, name, dst_path, sizeof(dst_path));
        if (r != BUXTON_ERROR_NONE)
                return r;
 
@@ -1015,7 +1017,7 @@ int direct_copy_user_db(const char *layer_name, uid_t uid, const char *name)
                                parent, errno);
        }
 
-       r = get_path(uid, LAYER_ATTRIBUTE_RW, ly, "", src_path, sizeof(src_path));
+       r = get_path(LAYER_ATTRIBUTE_RW, ly, "", src_path, sizeof(src_path));
        if (r != BUXTON_ERROR_NONE)
                return r;
 
@@ -1048,7 +1050,7 @@ int direct_remove_db_v2(const char *layer_name, uid_t uid, const char *name)
                return BUXTON_ERROR_INVALID_OPERATION;
        }
 
-       r = get_path(uid, LAYER_ATTRIBUTE_RW, ly, name, path, sizeof(path));
+       r = get_path(LAYER_ATTRIBUTE_RW, ly, name, path, sizeof(path));
        if (r != BUXTON_ERROR_NONE)
                return r;
 
index 7c1d1dcae7d2d755c8482c87557300e416ced8c1..b3dccbabf30dbd1d2d1a2e596ecc20a7dd1196c6 100644 (file)
@@ -14,7 +14,7 @@ SET_TARGET_PROPERTIES(${TARGET} PROPERTIES
                VERSION ${VERSION}
                SOVERSION ${MAJVER}
 )
-TARGET_LINK_LIBRARIES(${TARGET} ${PKGS_LDFLAGS} pthread atomic)
+TARGET_LINK_LIBRARIES(${TARGET} ${PKGS_LDFLAGS} ${TZPLATFORM_CONFIG_DEPS_LDFLAGS} pthread atomic)
 INSTALL(TARGETS ${TARGET} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
 
 # buxton2.pc