[Ocfs2-commits] jlbec commits r1740 - branches/kabi/cluster
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Wed Jan 5 13:13:14 CST 2005
Author: jlbec
Date: 2005-01-05 13:13:13 -0600 (Wed, 05 Jan 2005)
New Revision: 1740
Modified:
branches/kabi/cluster/o2cb_kabi.h
Log:
o Make the o2cb_kabi_verify() macro readable.
Modified: branches/kabi/cluster/o2cb_kabi.h
===================================================================
--- branches/kabi/cluster/o2cb_kabi.h 2005-01-05 02:44:21 UTC (rev 1739)
+++ branches/kabi/cluster/o2cb_kabi.h 2005-01-05 19:13:13 UTC (rev 1740)
@@ -90,18 +90,21 @@
*
* If 'size' is bad, -EINVAL is returned. Otherwise, the caller
* must check ki_status for any ABI errors.
+ *
+ * This is a macro for the use of typeof().
*/
#define o2cb_kabi_verify(k, member, size) ({ \
typeof(k) _k = (k); \
struct o2cb_kabi_info *_i = &(_k->member); \
- int _rc = \
- (_i->ki_size != (size)) ? -EINVAL : \
- ((_i->ki_magic != O2CB_KABI_MAGIC) ? \
- O2CB_KE_BAD_MAGIC : \
- ((_i->ki_version != O2CB_KABI_VERSION) ? \
- O2CB_KE_INVALID_ABI_VERSION : \
- ((_i->ki_size != sizeof(typeof(*_k))) ? \
- O2CB_KE_INVALID_REQUEST_SIZE : 0))); \
+ int _rc = 0; \
+ if (_i->ki_size != (size)) \
+ _rc = -EINVAL; \
+ else if (_i->ki_magic != O2CB_KABI_MAGIC) \
+ _rc = O2CB_KE_BAD_MAGIC; \
+ else if (_i->ki_version != O2CB_KABI_VERSION) \
+ _rc = O2CB_KE_INVALID_ABI_VERSION; \
+ else if (_i->ki_size != sizeof(typeof(*_k))) \
+ _rc = O2CB_KE_INVALID_REQUEST_SIZE; \
if (_rc != -EINVAL) { \
_i->ki_status = _rc; \
_rc = 0; \
@@ -117,6 +120,8 @@
*
* Fills the struct o2cb_kabi_info part of the structure with the
* appropriate magic numbers and sizes.
+ *
+ * This is a macro for the use of typeof().
*/
#define o2cb_kabi_init(k, member, op) ({ \
typeof(k) _k = (k); \
More information about the Ocfs2-commits
mailing list