From: relan Date: Sat, 20 Apr 2013 10:01:24 +0000 (+0000) Subject: Add "quiet" option. X-Git-Tag: android-x86-6.0-r1~103 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=18293d535cc050f3d7cee0944cef591f44617631;hp=844805a38fd814ad2ff83dda7f9aad5c52838741;p=android-x86%2Fexternal-exfat.git Add "quiet" option. It makes chmod() and chown() always succeed. Useful for applications that fail if chmod() or chown() is not implemented. --- diff --git a/fuse/main.c b/fuse/main.c index 7a58b8e..284ec23 100644 --- a/fuse/main.c +++ b/fuse/main.c @@ -39,7 +39,11 @@ #endif const char* default_options = "ro_fallback,allow_other,blkdev,big_writes," - "defer_permissions"; + "defer_permissions" +#ifdef __APPLE__ + ",quiet" +#endif + ; struct exfat ef; @@ -242,14 +246,17 @@ static int fuse_exfat_utimens(const char* path, const struct timespec tv[2]) return 0; } -#ifdef __APPLE__ static int fuse_exfat_chmod(const char* path, mode_t mode) { exfat_debug("[%s] %s 0%ho", __func__, path, mode); - /* make OS X utilities happy */ - return 0; + return ef.quiet ? 0 : -ENOSYS; +} + +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; } -#endif static int fuse_exfat_statfs(const char* path, struct statvfs* sfs) { @@ -311,9 +318,8 @@ static struct fuse_operations fuse_exfat_ops = .mkdir = fuse_exfat_mkdir, .rename = fuse_exfat_rename, .utimens = fuse_exfat_utimens, -#ifdef __APPLE__ .chmod = fuse_exfat_chmod, -#endif + .chown = fuse_exfat_chown, .statfs = fuse_exfat_statfs, .init = fuse_exfat_init, .destroy = fuse_exfat_destroy, diff --git a/fuse/mount.exfat-fuse.8 b/fuse/mount.exfat-fuse.8 index 5200c10..2fd5feb 100644 --- a/fuse/mount.exfat-fuse.8 +++ b/fuse/mount.exfat-fuse.8 @@ -77,6 +77,12 @@ 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 8596efd..8a33afa 100644 --- a/libexfat/exfat.h +++ b/libexfat/exfat.h @@ -106,6 +106,7 @@ 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 ec4f52e..0466639 100644 --- a/libexfat/mount.c +++ b/libexfat/mount.c @@ -87,6 +87,7 @@ 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,