Het real path of a share.

simo idra at samba.org
Wed Feb 13 14:20:05 MST 2013


On Wed, 2013-02-13 at 16:00 +0100, Stef Bon wrote:
> Hi,
> 
> I'm writing a fs notify system (notifyfs) which I want to work with
> network filesystems like sshfs, cifs and nfs.
> 
> The alpha version (under linux) is right now working with sshfs, and
> should work with nfs.
> 
> It does that by not only setting a "system watch" on the localhost on
> behalv of the client (under linux this means a inotify watch), but by
> also forwarding the watch to the notifyfs service on the same host on
> which the nfs, ssh or smb server is running.
> 
> This "server notifyfs service" is then watching the backend (again by
> using inotify) and sends anything interesting back to the notifyfs
> service on the host which send the watch in the first place.
> 
> Now with sshfs and nfs this is easy. I'm using some sort of url
> notation (not a official format!) like sshfs:sbon@%HOME%, sshfs:/,
> nfs:/home.
> 
> (the %HOME% template is required since the ssh server exports the home
> directory when no directory is specified)
> 
> This url is send to the notifyfs on the server, where it is translated
> to a real path.
> 
> With cifs I use the following format:
> 
> cifs:/public/some/path
> 
> where public is the name of the share.
> 
> Is it possible to parse this name and get the path, besides just
> parsing the smb.conf directory?

Please do not invent your own URL scheme, there is an old draft that you
should probably use here:
https://tools.ietf.org/id/draft-crhertel-smb-url-12.txt

If you use this scheme you'll be able to correctly parse the URL.

As for your request, I guess what you are asking is if you can obtain
the actual path on the file server and not the path relative to the
share.

The answer is 'maybe', it depends on the share and whether there are vfs
modules loaded. In a samba server a share can even be completely
synthetic.
Besides there is no need for something like notifyfs for the cifs
protocol, because the protocol already handles notifications on it's
own, and done the right way (with proper access control and semantics)

Simo.

-- 
Simo Sorce
Samba Team GPL Compliance Officer <simo at samba.org>
Principal Software Engineer at Red Hat, Inc. <simo at redhat.com>



More information about the samba-technical mailing list