Whamcloud - gitweb
e0e725a206ea94b25b5867041ad319ef6569c5ef
[fs/lustre-release.git] / lustre / ptlrpc / pack_generic.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (C) 2001-2003 Cluster File Systems, Inc.
5  *   Author: Peter J. Braam <braam@clusterfs.com>
6  *   Author: Phil Schwan <phil@clusterfs.com>
7  *   Author: Eric Barton <eeb@clusterfs.com>
8  *
9  *   This file is part of Lustre, http://www.lustre.org.
10  *
11  *   Lustre is free software; you can redistribute it and/or
12  *   modify it under the terms of version 2 of the GNU General Public
13  *   License as published by the Free Software Foundation.
14  *
15  *   Lustre is distributed in the hope that it will be useful,
16  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *   GNU General Public License for more details.
19  *
20  *   You should have received a copy of the GNU General Public License
21  *   along with Lustre; if not, write to the Free Software
22  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23  *
24  * (Un)packing of OST requests
25  *
26  */
27
28 #define DEBUG_SUBSYSTEM S_RPC
29 #ifndef __KERNEL__
30 #include <liblustre.h>
31 #endif
32
33 #include <linux/obd_support.h>
34 #include <linux/lustre_net.h>
35
36
37 #define HDR_SIZE(count) \
38     size_round(offsetof (struct lustre_msg, buflens[(count)]))
39
40 int lustre_msg_swabbed(struct lustre_msg *msg)
41 {
42         return (msg->magic == __swab32(PTLRPC_MSG_MAGIC));
43 }
44
45 static int lustre_pack_msg(int count, int *lens, char **bufs, int *len,
46                            struct lustre_msg **msg)
47 {
48         char *ptr;
49         struct lustre_msg *m;
50         int size = 0, i;
51
52         size = HDR_SIZE (count);
53         for (i = 0; i < count; i++)
54                 size += size_round(lens[i]);
55
56         *len = size;
57
58         OBD_ALLOC(*msg, *len);
59         if (!*msg)
60                 RETURN(-ENOMEM);
61
62         m = *msg;
63         m->magic = PTLRPC_MSG_MAGIC;
64         m->version = PTLRPC_MSG_VERSION;
65         m->bufcount = count;
66         for (i = 0; i < count; i++)
67                 m->buflens[i] = lens[i];
68
69         ptr = (char *)m + HDR_SIZE(count);
70         for (i = 0; i < count; i++) {
71                 char *tmp = NULL;
72                 if (bufs)
73                         tmp = bufs[i];
74                 LOGL(tmp, lens[i], ptr);
75
76         }
77
78         return 0;
79 }
80
81 int lustre_pack_request(struct ptlrpc_request *req, int count, int *lens,
82                         char **bufs)
83 {
84         return lustre_pack_msg(count, lens, bufs, &req->rq_reqlen,
85                                &req->rq_reqmsg);
86 }
87
88 int lustre_pack_reply(struct ptlrpc_request *req, int count, int *lens,
89                       char **bufs)
90 {
91         return lustre_pack_msg(count, lens, bufs, &req->rq_replen,
92                                &req->rq_repmsg);
93 }
94
95 /* This returns the size of the buffer that is required to hold a lustre_msg
96  * with the given sub-buffer lengths. */
97 int lustre_msg_size(int count, int *lengths)
98 {
99         int size;
100         int i;
101
102         size = HDR_SIZE (count);
103         for (i = 0; i < count; i++)
104                 size += size_round(lengths[i]);
105
106         return size;
107 }
108
109 int lustre_unpack_msg(struct lustre_msg *m, int len)
110 {
111         int   flipped;
112         int   required_len;
113         int   i;
114         ENTRY;
115
116         /* We can provide a slightly better error log, if we check the
117          * message magic and version first.  In the future, struct
118          * lustre_msg may grow, and we'd like to log a version mismatch,
119          * rather than a short message.
120          *
121          */
122         required_len = MAX (offsetof (struct lustre_msg, version) +
123                             sizeof (m->version),
124                             offsetof (struct lustre_msg, magic) +
125                             sizeof (m->magic));
126         if (len < required_len) {
127                 /* can't even look inside the message */
128                 CERROR ("message length %d too small for magic/version check\n",
129                         len);
130                 RETURN (-EINVAL);
131         }
132
133         flipped = lustre_msg_swabbed(m);
134         if (flipped)
135                 __swab32s (&m->version);
136         else if (m->magic != PTLRPC_MSG_MAGIC) {
137                 CERROR("wrong lustre_msg magic %#08x\n", m->magic);
138                 RETURN (-EINVAL);
139         }
140
141         if (m->version != PTLRPC_MSG_VERSION) {
142                 CERROR("wrong lustre_msg version %#08x\n", m->version);
143                 RETURN (-EINVAL);
144         }
145
146         /* Now we know the sender speaks my language (but possibly flipped)...*/
147         required_len = HDR_SIZE(0);
148         if (len < required_len) {
149                 /* can't even look inside the message */
150                 CERROR ("message length %d too small for lustre_msg\n", len);
151                 RETURN (-EINVAL);
152         }
153
154         if (flipped) {
155                 __swab32s (&m->type);
156                 __swab32s (&m->opc);
157                 __swab64s (&m->last_xid);
158                 __swab64s (&m->last_committed);
159                 __swab64s (&m->transno);
160                 __swab32s (&m->status);
161                 __swab32s (&m->bufcount);
162                 __swab32s (&m->flags);
163         }
164
165         required_len = HDR_SIZE(m->bufcount);
166
167         if (len < required_len) {
168                 /* didn't receive all the buffer lengths */
169                 CERROR ("message length %d too small for %d buflens\n",
170                         len, m->bufcount);
171                 RETURN(-EINVAL);
172         }
173
174         for (i = 0; i < m->bufcount; i++) {
175                 if (flipped)
176                         __swab32s (&m->buflens[i]);
177                 required_len += size_round(m->buflens[i]);
178         }
179
180         if (len < required_len) {
181                 CERROR("len: %d, required_len %d\n", len, required_len);
182                 CERROR("bufcount: %d\n", m->bufcount);
183                 for (i = 0; i < m->bufcount; i++)
184                         CERROR("buffer %d length %d\n", i, m->buflens[i]);
185                 RETURN(-EINVAL);
186         }
187
188         RETURN(0);
189 }
190
191 void *lustre_msg_buf(struct lustre_msg *m, int n, int min_size)
192 {
193         int i;
194         int offset;
195         int buflen;
196         int bufcount;
197
198         LASSERT (m != NULL);
199         LASSERT (n >= 0);
200
201         bufcount = m->bufcount;
202         if (n >= bufcount) {
203                 CDEBUG(D_INFO, "msg %p buffer[%d] not present (count %d)\n",
204                        m, n, bufcount);
205                 return NULL;
206         }
207
208         buflen = m->buflens[n];
209         if (buflen < min_size) {
210                 CERROR("msg %p buffer[%d] size %d too small (required %d)\n",
211                        m, n, buflen, min_size);
212                 return NULL;
213         }
214
215         offset = HDR_SIZE(bufcount);
216         for (i = 0; i < n; i++)
217                 offset += size_round(m->buflens[i]);
218
219         return (char *)m + offset;
220 }
221
222 char *lustre_msg_string (struct lustre_msg *m, int index, int max_len)
223 {
224         /* max_len == 0 means the string should fill the buffer */
225         char *str = lustre_msg_buf (m, index, 0);
226         int   slen;
227         int   blen;
228
229         if (str == NULL) {
230                 CERROR ("can't unpack string in msg %p buffer[%d]\n", m, index);
231                 return (NULL);
232         }
233
234         blen = m->buflens[index];
235         slen = strnlen (str, blen);
236
237         if (slen == blen) {                     /* not NULL terminated */
238                 CERROR ("can't unpack non-NULL terminated string in "
239                         "msg %p buffer[%d] len %d\n", m, index, blen);
240                 return (NULL);
241         }
242
243         if (max_len == 0) {
244                 if (slen != blen - 1) {
245                         CERROR ("can't unpack short string in msg %p "
246                                 "buffer[%d] len %d: strlen %d\n",
247                                 m, index, blen, slen);
248                         return (NULL);
249                 }
250         } else if (slen > max_len) {
251                 CERROR ("can't unpack oversized string in msg %p "
252                         "buffer[%d] len %d strlen %d: max %d expected\n",
253                         m, index, blen, slen, max_len);
254                 return (NULL);
255         }
256
257         return (str);
258 }
259
260 /* Wrap up the normal fixed length case */
261 void *lustre_swab_reqbuf (struct ptlrpc_request *req, int index, int min_size,
262                           void *swabber)
263 {
264         void *ptr;
265
266         LASSERT_REQSWAB(req, index);
267
268         ptr = lustre_msg_buf(req->rq_reqmsg, index, min_size);
269         if (ptr == NULL)
270                 return NULL;
271
272         if (swabber != NULL && lustre_msg_swabbed(req->rq_reqmsg))
273                 ((void (*)(void *))swabber)(ptr);
274
275         return ptr;
276 }
277
278 /* Wrap up the normal fixed length case */
279 void *lustre_swab_repbuf (struct ptlrpc_request *req, int index, int min_size,
280                           void *swabber)
281 {
282         void *ptr;
283
284         LASSERT_REPSWAB(req, index);
285
286         ptr = lustre_msg_buf(req->rq_repmsg, index, min_size);
287         if (ptr == NULL)
288                 return NULL;
289
290         if (swabber != NULL && lustre_msg_swabbed(req->rq_repmsg))
291                 ((void (*)(void *))swabber)(ptr);
292
293         return ptr;
294 }
295
296 /* byte flipping routines for all wire types declared in
297  * lustre_idl.h implemented here.
298  */
299
300 void lustre_swab_obdo (struct obdo  *o)
301 {
302         __swab64s (&o->o_id);
303         __swab64s (&o->o_gr);
304         __swab64s (&o->o_atime);
305         __swab64s (&o->o_mtime);
306         __swab64s (&o->o_ctime);
307         __swab64s (&o->o_size);
308         __swab64s (&o->o_blocks);
309         __swab64s (&o->o_rdev);
310         __swab32s (&o->o_blksize);
311         __swab32s (&o->o_mode);
312         __swab32s (&o->o_uid);
313         __swab32s (&o->o_gid);
314         __swab32s (&o->o_flags);
315         __swab32s (&o->o_nlink);
316         __swab32s (&o->o_generation);
317         __swab32s (&o->o_valid);
318         __swab32s (&o->o_obdflags);
319         __swab32s (&o->o_easize);
320         /* o_inline is opaque */
321 }
322
323 void lustre_swab_obd_statfs (struct obd_statfs *os)
324 {
325         __swab64s (&os->os_type);
326         __swab64s (&os->os_blocks);
327         __swab64s (&os->os_bfree);
328         __swab64s (&os->os_bavail);
329         __swab64s (&os->os_ffree);
330         /* no need to swap os_fsid */
331         __swab32s (&os->os_bsize);
332         __swab32s (&os->os_namelen);
333         /* no need to swap os_spare */
334 }
335
336 void lustre_swab_obd_ioobj (struct obd_ioobj *ioo)
337 {
338         __swab64s (&ioo->ioo_id);
339         __swab64s (&ioo->ioo_gr);
340         __swab32s (&ioo->ioo_type);
341         __swab32s (&ioo->ioo_bufcnt);
342 }
343
344 void lustre_swab_niobuf_remote (struct niobuf_remote *nbr)
345 {
346         __swab64s (&nbr->offset);
347         __swab32s (&nbr->len);
348         __swab32s (&nbr->flags);
349 }
350
351 void lustre_swab_ost_body (struct ost_body *b)
352 {
353         lustre_swab_obdo (&b->oa);
354 }
355
356 void lustre_swab_ost_last_id(obd_id *id)
357 {
358         __swab64s(id);
359 }
360
361 void lustre_swab_ll_fid (struct ll_fid *fid)
362 {
363         __swab64s (&fid->id);
364         __swab32s (&fid->generation);
365         __swab32s (&fid->f_type);
366 }
367
368 void lustre_swab_mds_status_req (struct mds_status_req *r)
369 {
370         __swab32s (&r->flags);
371         __swab32s (&r->repbuf);
372 }
373
374 void lustre_swab_mds_body (struct mds_body *b)
375 {
376         lustre_swab_ll_fid (&b->fid1);
377         lustre_swab_ll_fid (&b->fid2);
378         /* handle is opaque */
379         __swab64s (&b->size);
380         __swab64s (&b->blocks);
381         __swab32s (&b->ino);
382         __swab32s (&b->valid);
383         __swab32s (&b->fsuid);
384         __swab32s (&b->fsgid);
385         __swab32s (&b->capability);
386         __swab32s (&b->mode);
387         __swab32s (&b->uid);
388         __swab32s (&b->gid);
389         __swab32s (&b->mtime);
390         __swab32s (&b->ctime);
391         __swab32s (&b->atime);
392         __swab32s (&b->flags);
393         __swab32s (&b->rdev);
394         __swab32s (&b->nlink);
395         __swab32s (&b->generation);
396         __swab32s (&b->suppgid);
397         __swab32s (&b->eadatasize);
398 }
399
400 void lustre_swab_mds_rec_setattr (struct mds_rec_setattr *sa)
401 {
402         __swab32s (&sa->sa_opcode);
403         __swab32s (&sa->sa_fsuid);
404         __swab32s (&sa->sa_fsgid);
405         __swab32s (&sa->sa_cap);
406         __swab32s (&sa->sa_suppgid);
407         __swab32s (&sa->sa_valid);
408         lustre_swab_ll_fid (&sa->sa_fid);
409         __swab32s (&sa->sa_mode);
410         __swab32s (&sa->sa_uid);
411         __swab32s (&sa->sa_gid);
412         __swab32s (&sa->sa_attr_flags);
413         __swab64s (&sa->sa_size);
414         __swab64s (&sa->sa_atime);
415         __swab64s (&sa->sa_mtime);
416         __swab64s (&sa->sa_ctime);
417 }
418
419 void lustre_swab_mds_rec_create (struct mds_rec_create *cr)
420 {
421         __swab32s (&cr->cr_opcode);
422         __swab32s (&cr->cr_fsuid);
423         __swab32s (&cr->cr_fsgid);
424         __swab32s (&cr->cr_cap);
425         __swab32s (&cr->cr_flags); /* for use with open */
426         __swab32s (&cr->cr_mode);
427         lustre_swab_ll_fid (&cr->cr_fid);
428         lustre_swab_ll_fid (&cr->cr_replayfid);
429         __swab64s (&cr->cr_time);
430         __swab64s (&cr->cr_rdev);
431         __swab32s (&cr->cr_suppgid);
432 }
433
434 void lustre_swab_mds_rec_link (struct mds_rec_link *lk)
435 {
436         __swab32s (&lk->lk_opcode);
437         __swab32s (&lk->lk_fsuid);
438         __swab32s (&lk->lk_fsgid);
439         __swab32s (&lk->lk_cap);
440         __swab32s (&lk->lk_suppgid1);
441         __swab32s (&lk->lk_suppgid2);
442         lustre_swab_ll_fid (&lk->lk_fid1);
443         lustre_swab_ll_fid (&lk->lk_fid2);
444 }
445
446 void lustre_swab_mds_rec_unlink (struct mds_rec_unlink *ul)
447 {
448         __swab32s (&ul->ul_opcode);
449         __swab32s (&ul->ul_fsuid);
450         __swab32s (&ul->ul_fsgid);
451         __swab32s (&ul->ul_cap);
452         __swab32s (&ul->ul_suppgid);
453         __swab32s (&ul->ul_mode);
454         lustre_swab_ll_fid (&ul->ul_fid1);
455         lustre_swab_ll_fid (&ul->ul_fid2);
456 }
457
458 void lustre_swab_mds_rec_rename (struct mds_rec_rename *rn)
459 {
460         __swab32s (&rn->rn_opcode);
461         __swab32s (&rn->rn_fsuid);
462         __swab32s (&rn->rn_fsgid);
463         __swab32s (&rn->rn_cap);
464         __swab32s (&rn->rn_suppgid1);
465         __swab32s (&rn->rn_suppgid2);
466         lustre_swab_ll_fid (&rn->rn_fid1);
467         lustre_swab_ll_fid (&rn->rn_fid2);
468 }
469
470 void lustre_swab_lov_desc (struct lov_desc *ld)
471 {
472         __swab32s (&ld->ld_tgt_count);
473         __swab32s (&ld->ld_active_tgt_count);
474         __swab32s (&ld->ld_default_stripe_count);
475         __swab64s (&ld->ld_default_stripe_size);
476         __swab64s (&ld->ld_default_stripe_offset);
477         __swab32s (&ld->ld_pattern);
478         /* uuid endian insensitive */
479 }
480
481 void lustre_swab_ldlm_res_id (struct ldlm_res_id *id)
482 {
483         int  i;
484
485         for (i = 0; i < RES_NAME_SIZE; i++)
486                 __swab64s (&id->name[i]);
487 }
488
489 void lustre_swab_ldlm_policy_data (ldlm_policy_data_t *d)
490 {
491         /* the lock data is a union and the first two fields are always an
492          * extent so it's ok to process an LDLM_EXTENT and LDLM_FLOCK lock
493          * data the same way. */
494         __swab64s (&d->l_flock.start);
495         __swab64s (&d->l_flock.end);
496         __swab32s (&d->l_flock.pid);
497 }
498
499 void lustre_swab_ldlm_intent (struct ldlm_intent *i)
500 {
501         __swab64s (&i->opc);
502 }
503
504 void lustre_swab_ldlm_resource_desc (struct ldlm_resource_desc *r)
505 {
506         int   i;
507
508         __swab32s (&r->lr_type);
509         lustre_swab_ldlm_res_id (&r->lr_name);
510         for (i = 0; i < RES_VERSION_SIZE; i++)
511                 __swab32s (&r->lr_version[i]);
512 }
513
514 void lustre_swab_ldlm_lock_desc (struct ldlm_lock_desc *l)
515 {
516         int   i;
517
518         lustre_swab_ldlm_resource_desc (&l->l_resource);
519         __swab32s (&l->l_req_mode);
520         __swab32s (&l->l_granted_mode);
521         lustre_swab_ldlm_policy_data (&l->l_policy_data);
522         for (i = 0; i < RES_VERSION_SIZE; i++)
523                 __swab32s (&l->l_version[i]);
524 }
525
526 void lustre_swab_ldlm_request (struct ldlm_request *rq)
527 {
528         __swab32s (&rq->lock_flags);
529         lustre_swab_ldlm_lock_desc (&rq->lock_desc);
530         /* lock_handle1 opaque */
531         /* lock_handle2 opaque */
532 }
533
534 void lustre_swab_ldlm_reply (struct ldlm_reply *r)
535 {
536         __swab32s (&r->lock_flags);
537         __swab32s (&r->lock_mode);
538         lustre_swab_ldlm_res_id (&r->lock_resource_name);
539         /* lock_handle opaque */
540         lustre_swab_ldlm_policy_data (&r->lock_policy_data);
541         __swab64s (&r->lock_policy_res1);
542         __swab64s (&r->lock_policy_res2);
543 }
544
545 void lustre_swab_ptlbd_op (struct ptlbd_op *op)
546 {
547         __swab16s (&op->op_cmd);
548         __swab16s (&op->op_lun);
549         __swab16s (&op->op_niob_cnt);
550         /* ignore op__padding */
551         __swab32s (&op->op_block_cnt);
552 }
553
554 void lustre_swab_ptlbd_niob (struct ptlbd_niob *n)
555 {
556         __swab64s (&n->n_xid);
557         __swab64s (&n->n_block_nr);
558         __swab32s (&n->n_offset);
559         __swab32s (&n->n_length);
560 }
561
562 void lustre_swab_ptlbd_rsp (struct ptlbd_rsp *r)
563 {
564         __swab16s (&r->r_status);
565         __swab16s (&r->r_error_cnt);
566 }
567
568 /* no one calls this */
569 int llog_log_swabbed(struct llog_log_hdr *hdr)
570 {
571         if (hdr->llh_hdr.lrh_type == __swab32(LLOG_HDR_MAGIC))
572                 return 1;
573         if (hdr->llh_hdr.lrh_type == LLOG_HDR_MAGIC)
574                 return 0;
575         return -1;
576 }
577
578 void lustre_swab_llogd_body (struct llogd_body *d)
579 {
580         __swab64s (&d->lgd_logid.lgl_oid);
581         __swab64s (&d->lgd_logid.lgl_ogr);
582         __swab32s (&d->lgd_logid.lgl_ogen);
583         __swab32s (&d->lgd_ctxt_idx);
584         __swab32s (&d->lgd_llh_flags);
585         __swab32s (&d->lgd_index);
586         __swab32s (&d->lgd_saved_index);
587         __swab32s (&d->lgd_len);
588         __swab64s (&d->lgd_cur_offset);
589 }
590
591 void lustre_swab_llog_hdr (struct llog_log_hdr *h)
592 {
593         __swab32s (&h->llh_hdr.lrh_index);
594         __swab32s (&h->llh_hdr.lrh_len);
595         __swab32s (&h->llh_hdr.lrh_type);
596         __swab64s (&h->llh_timestamp);
597         __swab32s (&h->llh_count);
598         __swab32s (&h->llh_bitmap_offset);
599         __swab32s (&h->llh_flags);
600         __swab32s (&h->llh_tail.lrt_index);
601         __swab32s (&h->llh_tail.lrt_len);
602 }
603
604 void lustre_swab_llogd_conn_body (struct llogd_conn_body *d)
605 {
606         __swab64s (&d->lgdc_gen.mnt_cnt);
607         __swab64s (&d->lgdc_gen.conn_cnt);
608         __swab64s (&d->lgdc_logid.lgl_oid);
609         __swab64s (&d->lgdc_logid.lgl_ogr);
610         __swab32s (&d->lgdc_logid.lgl_ogen);
611         __swab32s (&d->lgdc_ctxt_idx);
612 }
613
614 #ifdef BUG_1343
615 void lustre_assert_wire_constants(void)
616 {
617         /* Wire protocol assertions generated by 'wirecheck'
618          * running on Linux schnapps.adilger.int 2.4.22-l32 #4 Thu Jan 8 14:32:57 MST 2004 i686 i686
619          * with gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) */
620
621
622         /* Constants... */
623         LASSERT(PTLRPC_MSG_MAGIC == 0x0BD00BD0);
624         LASSERT(PTLRPC_MSG_VERSION == 0x00000003);
625         LASSERT(PTL_RPC_MSG_REQUEST == 4711);
626         LASSERT(PTL_RPC_MSG_ERR == 4712);
627         LASSERT(PTL_RPC_MSG_REPLY == 4713);
628         LASSERT(MSG_LAST_REPLAY == 1);
629         LASSERT(MSG_RESENT == 2);
630         LASSERT(MSG_CONNECT_RECOVERING == 1);
631         LASSERT(MSG_CONNECT_RECONNECT == 2);
632         LASSERT(MSG_CONNECT_REPLAYABLE == 4);
633         LASSERT(OST_REPLY == 0);
634         LASSERT(OST_GETATTR == 1);
635         LASSERT(OST_SETATTR == 2);
636         LASSERT(OST_READ == 3);
637         LASSERT(OST_WRITE == 4);
638         LASSERT(OST_CREATE == 5);
639         LASSERT(OST_DESTROY == 6);
640         LASSERT(OST_GET_INFO == 7);
641         LASSERT(OST_CONNECT == 8);
642         LASSERT(OST_DISCONNECT == 9);
643         LASSERT(OST_PUNCH == 10);
644         LASSERT(OST_OPEN == 11);
645         LASSERT(OST_CLOSE == 12);
646         LASSERT(OST_STATFS == 13);
647         LASSERT(OST_SAN_READ == 14);
648         LASSERT(OST_SAN_WRITE == 15);
649         LASSERT(OST_SYNC == 16);
650         LASSERT(OST_LAST_OPC == 18);
651         LASSERT(OBD_OBJECT_EOF == 0xffffffffffffffffULL);
652         LASSERT(OST_REQ_HAS_OA1 == 1);
653         LASSERT(MDS_GETATTR == 33);
654         LASSERT(MDS_GETATTR_NAME == 34);
655         LASSERT(MDS_CLOSE == 35);
656         LASSERT(MDS_REINT == 36);
657         LASSERT(MDS_READPAGE == 37);
658         LASSERT(MDS_CONNECT == 38);
659         LASSERT(MDS_DISCONNECT == 39);
660         LASSERT(MDS_GETSTATUS == 40);
661         LASSERT(MDS_STATFS == 41);
662         LASSERT(MDS_PIN == 42);
663         LASSERT(MDS_UNPIN == 43);
664         LASSERT(MDS_SYNC == 44);
665         LASSERT(MDS_DONE_WRITING == 45);
666         LASSERT(MDS_LAST_OPC == 46);
667         LASSERT(REINT_SETATTR == 1);
668         LASSERT(REINT_CREATE == 2);
669         LASSERT(REINT_LINK == 3);
670         LASSERT(REINT_UNLINK == 4);
671         LASSERT(REINT_RENAME == 5);
672         LASSERT(REINT_OPEN == 6);
673         LASSERT(REINT_MAX == 6);
674         LASSERT(DISP_IT_EXECD == 1);
675         LASSERT(DISP_LOOKUP_EXECD == 2);
676         LASSERT(DISP_LOOKUP_NEG == 4);
677         LASSERT(DISP_LOOKUP_POS == 8);
678         LASSERT(DISP_OPEN_CREATE == 16);
679         LASSERT(DISP_OPEN_OPEN == 32);
680         LASSERT(MDS_STATUS_CONN == 1);
681         LASSERT(MDS_STATUS_LOV == 2);
682         LASSERT(MDS_OPEN_HAS_EA == 1073741824);
683         LASSERT(LDLM_ENQUEUE == 101);
684         LASSERT(LDLM_CONVERT == 102);
685         LASSERT(LDLM_CANCEL == 103);
686         LASSERT(LDLM_BL_CALLBACK == 104);
687         LASSERT(LDLM_CP_CALLBACK == 105);
688         LASSERT(LDLM_LAST_OPC == 106);
689         LASSERT(LCK_EX == 1);
690         LASSERT(LCK_PW == 2);
691         LASSERT(LCK_PR == 3);
692         LASSERT(LCK_CW == 4);
693         LASSERT(LCK_CR == 5);
694         LASSERT(LCK_NL == 6);
695         LASSERT(PTLBD_QUERY == 200);
696         LASSERT(PTLBD_READ == 201);
697         LASSERT(PTLBD_WRITE == 202);
698         LASSERT(PTLBD_FLUSH == 203);
699         LASSERT(PTLBD_CONNECT == 204);
700         LASSERT(PTLBD_DISCONNECT == 205);
701         LASSERT(PTLBD_LAST_OPC == 206);
702         LASSERT(MGMT_CONNECT == 250);
703         LASSERT(MGMT_DISCONNECT == 251);
704         LASSERT(MGMT_EXCEPTION == 252);
705         LASSERT(OBD_PING == 400);
706         LASSERT(OBD_LOG_CANCEL == 401);
707         LASSERT(OBD_LAST_OPC == 402);
708         /* Sizes and Offsets */
709
710
711         /* Checks for struct lustre_handle */
712         LASSERT((int)sizeof(struct lustre_handle) == 8);
713         LASSERT(offsetof(struct lustre_handle, cookie) == 0);
714         LASSERT((int)sizeof(((struct lustre_handle *)0)->cookie) == 8);
715
716         /* Checks for struct lustre_msg */
717         LASSERT((int)sizeof(struct lustre_msg) == 64);
718         LASSERT(offsetof(struct lustre_msg, handle) == 0);
719         LASSERT((int)sizeof(((struct lustre_msg *)0)->handle) == 8);
720         LASSERT(offsetof(struct lustre_msg, magic) == 8);
721         LASSERT((int)sizeof(((struct lustre_msg *)0)->magic) == 4);
722         LASSERT(offsetof(struct lustre_msg, type) == 12);
723         LASSERT((int)sizeof(((struct lustre_msg *)0)->type) == 4);
724         LASSERT(offsetof(struct lustre_msg, version) == 16);
725         LASSERT((int)sizeof(((struct lustre_msg *)0)->version) == 4);
726         LASSERT(offsetof(struct lustre_msg, opc) == 20);
727         LASSERT((int)sizeof(((struct lustre_msg *)0)->opc) == 4);
728         LASSERT(offsetof(struct lustre_msg, last_xid) == 24);
729         LASSERT((int)sizeof(((struct lustre_msg *)0)->last_xid) == 8);
730         LASSERT(offsetof(struct lustre_msg, last_committed) == 32);
731         LASSERT((int)sizeof(((struct lustre_msg *)0)->last_committed) == 8);
732         LASSERT(offsetof(struct lustre_msg, transno) == 40);
733         LASSERT((int)sizeof(((struct lustre_msg *)0)->transno) == 8);
734         LASSERT(offsetof(struct lustre_msg, status) == 48);
735         LASSERT((int)sizeof(((struct lustre_msg *)0)->status) == 4);
736         LASSERT(offsetof(struct lustre_msg, flags) == 52);
737         LASSERT((int)sizeof(((struct lustre_msg *)0)->flags) == 4);
738         LASSERT(offsetof(struct lustre_msg, bufcount) == 60);
739         LASSERT((int)sizeof(((struct lustre_msg *)0)->bufcount) == 4);
740         LASSERT(offsetof(struct lustre_msg, buflens[7]) == 92);
741         LASSERT((int)sizeof(((struct lustre_msg *)0)->buflens[7]) == 4);
742
743         /* Checks for struct obdo */
744         LASSERT((int)sizeof(struct obdo) == 168);
745         LASSERT(offsetof(struct obdo, o_id) == 0);
746         LASSERT((int)sizeof(((struct obdo *)0)->o_id) == 8);
747         LASSERT(offsetof(struct obdo, o_gr) == 8);
748         LASSERT((int)sizeof(((struct obdo *)0)->o_gr) == 8);
749         LASSERT(offsetof(struct obdo, o_atime) == 16);
750         LASSERT((int)sizeof(((struct obdo *)0)->o_atime) == 8);
751         LASSERT(offsetof(struct obdo, o_mtime) == 24);
752         LASSERT((int)sizeof(((struct obdo *)0)->o_mtime) == 8);
753         LASSERT(offsetof(struct obdo, o_ctime) == 32);
754         LASSERT((int)sizeof(((struct obdo *)0)->o_ctime) == 8);
755         LASSERT(offsetof(struct obdo, o_size) == 40);
756         LASSERT((int)sizeof(((struct obdo *)0)->o_size) == 8);
757         LASSERT(offsetof(struct obdo, o_blocks) == 48);
758         LASSERT((int)sizeof(((struct obdo *)0)->o_blocks) == 8);
759         LASSERT(offsetof(struct obdo, o_rdev) == 56);
760         LASSERT((int)sizeof(((struct obdo *)0)->o_rdev) == 8);
761         LASSERT(offsetof(struct obdo, o_blksize) == 64);
762         LASSERT((int)sizeof(((struct obdo *)0)->o_blksize) == 4);
763         LASSERT(offsetof(struct obdo, o_mode) == 68);
764         LASSERT((int)sizeof(((struct obdo *)0)->o_mode) == 4);
765         LASSERT(offsetof(struct obdo, o_uid) == 72);
766         LASSERT((int)sizeof(((struct obdo *)0)->o_uid) == 4);
767         LASSERT(offsetof(struct obdo, o_gid) == 76);
768         LASSERT((int)sizeof(((struct obdo *)0)->o_gid) == 4);
769         LASSERT(offsetof(struct obdo, o_flags) == 80);
770         LASSERT((int)sizeof(((struct obdo *)0)->o_flags) == 4);
771         LASSERT(offsetof(struct obdo, o_nlink) == 84);
772         LASSERT((int)sizeof(((struct obdo *)0)->o_nlink) == 4);
773         LASSERT(offsetof(struct obdo, o_generation) == 88);
774         LASSERT((int)sizeof(((struct obdo *)0)->o_generation) == 4);
775         LASSERT(offsetof(struct obdo, o_valid) == 92);
776         LASSERT((int)sizeof(((struct obdo *)0)->o_valid) == 4);
777         LASSERT(offsetof(struct obdo, o_obdflags) == 96);
778         LASSERT((int)sizeof(((struct obdo *)0)->o_obdflags) == 4);
779         LASSERT(offsetof(struct obdo, o_easize) == 100);
780         LASSERT((int)sizeof(((struct obdo *)0)->o_easize) == 4);
781         LASSERT(offsetof(struct obdo, o_inline) == 104);
782         LASSERT((int)sizeof(((struct obdo *)0)->o_inline) == 64);
783         LASSERT(OBD_MD_FLID == 1);
784         LASSERT(OBD_MD_FLATIME == 2);
785         LASSERT(OBD_MD_FLMTIME == 4);
786         LASSERT(OBD_MD_FLCTIME == 8);
787         LASSERT(OBD_MD_FLSIZE == 16);
788         LASSERT(OBD_MD_FLBLOCKS == 32);
789         LASSERT(OBD_MD_FLBLKSZ == 64);
790         LASSERT(OBD_MD_FLMODE == 128);
791         LASSERT(OBD_MD_FLTYPE == 256);
792         LASSERT(OBD_MD_FLUID == 512);
793         LASSERT(OBD_MD_FLGID == 1024);
794         LASSERT(OBD_MD_FLFLAGS == 2048);
795         LASSERT(OBD_MD_FLOBDFLG == 4096);
796         LASSERT(OBD_MD_FLNLINK == 8192);
797         LASSERT(OBD_MD_FLGENER == 16384);
798         LASSERT(OBD_MD_FLINLINE == 32768);
799         LASSERT(OBD_MD_FLRDEV == 65536);
800         LASSERT(OBD_MD_FLEASIZE == 131072);
801         LASSERT(OBD_MD_LINKNAME == 262144);
802         LASSERT(OBD_MD_FLHANDLE == 524288);
803         LASSERT(OBD_MD_FLCKSUM == 1048576);
804         LASSERT(OBD_MD_FLQOS == 2097152);
805         LASSERT(OBD_MD_FLOSCOPQ == 4194304);
806         LASSERT(OBD_MD_FLCOOKIE == 8388608);
807         LASSERT(OBD_MD_FLGROUP == 16777216);
808         LASSERT(OBD_FL_INLINEDATA == 1);
809         LASSERT(OBD_FL_OBDMDEXISTS == 2);
810         LASSERT(OBD_FL_DELORPHAN == 4);
811         LASSERT(OBD_FL_NORPC == 8);
812         LASSERT(OBD_FL_IDONLY == 16);
813
814         /* Checks for struct lov_mds_md_v1 */
815         LASSERT((int)sizeof(struct lov_mds_md_v1) == 32);
816         LASSERT(offsetof(struct lov_mds_md_v1, lmm_magic) == 0);
817         LASSERT((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_magic) == 4);
818         LASSERT(offsetof(struct lov_mds_md_v1, lmm_pattern) == 4);
819         LASSERT((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_pattern) == 4);
820         LASSERT(offsetof(struct lov_mds_md_v1, lmm_object_id) == 8);
821         LASSERT((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_id) == 8);
822         LASSERT(offsetof(struct lov_mds_md_v1, lmm_object_gr) == 16);
823         LASSERT((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_gr) == 8);
824         LASSERT(offsetof(struct lov_mds_md_v1, lmm_stripe_size) == 24);
825         LASSERT((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_size) == 4);
826         LASSERT(offsetof(struct lov_mds_md_v1, lmm_stripe_count) == 28);
827         LASSERT((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_count) == 4);
828         LASSERT(offsetof(struct lov_mds_md_v1, lmm_objects) == 32);
829         LASSERT((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_objects) == 0);
830
831         /* Checks for struct lov_ost_data_v1 */
832         LASSERT((int)sizeof(struct lov_ost_data_v1) == 24);
833         LASSERT(offsetof(struct lov_ost_data_v1, l_object_id) == 0);
834         LASSERT((int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_id) == 8);
835         LASSERT(offsetof(struct lov_ost_data_v1, l_object_gr) == 8);
836         LASSERT((int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_gr) == 8);
837         LASSERT(offsetof(struct lov_ost_data_v1, l_ost_gen) == 16);
838         LASSERT((int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_gen) == 4);
839         LASSERT(offsetof(struct lov_ost_data_v1, l_ost_idx) == 20);
840         LASSERT((int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_idx) == 4);
841         LASSERT(LOV_MAGIC_V0 == 198183888);
842         LASSERT(LOV_MAGIC_V1 == 198249424);
843         LASSERT(LOV_PATTERN_RAID0 == 1);
844         LASSERT(LOV_PATTERN_RAID1 == 2);
845
846         /* Checks for struct obd_statfs */
847         LASSERT((int)sizeof(struct obd_statfs) == 144);
848         LASSERT(offsetof(struct obd_statfs, os_type) == 0);
849         LASSERT((int)sizeof(((struct obd_statfs *)0)->os_type) == 8);
850         LASSERT(offsetof(struct obd_statfs, os_blocks) == 8);
851         LASSERT((int)sizeof(((struct obd_statfs *)0)->os_blocks) == 8);
852         LASSERT(offsetof(struct obd_statfs, os_bfree) == 16);
853         LASSERT((int)sizeof(((struct obd_statfs *)0)->os_bfree) == 8);
854         LASSERT(offsetof(struct obd_statfs, os_bavail) == 24);
855         LASSERT((int)sizeof(((struct obd_statfs *)0)->os_bavail) == 8);
856         LASSERT(offsetof(struct obd_statfs, os_ffree) == 40);
857         LASSERT((int)sizeof(((struct obd_statfs *)0)->os_ffree) == 8);
858         LASSERT(offsetof(struct obd_statfs, os_fsid) == 48);
859         LASSERT((int)sizeof(((struct obd_statfs *)0)->os_fsid) == 40);
860         LASSERT(offsetof(struct obd_statfs, os_bsize) == 88);
861         LASSERT((int)sizeof(((struct obd_statfs *)0)->os_bsize) == 4);
862         LASSERT(offsetof(struct obd_statfs, os_namelen) == 92);
863         LASSERT((int)sizeof(((struct obd_statfs *)0)->os_namelen) == 4);
864         LASSERT(offsetof(struct obd_statfs, os_spare) == 104);
865         LASSERT((int)sizeof(((struct obd_statfs *)0)->os_spare) == 40);
866
867         /* Checks for struct obd_ioobj */
868         LASSERT((int)sizeof(struct obd_ioobj) == 24);
869         LASSERT(offsetof(struct obd_ioobj, ioo_id) == 0);
870         LASSERT((int)sizeof(((struct obd_ioobj *)0)->ioo_id) == 8);
871         LASSERT(offsetof(struct obd_ioobj, ioo_gr) == 8);
872         LASSERT((int)sizeof(((struct obd_ioobj *)0)->ioo_gr) == 8);
873         LASSERT(offsetof(struct obd_ioobj, ioo_type) == 16);
874         LASSERT((int)sizeof(((struct obd_ioobj *)0)->ioo_type) == 4);
875         LASSERT(offsetof(struct obd_ioobj, ioo_bufcnt) == 20);
876         LASSERT((int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt) == 4);
877
878         /* Checks for struct niobuf_remote */
879         LASSERT((int)sizeof(struct niobuf_remote) == 16);
880         LASSERT(offsetof(struct niobuf_remote, offset) == 0);
881         LASSERT((int)sizeof(((struct niobuf_remote *)0)->offset) == 8);
882         LASSERT(offsetof(struct niobuf_remote, len) == 8);
883         LASSERT((int)sizeof(((struct niobuf_remote *)0)->len) == 4);
884         LASSERT(offsetof(struct niobuf_remote, flags) == 12);
885         LASSERT((int)sizeof(((struct niobuf_remote *)0)->flags) == 4);
886         LASSERT(OBD_BRW_READ == 1);
887         LASSERT(OBD_BRW_WRITE == 2);
888         LASSERT(OBD_BRW_CREATE == 4);
889         LASSERT(OBD_BRW_SYNC == 8);
890         LASSERT(OBD_BRW_FROM_GRANT == 32);
891
892         /* Checks for struct ost_body */
893         LASSERT((int)sizeof(struct ost_body) == 168);
894         LASSERT(offsetof(struct ost_body, oa) == 0);
895         LASSERT((int)sizeof(((struct ost_body *)0)->oa) == 168);
896
897         /* Checks for struct ll_fid */
898         LASSERT((int)sizeof(struct ll_fid) == 16);
899         LASSERT(offsetof(struct ll_fid, id) == 0);
900         LASSERT((int)sizeof(((struct ll_fid *)0)->id) == 8);
901         LASSERT(offsetof(struct ll_fid, generation) == 8);
902         LASSERT((int)sizeof(((struct ll_fid *)0)->generation) == 4);
903         LASSERT(offsetof(struct ll_fid, f_type) == 12);
904         LASSERT((int)sizeof(((struct ll_fid *)0)->f_type) == 4);
905
906         /* Checks for struct mds_status_req */
907         LASSERT((int)sizeof(struct mds_status_req) == 8);
908         LASSERT(offsetof(struct mds_status_req, flags) == 0);
909         LASSERT((int)sizeof(((struct mds_status_req *)0)->flags) == 4);
910         LASSERT(offsetof(struct mds_status_req, repbuf) == 4);
911         LASSERT((int)sizeof(((struct mds_status_req *)0)->repbuf) == 4);
912
913         /* Checks for struct mds_body */
914         LASSERT((int)sizeof(struct mds_body) == 136);
915         LASSERT(offsetof(struct mds_body, fid1) == 0);
916         LASSERT((int)sizeof(((struct mds_body *)0)->fid1) == 16);
917         LASSERT(offsetof(struct mds_body, fid2) == 16);
918         LASSERT((int)sizeof(((struct mds_body *)0)->fid2) == 16);
919         LASSERT(offsetof(struct mds_body, handle) == 32);
920         LASSERT((int)sizeof(((struct mds_body *)0)->handle) == 8);
921         LASSERT(offsetof(struct mds_body, size) == 40);
922         LASSERT((int)sizeof(((struct mds_body *)0)->size) == 8);
923         LASSERT(offsetof(struct mds_body, blocks) == 48);
924         LASSERT((int)sizeof(((struct mds_body *)0)->blocks) == 8);
925         LASSERT(offsetof(struct mds_body, io_epoch) == 56);
926         LASSERT((int)sizeof(((struct mds_body *)0)->io_epoch) == 8);
927         LASSERT(offsetof(struct mds_body, ino) == 64);
928         LASSERT((int)sizeof(((struct mds_body *)0)->ino) == 4);
929         LASSERT(offsetof(struct mds_body, valid) == 68);
930         LASSERT((int)sizeof(((struct mds_body *)0)->valid) == 4);
931         LASSERT(offsetof(struct mds_body, fsuid) == 72);
932         LASSERT((int)sizeof(((struct mds_body *)0)->fsuid) == 4);
933         LASSERT(offsetof(struct mds_body, fsgid) == 76);
934         LASSERT((int)sizeof(((struct mds_body *)0)->fsgid) == 4);
935         LASSERT(offsetof(struct mds_body, capability) == 80);
936         LASSERT((int)sizeof(((struct mds_body *)0)->capability) == 4);
937         LASSERT(offsetof(struct mds_body, mode) == 84);
938         LASSERT((int)sizeof(((struct mds_body *)0)->mode) == 4);
939         LASSERT(offsetof(struct mds_body, uid) == 88);
940         LASSERT((int)sizeof(((struct mds_body *)0)->uid) == 4);
941         LASSERT(offsetof(struct mds_body, gid) == 92);
942         LASSERT((int)sizeof(((struct mds_body *)0)->gid) == 4);
943         LASSERT(offsetof(struct mds_body, mtime) == 96);
944         LASSERT((int)sizeof(((struct mds_body *)0)->mtime) == 4);
945         LASSERT(offsetof(struct mds_body, ctime) == 100);
946         LASSERT((int)sizeof(((struct mds_body *)0)->ctime) == 4);
947         LASSERT(offsetof(struct mds_body, atime) == 104);
948         LASSERT((int)sizeof(((struct mds_body *)0)->atime) == 4);
949         LASSERT(offsetof(struct mds_body, flags) == 108);
950         LASSERT((int)sizeof(((struct mds_body *)0)->flags) == 4);
951         LASSERT(offsetof(struct mds_body, rdev) == 112);
952         LASSERT((int)sizeof(((struct mds_body *)0)->rdev) == 4);
953         LASSERT(offsetof(struct mds_body, nlink) == 116);
954         LASSERT((int)sizeof(((struct mds_body *)0)->nlink) == 4);
955         LASSERT(offsetof(struct mds_body, generation) == 120);
956         LASSERT((int)sizeof(((struct mds_body *)0)->generation) == 4);
957         LASSERT(offsetof(struct mds_body, suppgid) == 124);
958         LASSERT((int)sizeof(((struct mds_body *)0)->suppgid) == 4);
959         LASSERT(offsetof(struct mds_body, eadatasize) == 128);
960         LASSERT((int)sizeof(((struct mds_body *)0)->eadatasize) == 4);
961         LASSERT(FMODE_READ == 1);
962         LASSERT(FMODE_WRITE == 2);
963         LASSERT(FMODE_EXEC == 4);
964         LASSERT(MDS_OPEN_CREAT == 64);
965         LASSERT(MDS_OPEN_EXCL == 128);
966         LASSERT(MDS_OPEN_TRUNC == 512);
967         LASSERT(MDS_OPEN_APPEND == 1024);
968         LASSERT(MDS_OPEN_SYNC == 4096);
969         LASSERT(MDS_OPEN_DIRECTORY == 65536);
970         LASSERT(MDS_OPEN_DELAY_CREATE == 16777216);
971         LASSERT(MDS_OPEN_HAS_EA == 1073741824);
972
973         /* Checks for struct mds_rec_setattr */
974         LASSERT((int)sizeof(struct mds_rec_setattr) == 88);
975         LASSERT(offsetof(struct mds_rec_setattr, sa_opcode) == 0);
976         LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_opcode) == 4);
977         LASSERT(offsetof(struct mds_rec_setattr, sa_fsuid) == 4);
978         LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_fsuid) == 4);
979         LASSERT(offsetof(struct mds_rec_setattr, sa_fsgid) == 8);
980         LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_fsgid) == 4);
981         LASSERT(offsetof(struct mds_rec_setattr, sa_cap) == 12);
982         LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_cap) == 4);
983         LASSERT(offsetof(struct mds_rec_setattr, sa_suppgid) == 16);
984         LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_suppgid) == 4);
985         LASSERT(offsetof(struct mds_rec_setattr, sa_valid) == 20);
986         LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_valid) == 4);
987         LASSERT(offsetof(struct mds_rec_setattr, sa_fid) == 24);
988         LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_fid) == 16);
989         LASSERT(offsetof(struct mds_rec_setattr, sa_mode) == 40);
990         LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_mode) == 4);
991         LASSERT(offsetof(struct mds_rec_setattr, sa_uid) == 44);
992         LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_uid) == 4);
993         LASSERT(offsetof(struct mds_rec_setattr, sa_gid) == 48);
994         LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_gid) == 4);
995         LASSERT(offsetof(struct mds_rec_setattr, sa_attr_flags) == 52);
996         LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags) == 4);
997         LASSERT(offsetof(struct mds_rec_setattr, sa_size) == 56);
998         LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_size) == 8);
999         LASSERT(offsetof(struct mds_rec_setattr, sa_atime) == 64);
1000         LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_atime) == 8);
1001         LASSERT(offsetof(struct mds_rec_setattr, sa_mtime) == 72);
1002         LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_mtime) == 8);
1003         LASSERT(offsetof(struct mds_rec_setattr, sa_ctime) == 80);
1004         LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_ctime) == 8);
1005
1006         /* Checks for struct mds_rec_create */
1007         LASSERT((int)sizeof(struct mds_rec_create) == 80);
1008         LASSERT(offsetof(struct mds_rec_create, cr_opcode) == 0);
1009         LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_opcode) == 4);
1010         LASSERT(offsetof(struct mds_rec_create, cr_fsuid) == 4);
1011         LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_fsuid) == 4);
1012         LASSERT(offsetof(struct mds_rec_create, cr_fsgid) == 8);
1013         LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_fsgid) == 4);
1014         LASSERT(offsetof(struct mds_rec_create, cr_cap) == 12);
1015         LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_cap) == 4);
1016         LASSERT(offsetof(struct mds_rec_create, cr_flags) == 16);
1017         LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_flags) == 4);
1018         LASSERT(offsetof(struct mds_rec_create, cr_mode) == 20);
1019         LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_mode) == 4);
1020         LASSERT(offsetof(struct mds_rec_create, cr_fid) == 24);
1021         LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_fid) == 16);
1022         LASSERT(offsetof(struct mds_rec_create, cr_replayfid) == 40);
1023         LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_replayfid) == 16);
1024         LASSERT(offsetof(struct mds_rec_create, cr_time) == 56);
1025         LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_time) == 8);
1026         LASSERT(offsetof(struct mds_rec_create, cr_rdev) == 64);
1027         LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_rdev) == 8);
1028         LASSERT(offsetof(struct mds_rec_create, cr_suppgid) == 72);
1029         LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_suppgid) == 4);
1030
1031         /* Checks for struct mds_rec_link */
1032         LASSERT((int)sizeof(struct mds_rec_link) == 64);
1033         LASSERT(offsetof(struct mds_rec_link, lk_opcode) == 0);
1034         LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_opcode) == 4);
1035         LASSERT(offsetof(struct mds_rec_link, lk_fsuid) == 4);
1036         LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_fsuid) == 4);
1037         LASSERT(offsetof(struct mds_rec_link, lk_fsgid) == 8);
1038         LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_fsgid) == 4);
1039         LASSERT(offsetof(struct mds_rec_link, lk_cap) == 12);
1040         LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_cap) == 4);
1041         LASSERT(offsetof(struct mds_rec_link, lk_suppgid1) == 16);
1042         LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_suppgid1) == 4);
1043         LASSERT(offsetof(struct mds_rec_link, lk_suppgid2) == 20);
1044         LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_suppgid2) == 4);
1045         LASSERT(offsetof(struct mds_rec_link, lk_fid1) == 24);
1046         LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_fid1) == 16);
1047         LASSERT(offsetof(struct mds_rec_link, lk_fid2) == 40);
1048         LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_fid2) == 16);
1049         LASSERT(offsetof(struct mds_rec_link, lk_time) == 56);
1050         LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_time) == 8);
1051
1052         /* Checks for struct mds_rec_unlink */
1053         LASSERT((int)sizeof(struct mds_rec_unlink) == 64);
1054         LASSERT(offsetof(struct mds_rec_unlink, ul_opcode) == 0);
1055         LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_opcode) == 4);
1056         LASSERT(offsetof(struct mds_rec_unlink, ul_fsuid) == 4);
1057         LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_fsuid) == 4);
1058         LASSERT(offsetof(struct mds_rec_unlink, ul_fsgid) == 8);
1059         LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_fsgid) == 4);
1060         LASSERT(offsetof(struct mds_rec_unlink, ul_cap) == 12);
1061         LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_cap) == 4);
1062         LASSERT(offsetof(struct mds_rec_unlink, ul_suppgid) == 16);
1063         LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_suppgid) == 4);
1064         LASSERT(offsetof(struct mds_rec_unlink, ul_mode) == 20);
1065         LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_mode) == 4);
1066         LASSERT(offsetof(struct mds_rec_unlink, ul_fid1) == 24);
1067         LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_fid1) == 16);
1068         LASSERT(offsetof(struct mds_rec_unlink, ul_fid2) == 40);
1069         LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_fid2) == 16);
1070         LASSERT(offsetof(struct mds_rec_unlink, ul_time) == 56);
1071         LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_time) == 8);
1072
1073         /* Checks for struct mds_rec_rename */
1074         LASSERT((int)sizeof(struct mds_rec_rename) == 64);
1075         LASSERT(offsetof(struct mds_rec_rename, rn_opcode) == 0);
1076         LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_opcode) == 4);
1077         LASSERT(offsetof(struct mds_rec_rename, rn_fsuid) == 4);
1078         LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_fsuid) == 4);
1079         LASSERT(offsetof(struct mds_rec_rename, rn_fsgid) == 8);
1080         LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_fsgid) == 4);
1081         LASSERT(offsetof(struct mds_rec_rename, rn_cap) == 12);
1082         LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_cap) == 4);
1083         LASSERT(offsetof(struct mds_rec_rename, rn_suppgid1) == 16);
1084         LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_suppgid1) == 4);
1085         LASSERT(offsetof(struct mds_rec_rename, rn_suppgid2) == 20);
1086         LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_suppgid2) == 4);
1087         LASSERT(offsetof(struct mds_rec_rename, rn_fid1) == 24);
1088         LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_fid1) == 16);
1089         LASSERT(offsetof(struct mds_rec_rename, rn_fid2) == 40);
1090         LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_fid2) == 16);
1091         LASSERT(offsetof(struct mds_rec_rename, rn_time) == 56);
1092         LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_time) == 8);
1093
1094         /* Checks for struct lov_desc */
1095         LASSERT((int)sizeof(struct lov_desc) == 72);
1096         LASSERT(offsetof(struct lov_desc, ld_tgt_count) == 0);
1097         LASSERT((int)sizeof(((struct lov_desc *)0)->ld_tgt_count) == 4);
1098         LASSERT(offsetof(struct lov_desc, ld_active_tgt_count) == 4);
1099         LASSERT((int)sizeof(((struct lov_desc *)0)->ld_active_tgt_count) == 4);
1100         LASSERT(offsetof(struct lov_desc, ld_default_stripe_count) == 8);
1101         LASSERT((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_count) == 4);
1102         LASSERT(offsetof(struct lov_desc, ld_pattern) == 12);
1103         LASSERT((int)sizeof(((struct lov_desc *)0)->ld_pattern) == 4);
1104         LASSERT(offsetof(struct lov_desc, ld_default_stripe_size) == 16);
1105         LASSERT((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_size) == 8);
1106         LASSERT(offsetof(struct lov_desc, ld_default_stripe_offset) == 24);
1107         LASSERT((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_offset) == 8);
1108         LASSERT(offsetof(struct lov_desc, ld_uuid) == 32);
1109         LASSERT((int)sizeof(((struct lov_desc *)0)->ld_uuid) == 40);
1110
1111         /* Checks for struct ldlm_res_id */
1112         LASSERT((int)sizeof(struct ldlm_res_id) == 32);
1113         LASSERT(offsetof(struct ldlm_res_id, name[4]) == 32);
1114         LASSERT((int)sizeof(((struct ldlm_res_id *)0)->name[4]) == 8);
1115
1116         /* Checks for struct ldlm_extent */
1117         LASSERT((int)sizeof(struct ldlm_extent) == 16);
1118         LASSERT(offsetof(struct ldlm_extent, start) == 0);
1119         LASSERT((int)sizeof(((struct ldlm_extent *)0)->start) == 8);
1120         LASSERT(offsetof(struct ldlm_extent, end) == 8);
1121         LASSERT((int)sizeof(((struct ldlm_extent *)0)->end) == 8);
1122
1123         /* Checks for struct ldlm_flock */
1124         LASSERT((int)sizeof(struct ldlm_flock) == 32);
1125         LASSERT(offsetof(struct ldlm_flock, start) == 0);
1126         LASSERT((int)sizeof(((struct ldlm_flock *)0)->start) == 8);
1127         LASSERT(offsetof(struct ldlm_flock, end) == 8);
1128         LASSERT((int)sizeof(((struct ldlm_flock *)0)->end) == 8);
1129         LASSERT(offsetof(struct ldlm_flock, blocking_export) == 16);
1130         LASSERT((int)sizeof(((struct ldlm_flock *)0)->blocking_export) == 8);
1131         LASSERT(offsetof(struct ldlm_flock, blocking_pid) == 24);
1132         LASSERT((int)sizeof(((struct ldlm_flock *)0)->blocking_pid) == 4);
1133         LASSERT(offsetof(struct ldlm_flock, pid) == 28);
1134         LASSERT((int)sizeof(((struct ldlm_flock *)0)->pid) == 4);
1135
1136         /* Checks for struct ldlm_intent */
1137         LASSERT((int)sizeof(struct ldlm_intent) == 8);
1138         LASSERT(offsetof(struct ldlm_intent, opc) == 0);
1139         LASSERT((int)sizeof(((struct ldlm_intent *)0)->opc) == 8);
1140
1141         /* Checks for struct ldlm_resource_desc */
1142         LASSERT((int)sizeof(struct ldlm_resource_desc) == 52);
1143         LASSERT(offsetof(struct ldlm_resource_desc, lr_type) == 0);
1144         LASSERT((int)sizeof(((struct ldlm_resource_desc *)0)->lr_type) == 4);
1145         LASSERT(offsetof(struct ldlm_resource_desc, lr_name) == 4);
1146         LASSERT((int)sizeof(((struct ldlm_resource_desc *)0)->lr_name) == 32);
1147         LASSERT(offsetof(struct ldlm_resource_desc, lr_version[4]) == 52);
1148         LASSERT((int)sizeof(((struct ldlm_resource_desc *)0)->lr_version[4]) == 4);
1149
1150         /* Checks for struct ldlm_lock_desc */
1151         LASSERT((int)sizeof(struct ldlm_lock_desc) == 108);
1152         LASSERT(offsetof(struct ldlm_lock_desc, l_resource) == 0);
1153         LASSERT((int)sizeof(((struct ldlm_lock_desc *)0)->l_resource) == 52);
1154         LASSERT(offsetof(struct ldlm_lock_desc, l_req_mode) == 52);
1155         LASSERT((int)sizeof(((struct ldlm_lock_desc *)0)->l_req_mode) == 4);
1156         LASSERT(offsetof(struct ldlm_lock_desc, l_granted_mode) == 56);
1157         LASSERT((int)sizeof(((struct ldlm_lock_desc *)0)->l_granted_mode) == 4);
1158         LASSERT(offsetof(struct ldlm_lock_desc, l_policy_data) == 60);
1159         LASSERT((int)sizeof(((struct ldlm_lock_desc *)0)->l_policy_data) == 32);
1160         LASSERT(offsetof(struct ldlm_lock_desc, l_version[4]) == 108);
1161         LASSERT((int)sizeof(((struct ldlm_lock_desc *)0)->l_version[4]) == 4);
1162
1163         /* Checks for struct ldlm_request */
1164         LASSERT((int)sizeof(struct ldlm_request) == 128);
1165         LASSERT(offsetof(struct ldlm_request, lock_flags) == 0);
1166         LASSERT((int)sizeof(((struct ldlm_request *)0)->lock_flags) == 4);
1167         LASSERT(offsetof(struct ldlm_request, lock_desc) == 4);
1168         LASSERT((int)sizeof(((struct ldlm_request *)0)->lock_desc) == 108);
1169         LASSERT(offsetof(struct ldlm_request, lock_handle1) == 112);
1170         LASSERT((int)sizeof(((struct ldlm_request *)0)->lock_handle1) == 8);
1171         LASSERT(offsetof(struct ldlm_request, lock_handle2) == 120);
1172         LASSERT((int)sizeof(((struct ldlm_request *)0)->lock_handle2) == 8);
1173
1174         /* Checks for struct ldlm_reply */
1175         LASSERT((int)sizeof(struct ldlm_reply) == 96);
1176         LASSERT(offsetof(struct ldlm_reply, lock_flags) == 0);
1177         LASSERT((int)sizeof(((struct ldlm_reply *)0)->lock_flags) == 4);
1178         LASSERT(offsetof(struct ldlm_reply, lock_mode) == 4);
1179         LASSERT((int)sizeof(((struct ldlm_reply *)0)->lock_mode) == 4);
1180         LASSERT(offsetof(struct ldlm_reply, lock_resource_name) == 8);
1181         LASSERT((int)sizeof(((struct ldlm_reply *)0)->lock_resource_name) == 32);
1182         LASSERT(offsetof(struct ldlm_reply, lock_handle) == 40);
1183         LASSERT((int)sizeof(((struct ldlm_reply *)0)->lock_handle) == 8);
1184         LASSERT(offsetof(struct ldlm_reply, lock_policy_data) == 48);
1185         LASSERT((int)sizeof(((struct ldlm_reply *)0)->lock_policy_data) == 32);
1186         LASSERT(offsetof(struct ldlm_reply, lock_policy_res1) == 80);
1187         LASSERT((int)sizeof(((struct ldlm_reply *)0)->lock_policy_res1) == 8);
1188         LASSERT(offsetof(struct ldlm_reply, lock_policy_res2) == 88);
1189         LASSERT((int)sizeof(((struct ldlm_reply *)0)->lock_policy_res2) == 8);
1190
1191         /* Checks for struct ptlbd_op */
1192         LASSERT((int)sizeof(struct ptlbd_op) == 12);
1193         LASSERT(offsetof(struct ptlbd_op, op_cmd) == 0);
1194         LASSERT((int)sizeof(((struct ptlbd_op *)0)->op_cmd) == 2);
1195         LASSERT(offsetof(struct ptlbd_op, op_lun) == 2);
1196         LASSERT((int)sizeof(((struct ptlbd_op *)0)->op_lun) == 2);
1197         LASSERT(offsetof(struct ptlbd_op, op_niob_cnt) == 4);
1198         LASSERT((int)sizeof(((struct ptlbd_op *)0)->op_niob_cnt) == 2);
1199         LASSERT(offsetof(struct ptlbd_op, op__padding) == 6);
1200         LASSERT((int)sizeof(((struct ptlbd_op *)0)->op__padding) == 2);
1201         LASSERT(offsetof(struct ptlbd_op, op_block_cnt) == 8);
1202         LASSERT((int)sizeof(((struct ptlbd_op *)0)->op_block_cnt) == 4);
1203
1204         /* Checks for struct ptlbd_niob */
1205         LASSERT((int)sizeof(struct ptlbd_niob) == 24);
1206         LASSERT(offsetof(struct ptlbd_niob, n_xid) == 0);
1207         LASSERT((int)sizeof(((struct ptlbd_niob *)0)->n_xid) == 8);
1208         LASSERT(offsetof(struct ptlbd_niob, n_block_nr) == 8);
1209         LASSERT((int)sizeof(((struct ptlbd_niob *)0)->n_block_nr) == 8);
1210         LASSERT(offsetof(struct ptlbd_niob, n_offset) == 16);
1211         LASSERT((int)sizeof(((struct ptlbd_niob *)0)->n_offset) == 4);
1212         LASSERT(offsetof(struct ptlbd_niob, n_length) == 20);
1213         LASSERT((int)sizeof(((struct ptlbd_niob *)0)->n_length) == 4);
1214
1215         /* Checks for struct ptlbd_rsp */
1216         LASSERT((int)sizeof(struct ptlbd_rsp) == 4);
1217         LASSERT(offsetof(struct ptlbd_rsp, r_status) == 0);
1218         LASSERT((int)sizeof(((struct ptlbd_rsp *)0)->r_status) == 2);
1219         LASSERT(offsetof(struct ptlbd_rsp, r_error_cnt) == 2);
1220         LASSERT((int)sizeof(((struct ptlbd_rsp *)0)->r_error_cnt) == 2);
1221
1222         /* Checks for struct llog_logid */
1223         LASSERT((int)sizeof(struct llog_logid) == 20);
1224         LASSERT(offsetof(struct llog_logid, lgl_oid) == 0);
1225         LASSERT((int)sizeof(((struct llog_logid *)0)->lgl_oid) == 8);
1226         LASSERT(offsetof(struct llog_logid, lgl_ogr) == 8);
1227         LASSERT((int)sizeof(((struct llog_logid *)0)->lgl_ogr) == 8);
1228         LASSERT(offsetof(struct llog_logid, lgl_ogen) == 16);
1229         LASSERT((int)sizeof(((struct llog_logid *)0)->lgl_ogen) == 4);
1230         LASSERT(OST_SZ_REC == 274730752);
1231         LASSERT(OST_RAID1_REC == 274731008);
1232         LASSERT(MDS_UNLINK_REC == 274801668);
1233         LASSERT(OBD_CFG_REC == 274857984);
1234         LASSERT(PTL_CFG_REC == 274923520);
1235         LASSERT(LLOG_GEN_REC == 274989056);
1236         LASSERT(LLOG_HDR_MAGIC == 275010873);
1237         LASSERT(LLOG_LOGID_MAGIC == 275010874);
1238
1239         /* Checks for struct llog_rec_hdr */
1240         LASSERT((int)sizeof(struct llog_rec_hdr) == 16);
1241         LASSERT(offsetof(struct llog_rec_hdr, lrh_len) == 0);
1242         LASSERT((int)sizeof(((struct llog_rec_hdr *)0)->lrh_len) == 4);
1243         LASSERT(offsetof(struct llog_rec_hdr, lrh_index) == 4);
1244         LASSERT((int)sizeof(((struct llog_rec_hdr *)0)->lrh_index) == 4);
1245         LASSERT(offsetof(struct llog_rec_hdr, lrh_type) == 8);
1246         LASSERT((int)sizeof(((struct llog_rec_hdr *)0)->lrh_type) == 4);
1247
1248         /* Checks for struct llog_rec_tail */
1249         LASSERT((int)sizeof(struct llog_rec_tail) == 8);
1250         LASSERT(offsetof(struct llog_rec_tail, lrt_len) == 0);
1251         LASSERT((int)sizeof(((struct llog_rec_tail *)0)->lrt_len) == 4);
1252         LASSERT(offsetof(struct llog_rec_tail, lrt_index) == 4);
1253         LASSERT((int)sizeof(((struct llog_rec_tail *)0)->lrt_index) == 4);
1254
1255         /* Checks for struct llog_logid_rec */
1256         LASSERT((int)sizeof(struct llog_logid_rec) == 48);
1257         LASSERT(offsetof(struct llog_logid_rec, lid_hdr) == 0);
1258         LASSERT((int)sizeof(((struct llog_logid_rec *)0)->lid_hdr) == 16);
1259         LASSERT(offsetof(struct llog_logid_rec, lid_id) == 16);
1260         LASSERT((int)sizeof(((struct llog_logid_rec *)0)->lid_id) == 20);
1261         LASSERT(offsetof(struct llog_logid_rec, lid_tail) == 40);
1262         LASSERT((int)sizeof(((struct llog_logid_rec *)0)->lid_tail) == 8);
1263
1264         /* Checks for struct llog_create_rec */
1265         LASSERT((int)sizeof(struct llog_create_rec) == 56);
1266         LASSERT(offsetof(struct llog_create_rec, lcr_hdr) == 0);
1267         LASSERT((int)sizeof(((struct llog_create_rec *)0)->lcr_hdr) == 16);
1268         LASSERT(offsetof(struct llog_create_rec, lcr_fid) == 16);
1269         LASSERT((int)sizeof(((struct llog_create_rec *)0)->lcr_fid) == 16);
1270         LASSERT(offsetof(struct llog_create_rec, lcr_oid) == 32);
1271         LASSERT((int)sizeof(((struct llog_create_rec *)0)->lcr_oid) == 8);
1272         LASSERT(offsetof(struct llog_create_rec, lcr_ogen) == 40);
1273         LASSERT((int)sizeof(((struct llog_create_rec *)0)->lcr_ogen) == 4);
1274
1275         /* Checks for struct llog_orphan_rec */
1276         LASSERT((int)sizeof(struct llog_orphan_rec) == 40);
1277         LASSERT(offsetof(struct llog_orphan_rec, lor_hdr) == 0);
1278         LASSERT((int)sizeof(((struct llog_orphan_rec *)0)->lor_hdr) == 16);
1279         LASSERT(offsetof(struct llog_orphan_rec, lor_oid) == 16);
1280         LASSERT((int)sizeof(((struct llog_orphan_rec *)0)->lor_oid) == 8);
1281         LASSERT(offsetof(struct llog_orphan_rec, lor_ogen) == 24);
1282         LASSERT((int)sizeof(((struct llog_orphan_rec *)0)->lor_ogen) == 4);
1283         LASSERT(offsetof(struct llog_orphan_rec, lor_tail) == 32);
1284         LASSERT((int)sizeof(((struct llog_orphan_rec *)0)->lor_tail) == 8);
1285
1286         /* Checks for struct llog_unlink_rec */
1287         LASSERT((int)sizeof(struct llog_unlink_rec) == 40);
1288         LASSERT(offsetof(struct llog_unlink_rec, lur_hdr) == 0);
1289         LASSERT((int)sizeof(((struct llog_unlink_rec *)0)->lur_hdr) == 16);
1290         LASSERT(offsetof(struct llog_unlink_rec, lur_oid) == 16);
1291         LASSERT((int)sizeof(((struct llog_unlink_rec *)0)->lur_oid) == 8);
1292         LASSERT(offsetof(struct llog_unlink_rec, lur_ogen) == 24);
1293         LASSERT((int)sizeof(((struct llog_unlink_rec *)0)->lur_ogen) == 4);
1294         LASSERT(offsetof(struct llog_unlink_rec, lur_tail) == 32);
1295         LASSERT((int)sizeof(((struct llog_unlink_rec *)0)->lur_tail) == 8);
1296
1297         /* Checks for struct llog_size_change_rec */
1298         LASSERT((int)sizeof(struct llog_size_change_rec) == 48);
1299         LASSERT(offsetof(struct llog_size_change_rec, lsc_hdr) == 0);
1300         LASSERT((int)sizeof(((struct llog_size_change_rec *)0)->lsc_hdr) == 16);
1301         LASSERT(offsetof(struct llog_size_change_rec, lsc_fid) == 16);
1302         LASSERT((int)sizeof(((struct llog_size_change_rec *)0)->lsc_fid) == 16);
1303         LASSERT(offsetof(struct llog_size_change_rec, lsc_io_epoch) == 32);
1304         LASSERT((int)sizeof(((struct llog_size_change_rec *)0)->lsc_io_epoch) == 4);
1305         LASSERT(offsetof(struct llog_size_change_rec, lsc_tail) == 40);
1306         LASSERT((int)sizeof(((struct llog_size_change_rec *)0)->lsc_tail) == 8);
1307
1308         /* Checks for struct llog_gen */
1309         LASSERT((int)sizeof(struct llog_gen) == 16);
1310         LASSERT(offsetof(struct llog_gen, mnt_cnt) == 0);
1311         LASSERT((int)sizeof(((struct llog_gen *)0)->mnt_cnt) == 8);
1312         LASSERT(offsetof(struct llog_gen, conn_cnt) == 8);
1313         LASSERT((int)sizeof(((struct llog_gen *)0)->conn_cnt) == 8);
1314
1315         /* Checks for struct llog_gen_rec */
1316         LASSERT((int)sizeof(struct llog_gen_rec) == 40);
1317         LASSERT(offsetof(struct llog_gen_rec, lgr_hdr) == 0);
1318         LASSERT((int)sizeof(((struct llog_gen_rec *)0)->lgr_hdr) == 16);
1319         LASSERT(offsetof(struct llog_gen_rec, lgr_gen) == 16);
1320         LASSERT((int)sizeof(((struct llog_gen_rec *)0)->lgr_gen) == 16);
1321         LASSERT(offsetof(struct llog_gen_rec, lgr_tail) == 32);
1322         LASSERT((int)sizeof(((struct llog_gen_rec *)0)->lgr_tail) == 8);
1323
1324         /* Checks for struct llog_log_hdr */
1325         LASSERT((int)sizeof(struct llog_log_hdr) == 4096);
1326         LASSERT(offsetof(struct llog_log_hdr, llh_hdr) == 0);
1327         LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_hdr) == 16);
1328         LASSERT(offsetof(struct llog_log_hdr, llh_timestamp) == 16);
1329         LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_timestamp) == 8);
1330         LASSERT(offsetof(struct llog_log_hdr, llh_count) == 24);
1331         LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_count) == 4);
1332         LASSERT(offsetof(struct llog_log_hdr, llh_bitmap_offset) == 28);
1333         LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_bitmap_offset) == 4);
1334         LASSERT(offsetof(struct llog_log_hdr, llh_size) == 32);
1335         LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_size) == 4);
1336         LASSERT(offsetof(struct llog_log_hdr, llh_flags) == 36);
1337         LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_flags) == 4);
1338         LASSERT(offsetof(struct llog_log_hdr, llh_cat_idx) == 40);
1339         LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_cat_idx) == 4);
1340         LASSERT(offsetof(struct llog_log_hdr, llh_tgtuuid) == 44);
1341         LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_tgtuuid) == 40);
1342         LASSERT(offsetof(struct llog_log_hdr, llh_reserved) == 84);
1343         LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_reserved) == 4);
1344         LASSERT(offsetof(struct llog_log_hdr, llh_bitmap) == 88);
1345         LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_bitmap) == 4000);
1346         LASSERT(offsetof(struct llog_log_hdr, llh_tail) == 4088);
1347         LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_tail) == 8);
1348
1349         /* Checks for struct llog_cookie */
1350         LASSERT((int)sizeof(struct llog_cookie) == 32);
1351         LASSERT(offsetof(struct llog_cookie, lgc_lgl) == 0);
1352         LASSERT((int)sizeof(((struct llog_cookie *)0)->lgc_lgl) == 20);
1353         LASSERT(offsetof(struct llog_cookie, lgc_subsys) == 20);
1354         LASSERT((int)sizeof(((struct llog_cookie *)0)->lgc_subsys) == 4);
1355         LASSERT(offsetof(struct llog_cookie, lgc_index) == 24);
1356         LASSERT((int)sizeof(((struct llog_cookie *)0)->lgc_index) == 4);
1357
1358         /* Checks for struct llogd_body */
1359         LASSERT((int)sizeof(struct llogd_body) == 48);
1360         LASSERT(offsetof(struct llogd_body, lgd_logid) == 0);
1361         LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_logid) == 20);
1362         LASSERT(offsetof(struct llogd_body, lgd_ctxt_idx) == 20);
1363         LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_ctxt_idx) == 4);
1364         LASSERT(offsetof(struct llogd_body, lgd_llh_flags) == 24);
1365         LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_llh_flags) == 4);
1366         LASSERT(offsetof(struct llogd_body, lgd_index) == 28);
1367         LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_index) == 4);
1368         LASSERT(offsetof(struct llogd_body, lgd_saved_index) == 32);
1369         LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_saved_index) == 4);
1370         LASSERT(offsetof(struct llogd_body, lgd_len) == 36);
1371         LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_len) == 4);
1372         LASSERT(offsetof(struct llogd_body, lgd_cur_offset) == 40);
1373         LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_cur_offset) == 8);
1374         LASSERT(LLOG_ORIGIN_HANDLE_CREATE == 501);
1375         LASSERT(LLOG_ORIGIN_HANDLE_NEXT_BLOCK == 502);
1376         LASSERT(LLOG_ORIGIN_HANDLE_READ_HEADER == 503);
1377         LASSERT(LLOG_ORIGIN_HANDLE_WRITE_REC == 504);
1378         LASSERT(LLOG_ORIGIN_HANDLE_CLOSE == 505);
1379         LASSERT(LLOG_ORIGIN_CONNECT == 506);
1380         LASSERT(LLOG_CATINFO == 507);
1381
1382         /* Checks for struct llogd_conn_body */
1383         LASSERT((int)sizeof(struct llogd_conn_body) == 40);
1384         LASSERT(offsetof(struct llogd_conn_body, lgdc_gen) == 0);
1385         LASSERT((int)sizeof(((struct llogd_conn_body *)0)->lgdc_gen) == 16);
1386         LASSERT(offsetof(struct llogd_conn_body, lgdc_logid) == 16);
1387         LASSERT((int)sizeof(((struct llogd_conn_body *)0)->lgdc_logid) == 20);
1388         LASSERT(offsetof(struct llogd_conn_body, lgdc_ctxt_idx) == 36);
1389         LASSERT((int)sizeof(((struct llogd_conn_body *)0)->lgdc_ctxt_idx) == 4);
1390 }
1391 #else
1392 void lustre_assert_wire_constants(void)
1393 {
1394         return;
1395 }
1396 #endif
1397