Make VFS op "streaminfo" stackable
Frank Lahm
franklahm at googlemail.com
Fri Aug 26 07:25:26 MDT 2011
Hi,
2011/8/25 Volker Lendecke <Volker.Lendecke at sernet.de>:
> 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.
*ouch*, indeed.
> 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.
I'm currently starring at struct vfs_handle_struct trying to come up
with anything that could be used to determine inside
smb_vfs_call_streaminfo() whether it has been called through
SMB_VFS_STREAMINFO (which should do the initialisation) or
SMB_VFS_NEXT_STREAMINFO. Afaict there's no such member, is there? If
not I'll pick up your idea.
Thanks!
-f
More information about the samba-technical
mailing list