Make VFS op "streaminfo" stackable

Frank Lahm franklahm at googlemail.com
Fri Aug 26 10:33:13 MDT 2011


Hi,

thanks for providing feedback!

2011/8/26 Volker Lendecke <Volker.Lendecke at sernet.de>:
> On Fri, Aug 26, 2011 at 03:53:12PM +0200, Frank Lahm wrote:
>> 2011/8/26 Frank Lahm <franklahm at googlemail.com>:
>> > 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.
>>
>> This should work, shouldn't it ?
>>
>>
>> diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
>> index 35a8331..c846174 100644
>> --- a/source3/smbd/vfs.c
>> +++ b/source3/smbd/vfs.c
>> @@ -1673,6 +1673,11 @@ NTSTATUS smb_vfs_call_streaminfo(struct
>> vfs_handle_struct *handle,
>>                                  struct stream_struct **streams)
>>  {
>>         VFS_FIND(streaminfo);
>> +       if (handle->prev->next == NULL) {
>> +               /* VFS op chain start */
>> +               *num_streams = 0;
>> +               *streams = NULL;
>> +       }
>>         return handle->fns->streaminfo(handle, fsp, fname, mem_ctx,
>>                                        num_streams, streams);
>>  }
>
> It might work, but I think this is the wrong layer. The
> semantics of the streaminfo call would be that every module
> adds its streams, otherwise you don't get stackability.

Yes, but imo this doesn't make an argument where the initialisation
has to be done: by the caller or by the callee. Following my approach
has the benefit that the caller mustn't remember to do any special
initialisation with streaminfo compared to other VFS ops (if any) that
return results via function parameters.

Thanks!
-f


More information about the samba-technical mailing list