ANDROID: sdcardfs: Add default_normal option
The default_normal option causes mounts with the gid set to AID_SDCARD_RW to have user specific gids, as in the normal case. Signed-off-by: Daniel Rosenberg <drosen@google.com> Change-Id: I9619b8ac55f41415df943484dc8db1ea986cef6f Bug: 64672411
This commit is contained in:
parent
77b02dccaf
commit
a51b84097d
3 changed files with 10 additions and 1 deletions
|
@ -33,6 +33,7 @@ enum {
|
||||||
Opt_userid,
|
Opt_userid,
|
||||||
Opt_reserved_mb,
|
Opt_reserved_mb,
|
||||||
Opt_gid_derivation,
|
Opt_gid_derivation,
|
||||||
|
Opt_default_normal,
|
||||||
Opt_err,
|
Opt_err,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -45,6 +46,7 @@ static const match_table_t sdcardfs_tokens = {
|
||||||
{Opt_userid, "userid=%d"},
|
{Opt_userid, "userid=%d"},
|
||||||
{Opt_multiuser, "multiuser"},
|
{Opt_multiuser, "multiuser"},
|
||||||
{Opt_gid_derivation, "derive_gid"},
|
{Opt_gid_derivation, "derive_gid"},
|
||||||
|
{Opt_default_normal, "default_normal"},
|
||||||
{Opt_reserved_mb, "reserved_mb=%u"},
|
{Opt_reserved_mb, "reserved_mb=%u"},
|
||||||
{Opt_err, NULL}
|
{Opt_err, NULL}
|
||||||
};
|
};
|
||||||
|
@ -68,6 +70,7 @@ static int parse_options(struct super_block *sb, char *options, int silent,
|
||||||
opts->reserved_mb = 0;
|
opts->reserved_mb = 0;
|
||||||
/* by default, gid derivation is off */
|
/* by default, gid derivation is off */
|
||||||
opts->gid_derivation = false;
|
opts->gid_derivation = false;
|
||||||
|
vfsopts->default_normal = false;
|
||||||
|
|
||||||
*debug = 0;
|
*debug = 0;
|
||||||
|
|
||||||
|
@ -122,6 +125,8 @@ static int parse_options(struct super_block *sb, char *options, int silent,
|
||||||
case Opt_gid_derivation:
|
case Opt_gid_derivation:
|
||||||
opts->gid_derivation = true;
|
opts->gid_derivation = true;
|
||||||
break;
|
break;
|
||||||
|
case Opt_default_normal:
|
||||||
|
vfsopts->default_normal = true;
|
||||||
/* unknown option */
|
/* unknown option */
|
||||||
default:
|
default:
|
||||||
if (!silent)
|
if (!silent)
|
||||||
|
@ -175,6 +180,7 @@ int parse_options_remount(struct super_block *sb, char *options, int silent,
|
||||||
return 0;
|
return 0;
|
||||||
vfsopts->mask = option;
|
vfsopts->mask = option;
|
||||||
break;
|
break;
|
||||||
|
case Opt_default_normal:
|
||||||
case Opt_multiuser:
|
case Opt_multiuser:
|
||||||
case Opt_userid:
|
case Opt_userid:
|
||||||
case Opt_fsuid:
|
case Opt_fsuid:
|
||||||
|
|
|
@ -226,6 +226,7 @@ struct sdcardfs_mount_options {
|
||||||
struct sdcardfs_vfsmount_options {
|
struct sdcardfs_vfsmount_options {
|
||||||
gid_t gid;
|
gid_t gid;
|
||||||
mode_t mask;
|
mode_t mask;
|
||||||
|
bool default_normal;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int parse_options_remount(struct super_block *sb, char *options, int silent,
|
extern int parse_options_remount(struct super_block *sb, char *options, int silent,
|
||||||
|
@ -417,7 +418,7 @@ static inline int get_gid(struct vfsmount *mnt,
|
||||||
{
|
{
|
||||||
struct sdcardfs_vfsmount_options *opts = mnt->data;
|
struct sdcardfs_vfsmount_options *opts = mnt->data;
|
||||||
|
|
||||||
if (opts->gid == AID_SDCARD_RW)
|
if (opts->gid == AID_SDCARD_RW && !opts->default_normal)
|
||||||
/* As an optimization, certain trusted system components only run
|
/* As an optimization, certain trusted system components only run
|
||||||
* as owner but operate across all users. Since we're now handing
|
* as owner but operate across all users. Since we're now handing
|
||||||
* out the sdcard_rw GID only to trusted apps, we're okay relaxing
|
* out the sdcard_rw GID only to trusted apps, we're okay relaxing
|
||||||
|
|
|
@ -304,6 +304,8 @@ static int sdcardfs_show_options(struct vfsmount *mnt, struct seq_file *m,
|
||||||
seq_printf(m, ",userid=%u", opts->fs_user_id);
|
seq_printf(m, ",userid=%u", opts->fs_user_id);
|
||||||
if (opts->gid_derivation)
|
if (opts->gid_derivation)
|
||||||
seq_puts(m, ",derive_gid");
|
seq_puts(m, ",derive_gid");
|
||||||
|
if (vfsopts->default_normal)
|
||||||
|
seq_puts(m, ",default_normal");
|
||||||
if (opts->reserved_mb != 0)
|
if (opts->reserved_mb != 0)
|
||||||
seq_printf(m, ",reserved=%uMB", opts->reserved_mb);
|
seq_printf(m, ",reserved=%uMB", opts->reserved_mb);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue