Making VFS Function pointer names more consistent

Volker Lendecke Volker.Lendecke at SerNet.DE
Sun Dec 4 02:16:15 MST 2011


On Sat, Dec 03, 2011 at 04:00:10PM -0800, Richard Sharpe wrote:
> Hi folks,
> 
> I have started working on making them all consistently <function_name>_fn.
> 
> In doing so, I changed VFS_FIND slightly to:
> 
> #define VFS_FIND(__fn__) while (handle->fns->__fn__##_fn==NULL) { \
>                                 handle = handle->next; \
>                          }
> 
> but this requires smbd/vfs.c to have code like:
> 
> int smb_vfs_call_open(struct vfs_handle_struct *handle,
>                       struct smb_filename *smb_fname, struct files_struct *fsp,
>                       int flags, mode_t mode)
> {
>         VFS_FIND(open);
>         return handle->fns->open_fn(handle, smb_fname, fsp, flags, mode);
> }
> 
> where "open" is used for VFS_FIND but the function is called via
> "open_fn", which is a small amount of additional inconsistency, and
> might cause unneeded postings on the mailing lists.
> 
> It struck me that that it might also be possible to define a macro
> that would eliminate the need to explicitly code the second line in
> all these functions, but then we might be at the mercy of the C
> preprocessors people are using.
> 
> Does anyone have any strong feelings one way or the other?
> 
> That is:
> 
> 1. Is it worth exploring a macro of the sort CALL_VFS_FN(fn_name,
> params ...) that would eliminate the need for the explicit call of the
> function above, and

Are variable-argument macros portable?

Volker

-- 
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
http://www.sernet.de, mailto:kontakt at sernet.de


More information about the samba-technical mailing list