From: resver@gmail.com Date: Sat, 20 Apr 2013 10:34:48 +0000 (+0000) Subject: Allow arbitrary changing of lower 9 bits of mode. Allow owner/group changing to the... X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fexternal-exfat.git;a=commitdiff_plain;h=347324fa9d96c9fcd34aba988661da7151d83e9e Allow arbitrary changing of lower 9 bits of mode. Allow owner/group changing to the same owner/group. Remove "quiet" option. git-svn-id: http://exfat.googlecode.com/svn/trunk@353 60bc1c72-a15a-11de-b98f-4500b42dc123 --- diff --git a/fuse/main.c b/fuse/main.c index 284ec23..34b3ea6 100644 --- a/fuse/main.c +++ b/fuse/main.c @@ -39,11 +39,7 @@ #endif const char* default_options = "ro_fallback,allow_other,blkdev,big_writes," - "defer_permissions" -#ifdef __APPLE__ - ",quiet" -#endif - ; + "defer_permissions"; struct exfat ef; @@ -248,14 +244,21 @@ static int fuse_exfat_utimens(const char* path, const struct timespec tv[2]) static int fuse_exfat_chmod(const char* path, mode_t mode) { + const mode_t VALID_MODE_MASK = S_IFREG | S_IFDIR | + S_IRWXU | S_IRWXG | S_IRWXO; + exfat_debug("[%s] %s 0%ho", __func__, path, mode); - return ef.quiet ? 0 : -ENOSYS; + if (mode & ~VALID_MODE_MASK) + return -EPERM; + return 0; } static int fuse_exfat_chown(const char* path, uid_t uid, gid_t gid) { exfat_debug("[%s] %s %u:%u", __func__, path, uid, gid); - return ef.quiet ? 0 : -ENOSYS; + if (uid != ef.uid || gid != ef.gid) + return -EPERM; + return 0; } static int fuse_exfat_statfs(const char* path, struct statvfs* sfs) diff --git a/fuse/mount.exfat-fuse.8 b/fuse/mount.exfat-fuse.8 index ac36529..b7e9d56 100644 --- a/fuse/mount.exfat-fuse.8 +++ b/fuse/mount.exfat-fuse.8 @@ -77,12 +77,6 @@ Mount the file system in read only mode. .TP .BI noatime Do not update access time when file is read. -.TP -.BI quiet -Owner, group and mode attributes are not supported by the current -implementation, so chmod() and chown() requests fail with ENOSYS. This option -makes them always succeed, i.e. all requests to change owner, group or mode -will be silently ignored. Default on OS\ X. .SH EXIT CODES Zero is returned on successful mount. Any other code means an error. diff --git a/libexfat/exfat.h b/libexfat/exfat.h index 8a33afa..8596efd 100644 --- a/libexfat/exfat.h +++ b/libexfat/exfat.h @@ -106,7 +106,6 @@ struct exfat gid_t gid; int ro; bool noatime; - bool quiet; }; /* in-core nodes iterator */ diff --git a/libexfat/mount.c b/libexfat/mount.c index 0466639..ec4f52e 100644 --- a/libexfat/mount.c +++ b/libexfat/mount.c @@ -87,7 +87,6 @@ static void parse_options(struct exfat* ef, const char* options) ef->gid = get_int_option(options, "gid", 10, getegid()); ef->noatime = match_option(options, "noatime"); - ef->quiet = match_option(options, "quiet"); } static int verify_vbr_checksum(struct exfat_dev* dev, void* sector,