Whamcloud - gitweb
LU-1081 fid: define special FID for BFL
[fs/lustre-release.git] / lustre / ptlrpc / wiretest.c
index 002e61a..6a6e7d9 100644 (file)
@@ -28,9 +28,8 @@
 /*
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
- */
-/*
- * Copyright (c) 2011 Whamcloud, Inc.
+ *
+ * Copyright (c) 2011, 2012, Whamcloud, Inc.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
 # endif
 # ifdef CONFIG_FS_POSIX_ACL
 #  include <linux/fs.h>
-#  ifdef HAVE_XATTR_ACL
-#   include <linux/xattr_acl.h>
-#  else
-#   define xattr_acl_entry  posix_acl_xattr_entry
-#   define xattr_acl_header posix_acl_xattr_header
-#  endif
-#  ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
-#   include <linux/posix_acl_xattr.h>
-#  endif
+#  include <linux/posix_acl_xattr.h>
 # endif
 #endif
 
@@ -68,8 +59,8 @@ void lustre_assert_wire_constants(void)
 {
         /* Wire protocol assertions generated by 'wirecheck'
          * (make -C lustre/utils newwiretest)
-         * running on Linux RHEL5 2.6.18-238.9.1 #1 SMP i686 i386 GNU/Linux
-         * with gcc version 4.1.1 20070105 (Red Hat 4.1.1-52) */
+         * running on Linux centos5 2.6.18-238.9.1.el5-head #2 SMP Wed Jun 29 18:35:58 CEST 2011 x86_
+         * with gcc version 4.1.2 20080704 (Red Hat 4.1.2-46) */
 
 
         /* Constants... */
@@ -347,6 +338,9 @@ void lustre_assert_wire_constants(void)
         CLASSERT(LDLM_FLOCK == 12);
         CLASSERT(LDLM_IBITS == 13);
         CLASSERT(LDLM_MAX_TYPE == 14);
+        CLASSERT(LUSTRE_RES_ID_SEQ_OFF == 0);
+        CLASSERT(LUSTRE_RES_ID_VER_OID_OFF == 1);
+        CLASSERT(LUSTRE_RES_ID_HSH_OFF == 3);
         LASSERTF(OBD_PING == 400, "found %lld\n",
                  (long long)OBD_PING);
         LASSERTF(OBD_LOG_CANCEL == 401, "found %lld\n",
@@ -383,6 +377,12 @@ void lustre_assert_wire_constants(void)
                  (long long)SEC_CTX_FINI);
         LASSERTF(SEC_LAST_OPC == 804, "found %lld\n",
                  (long long)SEC_LAST_OPC);
+        LASSERTF(LDF_EMPTY == 1, " found %lld\n",
+                 (long long)LDF_EMPTY);
+        LASSERTF(LDF_COLLIDE == 2, " found %lld\n",
+                 (long long)LDF_COLLIDE);
+        LASSERTF(LU_PAGE_SIZE == 4096, " found %lld\n",
+                 (long long)LU_PAGE_SIZE);
         /* Sizes and Offsets */
 
         /* Checks for struct obd_uuid */
@@ -494,11 +494,20 @@ void lustre_assert_wire_constants(void)
                  (long long)FID_SEQ_LOCAL_FILE);
         LASSERTF(FID_SEQ_DOT_LUSTRE == 0x0000000200000002ULL, "found 0x%.16llxULL\n",
                  (long long)FID_SEQ_DOT_LUSTRE);
+        LASSERTF(FID_SEQ_SPECIAL == 0x0000000200000004ULL, "found 0x%.16llxULL\n",
+                 (long long)FID_SEQ_SPECIAL);
         LASSERTF(FID_SEQ_NORMAL == 0x0000000200000400ULL, "found 0x%.16llxULL\n",
                  (long long)FID_SEQ_NORMAL);
         LASSERTF(FID_SEQ_LOV_DEFAULT == 0xffffffffffffffffULL, "found 0x%.16llxULL\n",
                  (long long)FID_SEQ_LOV_DEFAULT);
 
+        LASSERTF(FID_OID_SPECIAL_BFL == 0x00000001UL, "found 0x%.8xUL\n",
+                 (unsigned)FID_OID_SPECIAL_BFL);
+        LASSERTF(FID_OID_DOT_LUSTRE == 0x00000001UL, "found 0x%.8xUL\n",
+                 (unsigned)FID_OID_DOT_LUSTRE);
+        LASSERTF(FID_OID_DOT_LUSTRE_OBF == 0x00000002UL, "found 0x%.8xUL\n",
+                 (unsigned)FID_OID_DOT_LUSTRE_OBF);
+
         /* Checks for struct lu_dirent */
         LASSERTF((int)sizeof(struct lu_dirent) == 32, "found %lld\n",
                  (long long)(int)sizeof(struct lu_dirent));
