Whamcloud - gitweb
LU-4423 ptlrpc: incorporate BUILD_BUG_ON into ptlrpc_req_async_args()
[fs/lustre-release.git] / lustre / include / lustre_net.h
index cf9b7e3..aac45f2 100644 (file)
  */
 #define OST_IO_BUFSIZE         max_t(int, OST_IO_MAXREQSIZE + 1024, 64 * 1024)
 
-
-/* Macro to hide a typecast. */
-#define ptlrpc_req_async_args(req) ((void *)&req->rq_async_args)
+/* Macro to hide a typecast and BUILD_BUG. */
+#define ptlrpc_req_async_args(_var, req) ({                            \
+               BUILD_BUG_ON(sizeof(*_var) > sizeof(req->rq_async_args)); \
+               (typeof(_var))&req->rq_async_args;                      \
+       })
 
 struct ptlrpc_replay_async_args {
        int             praa_old_state;