X-Git-Url: http://git.sven.stormbind.net/?a=blobdiff_plain;f=fuse%2Fmain.c;h=9155912ea1f1a21227fb86eea15953ae76296ff0;hb=aa6bcd9c79094ec382ae0aa3338aea1b69cb9234;hp=fe5666beabab1fe0657ef670aa7ed357a8829fc3;hpb=65e85a0acdb22bd25386f4fe9cde50c66339a496;p=sven%2Ffuse-exfat.git diff --git a/fuse/main.c b/fuse/main.c index fe5666b..9155912 100644 --- a/fuse/main.c +++ b/fuse/main.c @@ -37,7 +37,7 @@ #error FUSE 2.6 or later is required #endif -const char* default_options = "allow_other,blkdev"; +const char* default_options = "ro_fallback,allow_other,blkdev"; struct exfat ef; @@ -153,14 +153,14 @@ static int fuse_exfat_read(const char* path, char* buffer, size_t size, off_t offset, struct fuse_file_info* fi) { exfat_debug("[fuse_exfat_read] %s (%zu bytes)", path, size); - return exfat_read(&ef, get_node(fi), buffer, size, offset); + return exfat_generic_pread(&ef, get_node(fi), buffer, size, offset); } static int fuse_exfat_write(const char* path, const char* buffer, size_t size, off_t offset, struct fuse_file_info* fi) { exfat_debug("[fuse_exfat_write] %s (%zu bytes)", path, size); - return exfat_write(&ef, get_node(fi), buffer, size, offset); + return exfat_generic_pwrite(&ef, get_node(fi), buffer, size, offset); } static int fuse_exfat_unlink(const char* path) @@ -426,6 +426,16 @@ int main(int argc, char* argv[]) return 1; } + if (ef.ro_fallback) + { + mount_options = add_option(mount_options, "ro", NULL); + if (mount_options == NULL) + { + exfat_unmount(&ef); + return 1; + } + } + mount_options = add_fuse_options(mount_options, spec); if (mount_options == NULL) {