OSDN Git Service

Implemented uid and gid mount options.
authorresver <resver@60bc1c72-a15a-11de-b98f-4500b42dc123>
Fri, 8 Jan 2010 08:50:08 +0000 (08:50 +0000)
committerresver <resver@60bc1c72-a15a-11de-b98f-4500b42dc123>
Fri, 8 Jan 2010 08:50:08 +0000 (08:50 +0000)
git-svn-id: http://exfat.googlecode.com/svn/trunk@94 60bc1c72-a15a-11de-b98f-4500b42dc123

libexfat/exfat.h
libexfat/mount.c
libexfat/utils.c

index 8b3e996..18d3bde 100644 (file)
@@ -71,6 +71,8 @@ struct exfat
        cmap;
        void* zero_block;
        int dmask, fmask;
+       uid_t uid;
+       gid_t gid;
 };
 
 /* in-core nodes iterator */
index 5d449d3..6446edc 100644 (file)
@@ -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)
index 04d39f3..77c8d24 100644 (file)
@@ -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;