From: relan Date: Thu, 4 May 2017 06:25:39 +0000 (+0300) Subject: Wrap platform-specific FUSE options. X-Git-Tag: android-x86-9.0-r1~31 X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fexternal-exfat.git;a=commitdiff_plain;h=68524e0a51246bba984fce28fc5b23aee0dbd2e0 Wrap platform-specific FUSE options. fuse_main() fails on unrecognized options. --- diff --git a/fuse/main.c b/fuse/main.c index b99a341..17bd1ff 100644 --- a/fuse/main.c +++ b/fuse/main.c @@ -449,6 +449,7 @@ static char* add_ro_option(char* options, bool ro) return ro ? add_option(options, "ro", NULL) : options; } +#if defined(__linux__) || defined(__FreeBSD__) static char* add_user_option(char* options) { struct passwd* pw; @@ -465,7 +466,9 @@ static char* add_user_option(char* options) } return add_option(options, "user", pw->pw_name); } +#endif +#if defined(__linux__) static char* add_blksize_option(char* options, long cluster_size) { long page_size = sysconf(_SC_PAGESIZE); @@ -477,6 +480,7 @@ static char* add_blksize_option(char* options, long cluster_size) snprintf(blksize, sizeof(blksize), "%ld", MIN(page_size, cluster_size)); return add_option(options, "blksize", blksize); } +#endif static char* add_fuse_options(char* options, const char* spec, bool ro) { @@ -486,13 +490,16 @@ static char* add_fuse_options(char* options, const char* spec, bool ro) options = add_ro_option(options, ro); if (options == NULL) return NULL; +#if defined(__linux__) || defined(__FreeBSD__) options = add_user_option(options); if (options == NULL) return NULL; +#endif +#if defined(__linux__) options = add_blksize_option(options, CLUSTER_SIZE(*ef.sb)); if (options == NULL) return NULL; - +#endif return options; } @@ -515,8 +522,12 @@ int main(int argc, char* argv[]) printf("FUSE exfat %s\n", VERSION); fuse_options = strdup("allow_other," +#if defined(__linux__) || defined(__FreeBSD__) "big_writes," +#endif +#if defined(__linux__) "blkdev," +#endif "default_permissions"); exfat_options = strdup("ro_fallback"); if (fuse_options == NULL || exfat_options == NULL)