summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2016-12-13 11:55:19 -0700
committerJeff Sharkey <jsharkey@android.com>2016-12-13 13:28:08 -0700
commitdff44709cf462a3af7eb5770c90e3ada492295b7 (patch)
tree260698ec335906df76fe1db439baa5f71089a953 /include
parent2361ab0d3172adf472c7a8bbb7030f514543104d (diff)
downloadcore-dff44709cf462a3af7eb5770c90e3ada492295b7.tar.gz
core-dff44709cf462a3af7eb5770c90e3ada492295b7.tar.bz2
core-dff44709cf462a3af7eb5770c90e3ada492295b7.zip
Define range of GIDs for cached app data.
To support upcoming disk usage calculation optimizations, this change creates a new GID for each app that will be used to mark its cached data. We're allocating these unique GIDs so that we can use quotactl() to track cached data on a per-app basis. This change also tightens up the implementation of both the cache and shared GID calculation to ensure that they stay inside the valid ranges, and includes tests to verify. Test: builds, boots, tests pass Bug: 27948817 Change-Id: Ie4377e5aae267f2da39a165888139228995987cb
Diffstat (limited to 'include')
-rw-r--r--include/cutils/multiuser.h16
-rw-r--r--include/private/android_filesystem_config.h18
2 files changed, 20 insertions, 14 deletions
diff --git a/include/cutils/multiuser.h b/include/cutils/multiuser.h
index 7e7f8154a..4f23776df 100644
--- a/include/cutils/multiuser.h
+++ b/include/cutils/multiuser.h
@@ -23,19 +23,19 @@
extern "C" {
#endif
-// NOTE: keep in sync with android.os.UserId
-
-#define MULTIUSER_APP_PER_USER_RANGE 100000
-#define MULTIUSER_FIRST_SHARED_APPLICATION_GID 50000
-#define MULTIUSER_FIRST_APPLICATION_UID 10000
-
typedef uid_t userid_t;
typedef uid_t appid_t;
extern userid_t multiuser_get_user_id(uid_t uid);
extern appid_t multiuser_get_app_id(uid_t uid);
-extern uid_t multiuser_get_uid(userid_t userId, appid_t appId);
-extern appid_t multiuser_get_shared_app_gid(uid_t uid);
+
+extern uid_t multiuser_get_uid(userid_t user_id, appid_t app_id);
+
+extern gid_t multiuser_get_cache_gid(userid_t user_id, appid_t app_id);
+extern gid_t multiuser_get_shared_gid(userid_t user_id, appid_t app_id);
+
+/* TODO: switch callers over to multiuser_get_shared_gid() */
+extern gid_t multiuser_get_shared_app_gid(uid_t uid);
#ifdef __cplusplus
}
diff --git a/include/private/android_filesystem_config.h b/include/private/android_filesystem_config.h
index 303156266..f7cf9b808 100644
--- a/include/private/android_filesystem_config.h
+++ b/include/private/android_filesystem_config.h
@@ -157,15 +157,21 @@
#define AID_MISC 9998 /* access to misc storage */
#define AID_NOBODY 9999
-#define AID_APP 10000 /* first app user */
+#define AID_APP 10000 /* TODO: switch users over to AID_APP_START */
+#define AID_APP_START 10000 /* first app user */
+#define AID_APP_END 19999 /* last app user */
-#define AID_ISOLATED_START 99000 /* start of uids for fully isolated sandboxed processes */
-#define AID_ISOLATED_END 99999 /* end of uids for fully isolated sandboxed processes */
-
-#define AID_USER 100000 /* offset for uid ranges for each user */
+#define AID_CACHE_GID_START 20000 /* start of gids for apps to mark cached data */
+#define AID_CACHE_GID_END 29999 /* end of gids for apps to mark cached data */
#define AID_SHARED_GID_START 50000 /* start of gids for apps in each user to share */
-#define AID_SHARED_GID_END 59999 /* start of gids for apps in each user to share */
+#define AID_SHARED_GID_END 59999 /* end of gids for apps in each user to share */
+
+#define AID_ISOLATED_START 99000 /* start of uids for fully isolated sandboxed processes */
+#define AID_ISOLATED_END 99999 /* end of uids for fully isolated sandboxed processes */
+
+#define AID_USER 100000 /* TODO: switch users over to AID_USER_OFFSET */
+#define AID_USER_OFFSET 100000 /* offset for uid ranges for each user */
#if !defined(EXCLUDE_FS_CONFIG_STRUCTURES)
/*