VFS Question: Is there more vfs_ops then are in skel ?
Mike Gerdts
Michael.Gerdts at alcatel.com
Sat May 11 05:18:01 GMT 2002
On Fri, 2002-05-10 at 17:12, troutb at abclabs.com wrote:
> I want to make a cp instead of rename when a file is open for rewrite
>
> is there a default_vfs_ops.cp ?
> or can I just make my own calls ?
> can I write the file somewhere is on the file system?
>
> I'm new at this, but would like to help out the cause while I help myself.
>
> Basically, I trying to create a feautre that would do versioning .. most
> likely in seperate read only location.
>
> help ?
What you probably want to do is create a vfs module that only takes care
of rename. Your module's rename function (your_rename())will look quite
similar to source/smbd/vfs-wrap.c's vfswrap_rename(), except that it
will always call copy_reg() and will never call rename() (except for
perhaps when you are creating your backup copy). Be sure to handle the
case of a directory rename gracefully... do you really want to do
version control when someone renames w:\win98_cd to w:\win98_sr2?
If you need extra calls to be called from within your_rename(), you can
define them within your vfs module, just as copy_reg() is defined in
vfs-wrap.c. Just be sure to make any extra functions that you declare
static else they may have symbol conflicts with existing samba code or
future vfs modules.
Note, however, that for a function to be called directly from smbd, it
must be referenced in your module's vfs_ops structure. For example,
when using the default vfs functions, vfs_ops->rename() is really
vfswrap_rename(). copy_reg() is only called from within
vfswrap_rename().
Mike
More information about the samba-technical
mailing list