OSDN Git Service

Added blksize option that should solve "Invalid argument" error while mounting a...
authorresver <resver@60bc1c72-a15a-11de-b98f-4500b42dc123>
Sun, 20 Feb 2011 10:32:39 +0000 (10:32 +0000)
committerresver <resver@60bc1c72-a15a-11de-b98f-4500b42dc123>
Sun, 20 Feb 2011 10:32:39 +0000 (10:32 +0000)
git-svn-id: http://exfat.googlecode.com/svn/trunk@207 60bc1c72-a15a-11de-b98f-4500b42dc123

fuse/main.c

index 67c94f4..05ee725 100644 (file)
@@ -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 ||