From: resver Date: Fri, 8 Jan 2010 08:50:08 +0000 (+0000) Subject: Implemented uid and gid mount options. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=cb380d3916dde8b49a340ac5f37d6deaa82f0418;p=android-x86%2Fexternal-exfat.git Implemented uid and gid mount options. git-svn-id: http://exfat.googlecode.com/svn/trunk@94 60bc1c72-a15a-11de-b98f-4500b42dc123 --- diff --git a/libexfat/exfat.h b/libexfat/exfat.h index 8b3e996..18d3bde 100644 --- a/libexfat/exfat.h +++ b/libexfat/exfat.h @@ -71,6 +71,8 @@ struct exfat cmap; void* zero_block; int dmask, fmask; + uid_t uid; + gid_t gid; }; /* in-core nodes iterator */ diff --git a/libexfat/mount.c b/libexfat/mount.c index 5d449d3..6446edc 100644 --- a/libexfat/mount.c +++ b/libexfat/mount.c @@ -63,6 +63,9 @@ static void parse_options(struct exfat* ef, const char* options) opt_umask = get_int_option(options, "umask", 8, sys_umask); ef->dmask = get_int_option(options, "dmask", 8, opt_umask) & 0777; ef->fmask = get_int_option(options, "fmask", 8, opt_umask) & 0777; + + ef->uid = get_int_option(options, "uid", 10, geteuid()); + ef->gid = get_int_option(options, "gid", 10, getegid()); } int exfat_mount(struct exfat* ef, const char* spec, const char* options) diff --git a/libexfat/utils.c b/libexfat/utils.c index 04d39f3..77c8d24 100644 --- a/libexfat/utils.c +++ b/libexfat/utils.c @@ -21,6 +21,8 @@ void exfat_stat(const struct exfat* ef, const struct exfat_node* node, else stbuf->st_mode = S_IFREG | (0777 & ~ef->fmask); stbuf->st_nlink = 1; + stbuf->st_uid = ef->uid; + stbuf->st_gid = ef->gid; stbuf->st_size = node->size; stbuf->st_blocks = DIV_ROUND_UP(node->size, CLUSTER_SIZE(*ef->sb)) * CLUSTER_SIZE(*ef->sb) / 512;