Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added extra option to jsonfs for a better default behavior in ubuntu

  • Loading branch information...
commit 558a6cb2f3591e4402b4ce1e042e9116cfc149b8 1 parent 51a8559
@elwerene elwerene authored
Showing with 10 additions and 2 deletions.
  1. +0 −1  README.md
  2. +10 −1 example/jsonFS.js
View
1  README.md
@@ -37,7 +37,6 @@ This mounts the JSON file as a file system. In a another shell, you can browse a
* To dismount, make sure no processes remain under the file system path, and then type:
`fusermount -u /tmp/tutorial/mnt`
* Changes to the file system are discarded. If you want to save the modified data to a new JSON file, add the `-o outputJsonFilePath` option when starting the program.
-* If you have trouble with the jsonFS example, consider setting "user_allow_other" in /etc/fuse.conf, as some linux distributions need this as a requirement for the option "allow_others" as set in the jsonFS example.
Once you are comfortable with the sample program, you can move on to the second example, *mirrorFS.js*. It is equivalent to the fusexmp.c sample program that ships with the FUSE source code. As its name indicates, it maps an existing file system subtree to a mount point of your choice. It demonstrates more advanced features such as file handles. The syntax is:
`node fuse4js/example/mirrorFS.js <file_system_directory> <new_mount_point>`
View
11 example/jsonFS.js
@@ -476,6 +476,7 @@ function usage() {
console.log("Options:");
console.log("-o outputJsonFile : save modified data to new JSON file. Input file is never modified.");
console.log("-d : make FUSE print debug statements.");
+ console.log("-a : add allow_other option to mount (might need user_allow_other in system fuse config file).");
console.log();
console.log("Example:");
console.log("node example/jsonFS.fs -d -o /tmp/output.json example/sample.json /tmp/mnt");
@@ -504,6 +505,9 @@ function parseArgs() {
i += 2;
--remaining;
} else return false;
+ } else if (args[i] === '-a') {
+ options.allowOthers = true;
+ ++i;
} else return false;
}
return true;
@@ -522,7 +526,12 @@ function parseArgs() {
content = fs.readFileSync(options.inJson, 'utf8');
obj = JSON.parse(content);
try {
- f4js.start(options.mountPoint, handlers, options.debugFuse, ['-o', 'allow_other']);
+ var opts = [];
+ if (options.allowOthers) {
+ opts.push('-o');
+ opts.push('allow_other');
+ }
+ f4js.start(options.mountPoint, handlers, options.debugFuse, opts);
} catch (e) {
console.log("Exception when starting file system: " + e);
}
Please sign in to comment.
Something went wrong with that request. Please try again.