From: Hyotaek Shim Date: Thu, 19 Jul 2018 02:16:24 +0000 (+0900) Subject: Change internal storage media path returned from storage_get_directory() X-Git-Tag: accepted/tizen/unified/20180719.152633^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d719c4229080290e5000e3d51b7f69cd8c54543f;p=platform%2Fcore%2Fsystem%2Flibstorage.git Change internal storage media path returned from storage_get_directory() (Before) /opt/usr/media/XXX (After) /opt/usr/home/USER/media/XXX /opt/usr/media bind-mounted by /opt/usr/home/USER/media is workaround for supporting legacy Tizen applications based on /opt/usr/media hard coding. Strictly, public apis do not need to use legacy path (/opt/usr/media). Change-Id: Ida39777ac40587719beb8d28b8f04172c98900e5 Signed-off-by: Hyotaek Shim --- diff --git a/src/storage-internal.c b/src/storage-internal.c index 7f5d359..0dadec9 100755 --- a/src/storage-internal.c +++ b/src/storage-internal.c @@ -15,6 +15,8 @@ */ +#include +#include #include #include #include @@ -61,11 +63,7 @@ static int internal_get_space(unsigned long long *total, unsigned long long *ava static const char *internal_get_root(void) { const char *ret; - - if (is_compat_bind_mount()) - ret = COMPAT_DIR; - else - ret = tzplatform_getenv(TZ_USER_CONTENT); + ret = tzplatform_uid_getenv(getuid(), TZ_USER_CONTENT); return ret; } diff --git a/src/storage.c b/src/storage.c index 6dfef6d..b0d6465 100644 --- a/src/storage.c +++ b/src/storage.c @@ -72,7 +72,7 @@ API int storage_foreach_device_supported(storage_device_supported_cb callback, v return STORAGE_ERROR_INVALID_PARAMETER; } - if (getuid() < USER_UID_START) + if (getuid() <= USER_UID_START) user = false; DD_LIST_FOREACH(st_int_head, elem, st) { @@ -116,7 +116,7 @@ API int storage_get_root_directory(int storage_id, char **path) return STORAGE_ERROR_INVALID_PARAMETER; } - if (getuid() < USER_UID_START) + if (getuid() <= USER_UID_START) user = false; /* internal storage */ @@ -124,8 +124,8 @@ API int storage_get_root_directory(int storage_id, char **path) if (st->storage_id != storage_id) continue; if (!user) { - _E("Only Tizen applications and user session daemons can use \ - storage_get_root_directory(id , ...)"); + _E("Only Tizen applications and user session daemons can use\ + storage_get_root_directory(INTERNAL_STORAGE_ID, ...)"); return STORAGE_ERROR_INVALID_PARAMETER; } @@ -189,13 +189,13 @@ API int storage_get_directory(int storage_id, storage_directory_e type, char **p break; } - if (getuid() < USER_UID_START) + if (getuid() <= USER_UID_START) user = false; if (found && st) { if (!user) { - _E("Only Tizen applications and user session daemons can use \ - storage_get_directory(id, ...)"); + _E("Only Tizen applications and user session daemons can use\ + storage_get_directory(INTERNAL_STORAGE_ID, ...)"); return STORAGE_ERROR_INVALID_PARAMETER; }