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