@@ -807,15 +816,23 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct obd_connect_data, ocd_ibits_known));
         LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_ibits_known) == 8, "found %lld\n",
                  (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_ibits_known));
-        LASSERTF((int)offsetof(struct obd_connect_data, ocd_nllu) == 32, "found %lld\n",
-                 (long long)(int)offsetof(struct obd_connect_data, ocd_nllu));
-        LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_nllu) == 4, "found %lld\n",
-                 (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_nllu));
-        LASSERTF((int)offsetof(struct obd_connect_data, ocd_nllg) == 36, "found %lld\n",
-                 (long long)(int)offsetof(struct obd_connect_data, ocd_nllg));
-        LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_nllg) == 4, "found %lld\n",
-                 (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_nllg));
-        LASSERTF((int)offsetof(struct obd_connect_data, ocd_transno) == 40, "found %lld\n",
+        LASSERTF((int)offsetof(struct obd_connect_data, ocd_blocksize) == 32, " found %lld\n",
+                 (long long)(int)offsetof(struct obd_connect_data, ocd_blocksize));
+        LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_blocksize) == 1, " found %lld\n",
+                 (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_blocksize));
+        LASSERTF((int)offsetof(struct obd_connect_data, ocd_inodespace) == 33, " found %lld\n",
+                 (long long)(int)offsetof(struct obd_connect_data, ocd_inodespace));
+        LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_inodespace) == 1, " found %lld\n",
+                 (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_inodespace));
+        LASSERTF((int)offsetof(struct obd_connect_data, ocd_grant_extent) == 34, " found %lld\n",
+                 (long long)(int)offsetof(struct obd_connect_data, ocd_grant_extent));
+        LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_grant_extent) == 2, " found %lld\n",
+                 (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_grant_extent));
+        LASSERTF((int)offsetof(struct obd_connect_data, ocd_unused) == 36, " found %lld\n",
+                 (long long)(int)offsetof(struct obd_connect_data, ocd_unused));
+        LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_unused) == 4, " found %lld\n",
+                 (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_unused));
+        LASSERTF((int)offsetof(struct obd_connect_data, ocd_transno) == 40, " found %lld\n",
                  (long long)(int)offsetof(struct obd_connect_data, ocd_transno));
         LASSERTF((int)sizeof(((struct obd_connect_data *)0)->ocd_transno) == 8, "found %lld\n",
                  (long long)(int)sizeof(((struct obd_connect_data *)0)->ocd_transno));
@@ -896,6 +913,8 @@ void lustre_assert_wire_constants(void)
         LASSERTF((int)sizeof(((struct obd_connect_data *)0)->paddingE) == 8, "found %lld\n",
                  (long long)(int)sizeof(((struct obd_connect_data *)0)->paddingE));
         LASSERTF((int)offsetof(struct obd_connect_data, paddingF) == 184, "found %lld\n",
+                 (long long)(int)offsetof(struct obd_connect_data, paddingF));
+        LASSERTF((int)sizeof(((struct obd_connect_data *)0)->paddingF) == 8, "found %lld\n",
                  (long long)(int)sizeof(((struct obd_connect_data *)0)->paddingF));
 
         LASSERTF(OBD_CONNECT_RDONLY == 0x1ULL, "found 0x%.16llxULL\n",
@@ -980,6 +999,12 @@ void lustre_assert_wire_constants(void)
                  OBD_CONNECT_MAXBYTES);
         LASSERTF(OBD_CONNECT_IMP_RECOV == 0x10000000000ULL, "found 0x%.16llxULL\n",
                  OBD_CONNECT_IMP_RECOV);
+        LASSERTF(OBD_CONNECT_JOBSTATS ==  0x20000000000ULL, "found 0x%.16llxULL\n",
+                 OBD_CONNECT_JOBSTATS);
+        LASSERTF(OBD_CONNECT_GRANT_PARAM == 0x40000000000ULL, "found 0x%.16llxULL\n",
+                 OBD_CONNECT_GRANT_PARAM);
+        LASSERTF(OBD_CONNECT_EINPROGRESS == 0x80000000000ULL, "found 0x%.16llxULL\n",
+                 OBD_CONNECT_EINPROGRESS);
         LASSERTF(OBD_CKSUM_CRC32 == 0x00000001UL, "found 0x%.8xUL\n",
                  (unsigned)OBD_CKSUM_CRC32);
         LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n",
