Make VFS op "streaminfo" stackable

Volker Lendecke Volker.Lendecke at SerNet.DE
Thu Aug 25 11:52:15 MDT 2011


On Thu, Aug 25, 2011 at 03:56:54PM +0200, Frank Lahm wrote:
> currently the VFS op "streaminfo" is not stackable, ie it's only
> possible to have one active VFS module to take care of streams, eg
> "streams_xattr".
> Now what I'm trying to do is enhance the Netatalk VFS module, so that
> it presents the Netatalk AppleDouble stuff as streams. But as I only
> want to implement dealing with the relevant streams in the Netatalk
> VFS mod, leaving all the rest to the "default" stream module
> (streams_xattr), I need to
> a) place the Netatalk VFS mod before streams_xattr
> b) patch the VFS base code and modules to make the streaminfo op stackable
> 
> Afaict, the following patch based on "v3-6-test" achieves b):
> 
> $ git diff
> diff --git a/source3/modules/vfs_streams_xattr.c
> b/source3/modules/vfs_streams_xattr.c
> index 34e01b0..e3cc822 100644
> --- a/source3/modules/vfs_streams_xattr.c
> +++ b/source3/modules/vfs_streams_xattr.c
> @@ -810,8 +810,8 @@ static NTSTATUS
> streams_xattr_streaminfo(vfs_handle_struct *handle,
>                 return map_nt_error_from_unix(errno);
>         }
> 
> -       state.streams = NULL;
> -       state.num_streams = 0;
> +       state.streams = *pstreams;
> +       state.num_streams = *pnum_streams;
> 
>         if (!S_ISDIR(sbuf.st_ex_mode)) {
>                 if (!add_one_stream(mem_ctx,
> diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
> index 35a8331..720bc4d 100644
> --- a/source3/smbd/vfs.c
> +++ b/source3/smbd/vfs.c
> @@ -1673,6 +1673,8 @@ NTSTATUS smb_vfs_call_streaminfo(struct
> vfs_handle_struct *handle,
>                                  struct stream_struct **streams)
>  {
>         VFS_FIND(streaminfo);
> +       *num_streams = 0;
> +       *streams = NULL;
>         return handle->fns->streaminfo(handle, fsp, fname, mem_ctx,
>                                        num_streams, streams);
>  }
> 
> I'll provide a complete patch covering all modules that implement the
> streaminfo VFS op, if I receive positive feedback for the basic idea.

The second hunk (smb_vfs_call_streaminfo) is wrong I think.
This is called every time a VFS module calls
SMB_VFS_NEXT_STREAMINFO, so you wipe out the info every time
you go down the stack. I would rather propose a wrapper
function for SMB_VFS_STREAMINFO that is called instead of
SMB_VFS_STREAMINFO in all the callers.

With best regards,

Volker Lendecke

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen


More information about the samba-technical mailing list