Proposed change to the vfs.h to simplify call_xxx routines

Richard Sharpe realrichardsharpe at gmail.com
Sat Dec 10 18:43:33 MST 2011


Hi folks,

here is a change I am proposing:

diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index d32aafd..7a7030a 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -164,6 +164,11 @@ struct dfs_GetDFSReferral;
                                handle = handle->next; \
                         }

+#define VFS_FIND_CALL(__fn__, ...) while (handle->fns->__fn__##_fn==NULL) {\
+                                       handle=handle->next; \
+                                  } \
+                                  return handle->fns->__fn__##_fn(__VA_ARGS__);
+
 enum vfs_translate_direction {
        vfs_translate_to_unix = 0,
        vfs_translate_to_windows

This will simplify:

int smb_vfs_call_connect(struct vfs_handle_struct *handle,
                         const char *service, const char *user)
{
        VFS_FIND(connect);
        return handle->fns->connect_fn(handle, service, user);
}

to:

int smb_vfs_call_connect(struct vfs_handle_struct *handle,
                         const char *service, const char *user)
{
        VFS_FIND_call(connect, handle, service, user);
}


-- 
Regards,
Richard Sharpe


More information about the samba-technical mailing list