mafintosh/fuse-bindings

[Question]What is the meaning of file descriptor in FUSE?

mosfet1kg opened this issue · 3 comments

I tried to get fd by using below code.

ops.open = function (path, flags, cb) {
  var flag = toFlag(flags) // convert flags to a node style string
  ...
  const fd = fs.openSync(path);
}

But I think this code generates recursive call, so doesn't work against my expectation....
Can you tell me the meaning of fd in FUSE?

Thanks in advance...

You've gotta callback, cb(0,fd) otherwise it'll hang around in an unfortunate state.
A file descriptor to fuse is just mapped through to whatever you want it to be -- some integer.

This code is fairly advanced, but might be a fun read for you:
https://github.com/piranna/fs-fuse

This code is fairly advanced, but might be a fun read for you:
https://github.com/piranna/fs-fuse

Oh, it's mine! :-P

@Downchuck Thanks :)