directory path info in vfs readdir

Philip de Nier philip.denier at
Fri Apr 7 16:33:53 GMT 2006

At 16:26 07/04/2006, Jeremy Allison wrote:
>On Fri, Apr 07, 2006 at 10:32:35AM +0100, Philip de Nier wrote:
> >
> > Filtering files using directory path information was something to make my
> > application more robust and was not a hard requirement, so I'll stick with
> > the pre installed Samba code rather than require users to patch and
> > reinstall.
>I'm still a little unclear on exactly what you need smbd to do, could
>you explain what you're trying to achieve please ?

We have an application which stores it's data in a directory. It was not 
designed to share this data directory with other (even identical) 
applications. What we want to achieve through smbd and VFS is to share the 
directory but make it look like it is not shared. This results in a 
significant cost savings because we don't need to purchase the expensive 
alternative provided by the manufacturer.

The approach we take is basically as follows:

Each application has a database file that it stores in the directory, say 
"data.db". What we do is store a database file for each application with 
name "data.db_<ip address>_<username>", where <ip address> and <user name> 
are different for each application.

When an application gets a listing of the directory, the VFS layer converts 
the name of the file belonging to that application back to what the 
application expects it to be, ie. "data.db". It also skips the names 
belonging to the other applications. The reverse mapping happens when a 
client calls any of the other functions that has a path as parameter, eg. 
calling open on "data.db" is redirected to a call to open the application's 
database file.

The end effect is that each applications sees their own database file and 
is not adversely affected by other applications using the same directory.

There are similar things that we have done using FUSE, such as exposing the 
contents of a file as a directory of files, and we are looking at the 
possibility of implementing these using Samba VFS. FUSE has a different 
approach to opendir and readdir and makes it possible/easier to modify 
directory listings.


More information about the samba-technical mailing list