From: resver Date: Sun, 20 Feb 2011 10:32:39 +0000 (+0000) Subject: Added blksize option that should solve "Invalid argument" error while mounting a... X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=9086e866acf6592f03c6356df8f23984a6057eca;p=android-x86%2Fexternal-exfat.git Added blksize option that should solve "Invalid argument" error while mounting a volume from a disk with sector size greater than 512 bytes. git-svn-id: http://exfat.googlecode.com/svn/trunk@207 60bc1c72-a15a-11de-b98f-4500b42dc123 --- diff --git a/fuse/main.c b/fuse/main.c index 67c94f4..05ee725 100644 --- a/fuse/main.c +++ b/fuse/main.c @@ -335,6 +335,18 @@ static char* add_user_option(char* options) return add_option(options, "user", pw->pw_name); } +static char* add_blksize_option(char* options, long cluster_size) +{ + long page_size = sysconf(_SC_PAGESIZE); + char blksize[20]; + + if (page_size < 1) + page_size = 0x1000; + + snprintf(blksize, sizeof(blksize), "%ld", MIN(page_size, cluster_size)); + return add_option(options, "blksize", blksize); +} + int main(int argc, char* argv[]) { struct fuse_args mount_args = FUSE_ARGS_INIT(0, NULL); @@ -404,6 +416,12 @@ int main(int argc, char* argv[]) exfat_unmount(&ef); return 1; } + mount_options = add_blksize_option(mount_options, CLUSTER_SIZE(*ef.sb)); + if (mount_options == NULL) + { + exfat_unmount(&ef); + return 1; + } /* create arguments for fuse_mount() */ if (fuse_opt_add_arg(&mount_args, "exfat") != 0 ||