Skip to content

Commit

Permalink
add -o options to fuse in a different way
Browse files Browse the repository at this point in the history
This is a bit more extendable for adding more options in the future.
  • Loading branch information
matthijskooijman committed Aug 6, 2012
1 parent d6ff40c commit df2d9fc
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion git-fs.c
Expand Up @@ -19,6 +19,9 @@
#include <linux/limits.h>
#endif

/* Macro to get the length of a static array */
#define lengthof(arr) (sizeof(arr) / sizeof(*arr))

char *gitfs_repo_path = NULL;
char *gitfs_rev = NULL;
git_oid gitfs_tree_oid;
Expand Down Expand Up @@ -498,13 +501,22 @@ int main(int argc, char *argv[])
git_tree_free(tree);
git_repository_free(repo);

char *opts = NULL; /* fuse_opt_add_opt will allocate this */

/* Force the mount to be read-only */
fuse_opt_insert_arg(&args, 1, "-oro");
fuse_opt_add_opt(&opts, "ro");

/* Force fuse to use single-threaded mode, since libgit2 is not
* yet thread-safe. */
fuse_opt_insert_arg(&args, 1, "-s");

/* Append the options collected in opts */
fuse_opt_insert_arg(&args, 1, "-o");
fuse_opt_insert_arg(&args, 2, opts);

free(opts);
opts = NULL;

/* Allow git_init to change our exit code */
retval = 0;
fuse_main(args.argc, args.argv, &gitfs_oper);
Expand Down

0 comments on commit df2d9fc

Please sign in to comment.