@@ -1090,10 +1115,10 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct obdo, o_gid_h));
         LASSERTF((int)sizeof(((struct obdo *)0)->o_gid_h) == 4, "found %lld\n",
                  (long long)(int)sizeof(((struct obdo *)0)->o_gid_h));
-        LASSERTF((int)offsetof(struct obdo, o_padding_3) == 176, "found %lld\n",
-                 (long long)(int)offsetof(struct obdo, o_padding_3));
-        LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_3) == 8, "found %lld\n",
-                 (long long)(int)sizeof(((struct obdo *)0)->o_padding_3));
+        LASSERTF((int)offsetof(struct obdo, o_data_version) == 176, " found %lld\n",
+                 (long long)(int)offsetof(struct obdo, o_data_version));
+        LASSERTF((int)sizeof(((struct obdo *)0)->o_data_version) == 8, " found %lld\n",
+                 (long long)(int)sizeof(((struct obdo *)0)->o_data_version));
         LASSERTF((int)offsetof(struct obdo, o_padding_4) == 184, "found %lld\n",
                  (long long)(int)offsetof(struct obdo, o_padding_4));
         LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_4) == 8, "found %lld\n",
@@ -1200,6 +1225,8 @@ void lustre_assert_wire_constants(void)
                  OBD_MD_FLRMTRSETFACL);
         LASSERTF(OBD_MD_FLRMTRGETFACL == (0x0008000000000000ULL), "found 0x%.16llxULL\n",
                  OBD_MD_FLRMTRGETFACL);
+        LASSERTF(OBD_MD_FLDATAVERSION == (0x0010000000000000ULL), "found 0x%.16llxULL\n",
+                 OBD_MD_FLDATAVERSION);
         CLASSERT(OBD_FL_INLINEDATA == 0x00000001);
         CLASSERT(OBD_FL_OBDMDEXISTS == 0x00000002);
         CLASSERT(OBD_FL_DELORPHAN == 0x00000004);
@@ -1267,8 +1294,12 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_size));
         LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_stripe_count) == 28, "found %lld\n",
                  (long long)(int)offsetof(struct lov_mds_md_v1, lmm_stripe_count));
-        LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_count) == 4, "found %lld\n",
+        LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_count) == 2, " found %lld\n",
                  (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_count));
+        LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_layout_gen) == 30, "found %lld\n",
+                 (long long)(int)offsetof(struct lov_mds_md_v1, lmm_layout_gen));
+        LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_layout_gen) == 2, " found %lld\n",
+                 (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_layout_gen));
         LASSERTF((int)offsetof(struct lov_mds_md_v1, lmm_objects[0]) == 32, "found %lld\n",
                  (long long)(int)offsetof(struct lov_mds_md_v1, lmm_objects[0]));
         LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_objects[0]) == 24, "found %lld\n",
@@ -1300,8 +1331,12 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_stripe_size));
         LASSERTF((int)offsetof(struct lov_mds_md_v3, lmm_stripe_count) == 28, "found %lld\n",
                  (long long)(int)offsetof(struct lov_mds_md_v3, lmm_stripe_count));
-        LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_stripe_count) == 4, "found %lld\n",
+        LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_stripe_count) == 2, " found %lld\n",
                  (long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_stripe_count));
+        LASSERTF((int)offsetof(struct lov_mds_md_v3, lmm_layout_gen) == 30, "found %lld\n",
+                 (long long)(int)offsetof(struct lov_mds_md_v3, lmm_layout_gen));
+        LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_layout_gen) == 2, " found %lld\n",
+                 (long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_layout_gen));
         CLASSERT(LOV_MAXPOOLNAME == 16);
         LASSERTF((int)offsetof(struct lov_mds_md_v3, lmm_pool_name[16]) == 48, "found %lld\n",
                  (long long)(int)offsetof(struct lov_mds_md_v3, lmm_pool_name[16]));
@@ -1778,6 +1813,8 @@ void lustre_assert_wire_constants(void)
                  MDS_INODELOCK_UPDATE);
         LASSERTF(MDS_INODELOCK_OPEN == 0x000004, "found 0x%.8x\n",
                  MDS_INODELOCK_OPEN);
