[Ocfs2-devel] [PATCH 2/2] Ocfs2: Add new OCFS2_IOC_INFO ioctl for ocfs2 v6.

Joel Becker Joel.Becker at oracle.com
Fri Apr 16 17:11:39 PDT 2010


On Fri, Apr 16, 2010 at 03:26:14PM -0700, Sunil Mushran wrote:
> Or, you could take it a step further and make some macros. Keep these
> macros in close proximity to these functions.
> 
> #define _ocfs2_from_user(a, b)  \      
>                 copy_from_user(&(a), (a), typeof(a))
> 
> #define _ocfs2_to_user(a, b)    \      
>                 copy_to_user((typeof(a) __user *)b, &(a), sizeof(a))
> 
>         if (_ocfs2_from_user(oic, req))
>                 goto bail;
> 
>         if (_ocfs2_to_user(oic, req))
>                 goto bail;

	Give them a more specific name; no one should thing they are
generic c-t-u functions.  ocfs2-info-to-user?  bonus if they handle the
info types automagically.

Joel
-- 

"Born under a bad sign.
 I been down since I began to crawl.
 If it wasn't for bad luck,
 I wouldn't have no luck at all."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127



More information about the Ocfs2-devel mailing list