Make VFS op "streaminfo" stackable

Frank Lahm franklahm at googlemail.com
Thu Aug 25 07:56:54 MDT 2011


Hi,

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.

Thanks!
-f


More information about the samba-technical mailing list