+        LASSERTF(MDS_INODELOCK_LAYOUT == 0x000008, "found 0x%.8x\n",
+                 MDS_INODELOCK_LAYOUT);
 
         /* Checks for struct mdt_ioepoch */
         LASSERTF((int)sizeof(struct mdt_ioepoch) == 24, "found %lld\n",
@@ -3729,32 +3766,42 @@ void lustre_assert_wire_constants(void)
 #ifdef LIBLUSTRE_POSIX_ACL
 
         /* Checks for type posix_acl_xattr_entry */
-        LASSERTF((int)sizeof(xattr_acl_entry) == 8, "found %lld\n",
-                 (long long)(int)sizeof(xattr_acl_entry));
-        LASSERTF((int)offsetof(xattr_acl_entry, e_tag) == 0, "found %lld\n",
-                 (long long)(int)offsetof(xattr_acl_entry, e_tag));
-        LASSERTF((int)sizeof(((xattr_acl_entry *)0)->e_tag) == 2, "found %lld\n",
-                 (long long)(int)sizeof(((xattr_acl_entry *)0)->e_tag));
-        LASSERTF((int)offsetof(xattr_acl_entry, e_perm) == 2, "found %lld\n",
-                 (long long)(int)offsetof(xattr_acl_entry, e_perm));
-        LASSERTF((int)sizeof(((xattr_acl_entry *)0)->e_perm) == 2, "found %lld\n",
-                 (long long)(int)sizeof(((xattr_acl_entry *)0)->e_perm));
-        LASSERTF((int)offsetof(xattr_acl_entry, e_id) == 4, "found %lld\n",
-                 (long long)(int)offsetof(xattr_acl_entry, e_id));
-        LASSERTF((int)sizeof(((xattr_acl_entry *)0)->e_id) == 4, "found %lld\n",
-                 (long long)(int)sizeof(((xattr_acl_entry *)0)->e_id));
+        LASSERTF((int)sizeof(posix_acl_xattr_entry) == 8, "found %lld\n",
+                 (long long)(int)sizeof(posix_acl_xattr_entry));
+        LASSERTF((int)offsetof(posix_acl_xattr_entry, e_tag) == 0,
+                 "found %lld\n",
+                 (long long)(int)offsetof(posix_acl_xattr_entry, e_tag));
+        LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_tag) == 2,
+                 "found %lld\n",
+                 (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_tag));
+        LASSERTF((int)offsetof(posix_acl_xattr_entry, e_perm) == 2,
+                 "found %lld\n",
+                 (long long)(int)offsetof(posix_acl_xattr_entry, e_perm));
+        LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_perm) == 2,
+                 "found %lld\n",
+                 (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_perm));
+        LASSERTF((int)offsetof(posix_acl_xattr_entry, e_id) == 4,
+                 "found %lld\n",
+                 (long long)(int)offsetof(posix_acl_xattr_entry, e_id));
+        LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_id) == 4,
+                 "found %lld\n",
+                 (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_id));
 
         /* Checks for type posix_acl_xattr_header */
-        LASSERTF((int)sizeof(xattr_acl_header) == 4, "found %lld\n",
-                 (long long)(int)sizeof(xattr_acl_header));
-        LASSERTF((int)offsetof(xattr_acl_header, a_version) == 0, "found %lld\n",
-                 (long long)(int)offsetof(xattr_acl_header, a_version));
-        LASSERTF((int)sizeof(((xattr_acl_header *)0)->a_version) == 4, "found %lld\n",
-                 (long long)(int)sizeof(((xattr_acl_header *)0)->a_version));
-        LASSERTF((int)offsetof(xattr_acl_header, a_entries) == 4, "found %lld\n",
-                 (long long)(int)offsetof(xattr_acl_header, a_entries));
-        LASSERTF((int)sizeof(((xattr_acl_header *)0)->a_entries) == 0, "found %lld\n",
-                 (long long)(int)sizeof(((xattr_acl_header *)0)->a_entries));
+        LASSERTF((int)sizeof(posix_acl_xattr_header) == 4, "found %lld\n",
+                 (long long)(int)sizeof(posix_acl_xattr_header));
+        LASSERTF((int)offsetof(posix_acl_xattr_header, a_version) == 0,
+                 "found %lld\n",
+                 (long long)(int)offsetof(posix_acl_xattr_header, a_version));
+        LASSERTF((int)sizeof(((posix_acl_xattr_header *)0)->a_version) == 4,
+                 "found %lld\n",
+                 (long long)(int)sizeof(((posix_acl_xattr_header *)0)->a_version));
+        LASSERTF((int)offsetof(posix_acl_xattr_header, a_entries) == 4,
+                 "found %lld\n",
+                 (long long)(int)offsetof(posix_acl_xattr_header, a_entries));
+        LASSERTF((int)sizeof(((posix_acl_xattr_header *)0)->a_entries) == 0,
+                 "found %lld\n",
+                 (long long)(int)sizeof(((posix_acl_xattr_header *)0)->a_entries));
 #endif
 
         /* Checks for struct link_ea_header */