VFS Module Docs & Examples

Uri Simchoni uri at samba.org
Tue Jul 31 17:26:13 UTC 2018


On 07/31/2018 07:55 PM, Richard Sharpe via samba-technical wrote:
> 
> Yes, it makes sense. If the files are not in a local file system then
> you have to implement every VFS function and provide the correct steps
> for your file system. In some cases you may need to return ENOSYS.
> 
> As Jeremy says, look at the module for CEPH or GlusterFS.
> 
I think I can sympathize with the confusion around path names, and I
don't think ceph or gluster help with that because the VFS module hands
the work to the ceph/gluster lib, and they magically do what smbd expects.

You need to have some minimal support for absolute paths. IIRC:
1. configure the path of the share with some made-up absolute path
/my/bogus/path
2. Maintain a state variable of your current "cloud" working directory
3. when asked to do a chdir:
a. If it's absolute, and the path is a child of /my/bogus/path, adjust
your cloud cwd accordingly (e.g. if it's "/my/bogus/path/foo" the you're
at "foo") You get /my/bogus/path with handle->conn->connectpath.
b. If it's relative, append the path to your your cloud cwd (if you're
at "foo" and chdir into "bar/baz" then you're at "foo/bar/baz")
c. otherwise you don't know how to handle it - return an error.
4. Any path operation is relative to your cloud cwd (if asked to open
"bar" and the cloud cwd is "foo" then open "foo/bar")
5. When asked what's the current directory, append the cloud wd to
/my/bogus/path.

I think that about covers it, plus all the other advice you were give
about implementing everything.

Oh, I now see Jeremy has already answered with a somewhat different
answer - I suppose my algorithm above can be simplified with setting the
share path to / and then if the path is absolute just remove the leading /.

Thanks,
Uri.



More information about the samba-technical mailing list