2 * fs/sdcardfs/multiuser.h
4 * Copyright (c) 2013 Samsung Electronics Co. Ltd
5 * Authors: Daeho Jeong, Woojoong Lee, Seunghwan Hyun,
6 * Sunghwan Yun, Sungjong Seo
8 * This program has been developed as a stackable file system based on
9 * the WrapFS which written by
11 * Copyright (c) 1998-2011 Erez Zadok
12 * Copyright (c) 2009 Shrikar Archak
13 * Copyright (c) 2003-2011 Stony Brook University
14 * Copyright (c) 2003-2011 The Research Foundation of SUNY
16 * This file is dual licensed. It may be redistributed and/or modified
17 * under the terms of the Apache 2.0 License OR version 2 of the GNU
18 * General Public License.
21 #define MULTIUSER_APP_PER_USER_RANGE 100000
23 typedef uid_t userid_t;
24 typedef uid_t appid_t;
26 static inline userid_t multiuser_get_user_id(uid_t uid) {
27 return uid / MULTIUSER_APP_PER_USER_RANGE;
30 static inline appid_t multiuser_get_app_id(uid_t uid) {
31 return uid % MULTIUSER_APP_PER_USER_RANGE;
34 static inline uid_t multiuser_get_uid(userid_t userId, appid_t appId) {
35 return userId * MULTIUSER_APP_PER_USER_RANGE + (appId % MULTIUSER_APP_PER_USER_RANGE);