[PATCH][SAMBA3] allow VFS modules to extend files_struct

Jeremy Allison jra at samba.org
Tue Jun 6 02:00:13 GMT 2006


On Tue, Jun 06, 2006 at 09:04:03AM +1000, James Peach wrote:
> 
> I'm quite hurt that you would call my code clever :)
> 
> I've converted 3 modules and this API turns out to be quite nice to
> use. 
> 
>         SMB_OFF_T * last;
>         if ((last = VFS_ADD_FSP_EXTENSION(handle, fsp, SMB_OFF_T)) {
>                 /* do stuff */
>         }
>         
> 
> You don't have to worry about the case where one allocation succeeds but
> the other fails, and the storage mechanism is completely hidden. I would
> like to borrow talloc's use of typeof to improve the type-safety,
> though.
> 
> Actually, I just realised that I can keep this API, but convert to using
> a void * and a separate allocation internally. That is,
> vfs_add_extension_notype would allocate the block and attach it to a
> data pointer in struct vfs_fsp_data. I'll be happy to make this change
> if you want, since it contains the multiple allocations in a single
> place.

Actually you've beaten me down. I can cope with clever code :-).

Thinking about it I'm actually good with whichever you decide on
this one. Thanks for all your effort on this !

> Yep, it's a side-effect of the process. I can explain the gory details
> offline if you really want to know (it's not that exciting though:)).

Yeah, but you can't check it in like that.... so you're still
waiting for final approval ?

Jeremy.


More information about the samba-technical mailing list