1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
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>
9 * This file is part of Lustre, http://www.lustre.org.
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.
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.
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.
24 * (Un)packing of OST requests
28 #define DEBUG_SUBSYSTEM S_RPC
30 # include <liblustre.h>
33 #include <linux/obd_support.h>
34 #include <linux/obd_class.h>
35 #include <linux/lustre_net.h>
36 #include <linux/fcntl.h>
39 #define HDR_SIZE(count) \
40 size_round(offsetof (struct lustre_msg, buflens[(count)]))
42 int lustre_msg_swabbed(struct lustre_msg *msg)
44 return (msg->magic == __swab32(PTLRPC_MSG_MAGIC));
47 int lustre_msg_check_version(struct lustre_msg *msg, __u32 version)
49 if (!lustre_msg_swabbed(msg))
50 return (msg->version & LUSTRE_VERSION_MASK) != version;
52 return (__swab32(msg->version) & LUSTRE_VERSION_MASK) != version;
55 void lustre_init_msg (struct lustre_msg *msg, int count, int *lens, char **bufs)
60 msg->magic = PTLRPC_MSG_MAGIC;
61 msg->version = PTLRPC_MSG_VERSION;
62 msg->bufcount = count;
63 for (i = 0; i < count; i++)
64 msg->buflens[i] = lens[i];
69 ptr = (char *)msg + HDR_SIZE(count);
70 for (i = 0; i < count; i++) {
72 LOGL(tmp, lens[i], ptr);
76 int lustre_pack_request (struct ptlrpc_request *req,
77 int count, int *lens, char **bufs)
81 req->rq_reqlen = lustre_msg_size (count, lens);
82 OBD_ALLOC(req->rq_reqmsg, req->rq_reqlen);
83 if (req->rq_reqmsg == NULL)
86 lustre_init_msg (req->rq_reqmsg, count, lens, bufs);
91 LIST_HEAD(ptlrpc_rs_debug_lru);
92 spinlock_t ptlrpc_rs_debug_lock = SPIN_LOCK_UNLOCKED;
94 #define PTLRPC_RS_DEBUG_LRU_ADD(rs) \
96 unsigned long __flags; \
98 spin_lock_irqsave(&ptlrpc_rs_debug_lock, __flags); \
99 list_add_tail(&(rs)->rs_debug_list, &ptlrpc_rs_debug_lru); \
100 spin_unlock_irqrestore(&ptlrpc_rs_debug_lock, __flags); \
103 #define PTLRPC_RS_DEBUG_LRU_DEL(rs) \
105 unsigned long __flags; \
107 spin_lock_irqsave(&ptlrpc_rs_debug_lock, __flags); \
108 list_del(&(rs)->rs_debug_list); \
109 spin_unlock_irqrestore(&ptlrpc_rs_debug_lock, __flags); \
112 # define PTLRPC_RS_DEBUG_LRU_ADD(rs) do {} while(0)
113 # define PTLRPC_RS_DEBUG_LRU_DEL(rs) do {} while(0)
116 int lustre_pack_reply (struct ptlrpc_request *req,
117 int count, int *lens, char **bufs)
119 struct ptlrpc_reply_state *rs;
124 LASSERT (req->rq_reply_state == NULL);
126 msg_len = lustre_msg_size (count, lens);
127 size = offsetof (struct ptlrpc_reply_state, rs_msg) + msg_len;
128 OBD_ALLOC (rs, size);
132 rs->rs_cb_id.cbid_fn = reply_out_callback;
133 rs->rs_cb_id.cbid_arg = rs;
134 rs->rs_srv_ni = req->rq_rqbd->rqbd_srv_ni;
136 INIT_LIST_HEAD(&rs->rs_exp_list);
137 INIT_LIST_HEAD(&rs->rs_obd_list);
139 req->rq_replen = msg_len;
140 req->rq_reply_state = rs;
141 req->rq_repmsg = &rs->rs_msg;
142 lustre_init_msg (&rs->rs_msg, count, lens, bufs);
144 PTLRPC_RS_DEBUG_LRU_ADD(rs);
149 void lustre_free_reply_state (struct ptlrpc_reply_state *rs)
151 PTLRPC_RS_DEBUG_LRU_DEL(rs);
153 LASSERT (!rs->rs_difficult || rs->rs_handled);
154 LASSERT (!rs->rs_on_net);
155 LASSERT (!rs->rs_scheduled);
156 LASSERT (rs->rs_export == NULL);
157 LASSERT (rs->rs_nlocks == 0);
158 LASSERT (list_empty(&rs->rs_exp_list));
159 LASSERT (list_empty(&rs->rs_obd_list));
161 OBD_FREE (rs, rs->rs_size);
164 /* This returns the size of the buffer that is required to hold a lustre_msg
165 * with the given sub-buffer lengths. */
166 int lustre_msg_size(int count, int *lengths)
171 size = HDR_SIZE (count);
172 for (i = 0; i < count; i++)
173 size += size_round(lengths[i]);
178 int lustre_unpack_msg(struct lustre_msg *m, int len)
185 /* We can provide a slightly better error log, if we check the
186 * message magic and version first. In the future, struct
187 * lustre_msg may grow, and we'd like to log a version mismatch,
188 * rather than a short message.
191 required_len = MAX (offsetof (struct lustre_msg, version) +
193 offsetof (struct lustre_msg, magic) +
195 if (len < required_len) {
196 /* can't even look inside the message */
197 CERROR ("message length %d too small for magic/version check\n",
202 flipped = lustre_msg_swabbed(m);
204 __swab32s (&m->version);
205 else if (m->magic != PTLRPC_MSG_MAGIC) {
206 CERROR("wrong lustre_msg magic %#08x\n", m->magic);
210 if ((m->version & ~LUSTRE_VERSION_MASK) != PTLRPC_MSG_VERSION) {
211 CERROR("wrong lustre_msg version %#08x\n", m->version);
215 /* Now we know the sender speaks my language (but possibly flipped)...*/
216 required_len = HDR_SIZE(0);
217 if (len < required_len) {
218 /* can't even look inside the message */
219 CERROR ("message length %d too small for lustre_msg\n", len);
224 __swab32s (&m->type);
226 __swab64s (&m->last_xid);
227 __swab64s (&m->last_committed);
228 __swab64s (&m->transno);
229 __swab32s (&m->status);
230 __swab32s (&m->bufcount);
231 __swab32s (&m->flags);
234 required_len = HDR_SIZE(m->bufcount);
236 if (len < required_len) {
237 /* didn't receive all the buffer lengths */
238 CERROR ("message length %d too small for %d buflens\n",
243 for (i = 0; i < m->bufcount; i++) {
245 __swab32s (&m->buflens[i]);
246 required_len += size_round(m->buflens[i]);
249 if (len < required_len) {
250 CERROR("len: %d, required_len %d\n", len, required_len);
251 CERROR("bufcount: %d\n", m->bufcount);
252 for (i = 0; i < m->bufcount; i++)
253 CERROR("buffer %d length %d\n", i, m->buflens[i]);
260 void *lustre_msg_buf(struct lustre_msg *m, int n, int min_size)
270 bufcount = m->bufcount;
272 CDEBUG(D_INFO, "msg %p buffer[%d] not present (count %d)\n",
277 buflen = m->buflens[n];
278 if (buflen < min_size) {
279 CERROR("msg %p buffer[%d] size %d too small (required %d)\n",
280 m, n, buflen, min_size);
284 offset = HDR_SIZE(bufcount);
285 for (i = 0; i < n; i++)
286 offset += size_round(m->buflens[i]);
288 return (char *)m + offset;
291 char *lustre_msg_string (struct lustre_msg *m, int index, int max_len)
293 /* max_len == 0 means the string should fill the buffer */
294 char *str = lustre_msg_buf (m, index, 0);
299 CERROR ("can't unpack string in msg %p buffer[%d]\n", m, index);
303 blen = m->buflens[index];
304 slen = strnlen (str, blen);
306 if (slen == blen) { /* not NULL terminated */
307 CERROR ("can't unpack non-NULL terminated string in "
308 "msg %p buffer[%d] len %d\n", m, index, blen);
313 if (slen != blen - 1) {
314 CERROR ("can't unpack short string in msg %p "
315 "buffer[%d] len %d: strlen %d\n",
316 m, index, blen, slen);
319 } else if (slen > max_len) {
320 CERROR ("can't unpack oversized string in msg %p "
321 "buffer[%d] len %d strlen %d: max %d expected\n",
322 m, index, blen, slen, max_len);
329 /* Wrap up the normal fixed length cases */
330 void *lustre_swab_buf(struct lustre_msg *msg, int index, int min_size,
335 ptr = lustre_msg_buf(msg, index, min_size);
339 if (swabber != NULL && lustre_msg_swabbed(msg))
340 ((void (*)(void *))swabber)(ptr);
345 void *lustre_swab_reqbuf(struct ptlrpc_request *req, int index, int min_size,
348 LASSERT_REQSWAB(req, index);
349 return lustre_swab_buf(req->rq_reqmsg, index, min_size, swabber);
352 void *lustre_swab_repbuf(struct ptlrpc_request *req, int index, int min_size,
355 LASSERT_REPSWAB(req, index);
356 return lustre_swab_buf(req->rq_repmsg, index, min_size, swabber);
359 /* byte flipping routines for all wire types declared in
360 * lustre_idl.h implemented here.
363 void lustre_swab_obdo (struct obdo *o)
365 __swab64s (&o->o_id);
366 __swab64s (&o->o_gr);
367 __swab64s (&o->o_atime);
368 __swab64s (&o->o_mtime);
369 __swab64s (&o->o_ctime);
370 __swab64s (&o->o_size);
371 __swab64s (&o->o_blocks);
372 __swab64s (&o->o_grant);
373 __swab32s (&o->o_blksize);
374 __swab32s (&o->o_mode);
375 __swab32s (&o->o_uid);
376 __swab32s (&o->o_gid);
377 __swab32s (&o->o_flags);
378 __swab32s (&o->o_nlink);
379 __swab32s (&o->o_generation);
380 __swab64s (&o->o_valid);
381 __swab32s (&o->o_misc);
382 __swab32s (&o->o_easize);
383 __swab32s (&o->o_mds);
384 __swab64s (&o->o_fid);
385 /* o_inline is opaque */
388 /* mdc pack methods used by mdc and smfs*/
389 void *mdc_create_pack(struct lustre_msg *msg, int offset,
390 struct mdc_op_data *op_data, __u32 mode,
391 __u64 rdev, const void *data, int datalen)
393 struct mds_rec_create *rec;
395 rec = lustre_msg_buf(msg, offset, sizeof (*rec));
397 rec->cr_opcode = REINT_CREATE;
398 rec->cr_id = op_data->id1;
399 memset(&rec->cr_replayid, 0, sizeof(rec->cr_replayid));
402 rec->cr_time = op_data->mod_time;
404 tmp = lustre_msg_buf(msg, offset + 1, op_data->namelen + 1);
405 LOGL0(op_data->name, op_data->namelen, tmp);
408 tmp = lustre_msg_buf(msg, offset + 2, datalen);
409 memcpy (tmp, data, datalen);
411 return ((void*)tmp + size_round(datalen));
414 void *mdc_setattr_pack(struct lustre_msg *msg, int offset,
415 struct mdc_op_data *data, struct iattr *iattr,
416 void *ea, int ealen, void *ea2, int ea2len)
418 struct mds_rec_setattr *rec = lustre_msg_buf(msg, offset, sizeof(*rec));
421 rec->sa_opcode = REINT_SETATTR;
422 rec->sa_id = data->id1;
425 rec->sa_valid = iattr->ia_valid;
426 rec->sa_mode = iattr->ia_mode;
427 rec->sa_uid = iattr->ia_uid;
428 rec->sa_gid = iattr->ia_gid;
429 rec->sa_size = iattr->ia_size;
430 rec->sa_atime = LTIME_S(iattr->ia_atime);
431 rec->sa_mtime = LTIME_S(iattr->ia_mtime);
432 rec->sa_ctime = LTIME_S(iattr->ia_ctime);
433 rec->sa_attr_flags = iattr->ia_attr_flags;
435 tmp = (char*)rec + size_round(sizeof(*rec));
440 memcpy(lustre_msg_buf(msg, offset + 1, ealen), ea, ealen);
441 tmp += size_round(ealen);
446 memcpy(lustre_msg_buf(msg, offset + 2, ea2len), ea2, ea2len);
447 tmp += size_round(ea2len);
451 void *mdc_unlink_pack(struct lustre_msg *msg, int offset,
452 struct mdc_op_data *data)
454 struct mds_rec_unlink *rec;
457 rec = lustre_msg_buf(msg, offset, sizeof (*rec));
458 LASSERT (rec != NULL);
460 rec->ul_opcode = REINT_UNLINK;
461 rec->ul_mode = data->create_mode;
462 rec->ul_id1 = data->id1;
463 rec->ul_id2 = data->id2;
464 rec->ul_time = data->mod_time;
466 tmp = lustre_msg_buf(msg, offset + 1, data->namelen + 1);
467 LASSERT (tmp != NULL);
468 LOGL0(data->name, data->namelen, tmp);
472 void *mdc_link_pack(struct lustre_msg *msg, int offset,
473 struct mdc_op_data *data)
475 struct mds_rec_link *rec;
478 rec = lustre_msg_buf(msg, offset, sizeof (*rec));
480 rec->lk_opcode = REINT_LINK;
481 rec->lk_id1 = data->id1;
482 rec->lk_id2 = data->id2;
483 rec->lk_time = data->mod_time;
485 tmp = lustre_msg_buf(msg, offset + 1, data->namelen + 1);
486 LOGL0(data->name, data->namelen, tmp);
491 void *mdc_rename_pack(struct lustre_msg *msg, int offset,
492 struct mdc_op_data *data,
493 const char *old, int oldlen,
494 const char *new, int newlen)
496 struct mds_rec_rename *rec;
499 rec = lustre_msg_buf(msg, offset, sizeof (*rec));
501 /* XXX do something about time, uid, gid */
502 rec->rn_opcode = REINT_RENAME;
503 rec->rn_id1 = data->id1;
504 rec->rn_id2 = data->id2;
505 rec->rn_time = data->mod_time;
507 tmp = lustre_msg_buf(msg, offset + 1, oldlen + 1);
508 LOGL0(old, oldlen, tmp);
511 tmp = lustre_msg_buf(msg, offset + 2, newlen + 1);
512 LOGL0(new, newlen, tmp);
517 void lustre_swab_obd_statfs (struct obd_statfs *os)
519 __swab64s (&os->os_type);
520 __swab64s (&os->os_blocks);
521 __swab64s (&os->os_bfree);
522 __swab64s (&os->os_bavail);
523 __swab64s (&os->os_ffree);
524 /* no need to swap os_fsid */
525 __swab32s (&os->os_bsize);
526 __swab32s (&os->os_namelen);
527 /* no need to swap os_spare */
530 void lustre_swab_obd_ioobj (struct obd_ioobj *ioo)
532 __swab64s (&ioo->ioo_id);
533 __swab64s (&ioo->ioo_gr);
534 __swab32s (&ioo->ioo_type);
535 __swab32s (&ioo->ioo_bufcnt);
538 void lustre_swab_niobuf_remote (struct niobuf_remote *nbr)
540 __swab64s (&nbr->offset);
541 __swab32s (&nbr->len);
542 __swab32s (&nbr->flags);
545 void lustre_swab_ost_body (struct ost_body *b)
547 lustre_swab_obdo (&b->oa);
550 void lustre_swab_ost_last_id(obd_id *id)
555 void lustre_swab_generic_32s(__u32 *val)
560 void lustre_swab_ost_lvb(struct ost_lvb *lvb)
562 __swab64s(&lvb->lvb_size);
563 __swab64s(&lvb->lvb_mtime);
564 __swab64s(&lvb->lvb_atime);
565 __swab64s(&lvb->lvb_ctime);
566 __swab64s(&lvb->lvb_blocks);
569 void lustre_swab_lustre_stc (struct lustre_stc *stc)
571 __swab64s (&stc->u.e3s.l3s_ino);
572 __swab32s (&stc->u.e3s.l3s_gen);
573 __swab32s (&stc->u.e3s.l3s_type);
576 void lustre_swab_lustre_fid(struct lustre_fid *fid)
578 __swab64s (&fid->lf_id);
579 __swab64s (&fid->lf_group);
580 __swab32s (&fid->lf_version);
583 void lustre_swab_lustre_id (struct lustre_id *id)
585 lustre_swab_lustre_stc(&id->li_stc);
586 lustre_swab_lustre_fid(&id->li_fid);
589 void lustre_swab_mds_status_req (struct mds_status_req *r)
591 __swab32s (&r->flags);
592 __swab32s (&r->repbuf);
596 * because sec_desc is variable buffer, we must check it by hand
598 struct mds_req_sec_desc *lustre_swab_mds_secdesc(struct ptlrpc_request *req,
601 struct mds_req_sec_desc *rsd;
602 struct lustre_msg *m;
605 LASSERT_REQSWAB(req, offset);
608 rsd = lustre_msg_buf(m, offset, sizeof(*rsd));
612 if (lustre_msg_swabbed(m)) {
613 __swab32s(&rsd->rsd_uid);
614 __swab32s(&rsd->rsd_gid);
615 __swab32s(&rsd->rsd_fsuid);
616 __swab32s(&rsd->rsd_fsgid);
617 __swab32s(&rsd->rsd_cap);
618 __swab32s(&rsd->rsd_ngroups);
621 if (m->buflens[offset] !=
622 sizeof(*rsd) + rsd->rsd_ngroups * sizeof(__u32)) {
623 CERROR("bufflen %u while contains %u groups\n",
624 m->buflens[offset], rsd->rsd_ngroups);
628 if (lustre_msg_swabbed(m)) {
629 for (i = 0; i < rsd->rsd_ngroups; i++)
630 __swab32s(&rsd->rsd_groups[i]);
636 void lustre_swab_mds_body (struct mds_body *b)
638 lustre_swab_lustre_id (&b->id1);
639 lustre_swab_lustre_id (&b->id2);
640 /* handle is opaque */
641 __swab64s (&b->size);
642 __swab64s (&b->blocks);
643 __swab64s (&b->valid);
644 __swab32s (&b->mode);
647 __swab32s (&b->mtime);
648 __swab32s (&b->ctime);
649 __swab32s (&b->atime);
650 __swab32s (&b->flags);
651 __swab32s (&b->rdev);
652 __swab32s (&b->nlink);
653 __swab32s (&b->eadatasize);
655 void lustre_swab_mds_rec_setattr (struct mds_rec_setattr *sa)
657 __swab32s (&sa->sa_opcode);
658 __swab32s (&sa->sa_valid);
659 lustre_swab_lustre_id (&sa->sa_id);
660 __swab32s (&sa->sa_mode);
661 __swab32s (&sa->sa_uid);
662 __swab32s (&sa->sa_gid);
663 __swab32s (&sa->sa_attr_flags);
664 __swab64s (&sa->sa_size);
665 __swab64s (&sa->sa_atime);
666 __swab64s (&sa->sa_mtime);
667 __swab64s (&sa->sa_ctime);
670 void lustre_swab_mds_rec_create (struct mds_rec_create *cr)
672 __swab32s (&cr->cr_opcode);
673 __swab32s (&cr->cr_flags); /* for use with open */
674 __swab32s (&cr->cr_mode);
675 lustre_swab_lustre_id (&cr->cr_id);
676 lustre_swab_lustre_id (&cr->cr_replayid);
677 __swab64s (&cr->cr_time);
678 __swab64s (&cr->cr_rdev);
681 void lustre_swab_mds_rec_link (struct mds_rec_link *lk)
683 __swab32s (&lk->lk_opcode);
684 lustre_swab_lustre_id (&lk->lk_id1);
685 lustre_swab_lustre_id (&lk->lk_id2);
688 void lustre_swab_mds_rec_unlink (struct mds_rec_unlink *ul)
690 __swab32s (&ul->ul_opcode);
691 __swab32s (&ul->ul_mode);
692 lustre_swab_lustre_id (&ul->ul_id1);
693 lustre_swab_lustre_id (&ul->ul_id2);
696 void lustre_swab_mds_rec_rename (struct mds_rec_rename *rn)
698 __swab32s (&rn->rn_opcode);
699 lustre_swab_lustre_id (&rn->rn_id1);
700 lustre_swab_lustre_id (&rn->rn_id2);
703 void lustre_swab_lov_desc (struct lov_desc *ld)
705 __swab32s (&ld->ld_tgt_count);
706 __swab32s (&ld->ld_active_tgt_count);
707 __swab32s (&ld->ld_default_stripe_count);
708 __swab64s (&ld->ld_default_stripe_size);
709 __swab64s (&ld->ld_default_stripe_offset);
710 __swab32s (&ld->ld_pattern);
711 /* uuid endian insensitive */
714 void lustre_swab_ldlm_res_id (struct ldlm_res_id *id)
718 for (i = 0; i < RES_NAME_SIZE; i++)
719 __swab64s (&id->name[i]);
722 void lustre_swab_ldlm_policy_data (ldlm_policy_data_t *d)
724 /* the lock data is a union and the first three fields of both EXTENT
725 * and FLOCK types are __u64, so it's ok to swab them in the same way */
726 __swab64s (&d->l_flock.start);
727 __swab64s (&d->l_flock.end);
728 __swab64s (&d->l_flock.pid);
729 __swab64s (&d->l_flock.blocking_pid);
732 void lustre_swab_ldlm_intent (struct ldlm_intent *i)
737 void lustre_swab_ldlm_resource_desc (struct ldlm_resource_desc *r)
739 __swab32s (&r->lr_type);
740 lustre_swab_ldlm_res_id (&r->lr_name);
743 void lustre_swab_ldlm_lock_desc (struct ldlm_lock_desc *l)
745 lustre_swab_ldlm_resource_desc (&l->l_resource);
746 __swab32s (&l->l_req_mode);
747 __swab32s (&l->l_granted_mode);
748 lustre_swab_ldlm_policy_data (&l->l_policy_data);
751 void lustre_swab_ldlm_request (struct ldlm_request *rq)
753 __swab32s (&rq->lock_flags);
754 lustre_swab_ldlm_lock_desc (&rq->lock_desc);
755 /* lock_handle1 opaque */
756 /* lock_handle2 opaque */
759 void lustre_swab_ldlm_reply (struct ldlm_reply *r)
761 __swab32s (&r->lock_flags);
762 lustre_swab_ldlm_lock_desc (&r->lock_desc);
763 /* lock_handle opaque */
764 __swab64s (&r->lock_policy_res1);
765 __swab64s (&r->lock_policy_res2);
768 void lustre_swab_ptlbd_op (struct ptlbd_op *op)
770 __swab16s (&op->op_cmd);
771 __swab16s (&op->op_lun);
772 __swab16s (&op->op_niob_cnt);
773 /* ignore op__padding */
774 __swab32s (&op->op_block_cnt);
777 void lustre_swab_ptlbd_niob (struct ptlbd_niob *n)
779 __swab64s (&n->n_xid);
780 __swab64s (&n->n_block_nr);
781 __swab32s (&n->n_offset);
782 __swab32s (&n->n_length);
785 void lustre_swab_ptlbd_rsp (struct ptlbd_rsp *r)
787 __swab16s (&r->r_status);
788 __swab16s (&r->r_error_cnt);
791 /* no one calls this */
792 int llog_log_swabbed(struct llog_log_hdr *hdr)
794 if (hdr->llh_hdr.lrh_type == __swab32(LLOG_HDR_MAGIC))
796 if (hdr->llh_hdr.lrh_type == LLOG_HDR_MAGIC)
801 void lustre_swab_llogd_body (struct llogd_body *d)
803 __swab64s (&d->lgd_logid.lgl_oid);
804 __swab64s (&d->lgd_logid.lgl_ogr);
805 __swab32s (&d->lgd_logid.lgl_ogen);
806 __swab32s (&d->lgd_ctxt_idx);
807 __swab32s (&d->lgd_llh_flags);
808 __swab32s (&d->lgd_index);
809 __swab32s (&d->lgd_saved_index);
810 __swab32s (&d->lgd_len);
811 __swab64s (&d->lgd_cur_offset);
814 void lustre_swab_llog_hdr (struct llog_log_hdr *h)
816 __swab32s (&h->llh_hdr.lrh_index);
817 __swab32s (&h->llh_hdr.lrh_len);
818 __swab32s (&h->llh_hdr.lrh_type);
819 __swab64s (&h->llh_timestamp);
820 __swab32s (&h->llh_count);
821 __swab32s (&h->llh_bitmap_offset);
822 __swab32s (&h->llh_flags);
823 __swab32s (&h->llh_tail.lrt_index);
824 __swab32s (&h->llh_tail.lrt_len);
827 void lustre_swab_llogd_conn_body (struct llogd_conn_body *d)
829 __swab64s (&d->lgdc_gen.mnt_cnt);
830 __swab64s (&d->lgdc_gen.conn_cnt);
831 __swab64s (&d->lgdc_logid.lgl_oid);
832 __swab64s (&d->lgdc_logid.lgl_ogr);
833 __swab32s (&d->lgdc_logid.lgl_ogen);
834 __swab32s (&d->lgdc_ctxt_idx);
837 void lustre_assert_wire_constants(void)