+void lustre_swab_hsm_user_state(struct hsm_user_state *state)
+{
+ __swab32s(&state->hus_states);
+ __swab32s(&state->hus_archive_id);
+}
+
+void lustre_swab_hsm_state_set(struct hsm_state_set *hss)
+{
+ __swab32s(&hss->hss_valid);
+ __swab64s(&hss->hss_setmask);
+ __swab64s(&hss->hss_clearmask);
+ __swab32s(&hss->hss_archive_id);
+}
+
+static void lustre_swab_hsm_extent(struct hsm_extent *extent)
+{
+ __swab64s(&extent->offset);
+ __swab64s(&extent->length);
+}
+
+void lustre_swab_hsm_current_action(struct hsm_current_action *action)
+{
+ __swab32s(&action->hca_state);
+ __swab32s(&action->hca_action);
+ lustre_swab_hsm_extent(&action->hca_location);
+}
+
+void lustre_swab_hsm_user_item(struct hsm_user_item *hui)
+{
+ lustre_swab_lu_fid(&hui->hui_fid);
+ lustre_swab_hsm_extent(&hui->hui_extent);
+}
+
+void lustre_swab_layout_intent(struct layout_intent *li)
+{
+ __swab32s(&li->li_opc);
+ __swab32s(&li->li_flags);
+ __swab64s(&li->li_start);
+ __swab64s(&li->li_end);
+}
+
+void lustre_swab_hsm_progress_kernel(struct hsm_progress_kernel *hpk)
+{
+ lustre_swab_lu_fid(&hpk->hpk_fid);
+ __swab64s(&hpk->hpk_cookie);
+ __swab64s(&hpk->hpk_extent.offset);
+ __swab64s(&hpk->hpk_extent.length);
+ __swab16s(&hpk->hpk_flags);
+ __swab16s(&hpk->hpk_errval);
+}
+
+void lustre_swab_hsm_request(struct hsm_request *hr)
+{
+ __swab32s(&hr->hr_action);
+ __swab32s(&hr->hr_archive_id);
+ __swab64s(&hr->hr_flags);
+ __swab32s(&hr->hr_itemcount);
+ __swab32s(&hr->hr_data_len);
+}
+
+void lustre_swab_object_update(struct object_update *ou)
+{
+ struct object_update_param *param;
+ size_t i;
+
+ __swab16s(&ou->ou_type);
+ __swab16s(&ou->ou_params_count);
+ __swab32s(&ou->ou_master_index);
+ __swab32s(&ou->ou_flags);
+ __swab32s(&ou->ou_padding1);
+ __swab64s(&ou->ou_batchid);
+ lustre_swab_lu_fid(&ou->ou_fid);
+ param = &ou->ou_params[0];
+ for (i = 0; i < ou->ou_params_count; i++) {
+ __swab16s(¶m->oup_len);
+ __swab16s(¶m->oup_padding);
+ __swab32s(¶m->oup_padding2);
+ param = (struct object_update_param *)((char *)param +
+ object_update_param_size(param));
+ }
+}
+
+void lustre_swab_object_update_request(struct object_update_request *our)
+{
+ size_t i;
+ __swab32s(&our->ourq_magic);
+ __swab16s(&our->ourq_count);
+ __swab16s(&our->ourq_padding);
+ for (i = 0; i < our->ourq_count; i++) {
+ struct object_update *ou;
+
+ ou = object_update_request_get(our, i, NULL);
+ if (ou == NULL)
+ return;
+ lustre_swab_object_update(ou);
+ }
+}
+
+void lustre_swab_object_update_result(struct object_update_result *our)
+{
+ __swab32s(&our->our_rc);
+ __swab16s(&our->our_datalen);
+ __swab16s(&our->our_padding);
+}
+
+void lustre_swab_object_update_reply(struct object_update_reply *our)
+{
+ size_t i;
+
+ __swab32s(&our->ourp_magic);
+ __swab16s(&our->ourp_count);
+ __swab16s(&our->ourp_padding);
+ for (i = 0; i < our->ourp_count; i++) {
+ struct object_update_result *ourp;
+
+ __swab16s(&our->ourp_lens[i]);
+ ourp = object_update_result_get(our, i, NULL);
+ if (ourp == NULL)
+ return;
+ lustre_swab_object_update_result(ourp);
+ }
+}
+
+void lustre_swab_swap_layouts(struct mdc_swap_layouts *msl)
+{
+ __swab64s(&msl->msl_flags);
+}
+
+void lustre_swab_close_data(struct close_data *cd)
+{
+ lustre_swab_lu_fid(&cd->cd_fid);
+ __swab64s(&cd->cd_data_version);
+}
+
+void lustre_swab_lfsck_request(struct lfsck_request *lr)
+{
+ __swab32s(&lr->lr_event);
+ __swab32s(&lr->lr_index);
+ __swab32s(&lr->lr_flags);
+ __swab32s(&lr->lr_valid);
+ __swab32s(&lr->lr_speed);
+ __swab16s(&lr->lr_version);
+ __swab16s(&lr->lr_active);
+ __swab16s(&lr->lr_param);
+ __swab16s(&lr->lr_async_windows);
+ __swab32s(&lr->lr_flags);
+ lustre_swab_lu_fid(&lr->lr_fid);
+ lustre_swab_lu_fid(&lr->lr_fid2);
+ lustre_swab_lu_fid(&lr->lr_fid3);
+ CLASSERT(offsetof(typeof(*lr), lr_padding_1) != 0);
+ CLASSERT(offsetof(typeof(*lr), lr_padding_2) != 0);
+}
+
+void lustre_swab_lfsck_reply(struct lfsck_reply *lr)
+{
+ __swab32s(&lr->lr_status);
+ CLASSERT(offsetof(typeof(*lr), lr_padding_1) != 0);
+ CLASSERT(offsetof(typeof(*lr), lr_padding_2) != 0);
+}
+
+void lustre_swab_orphan_ent(struct lu_orphan_ent *ent)
+{
+ lustre_swab_lu_fid(&ent->loe_key);
+ lustre_swab_lu_fid(&ent->loe_rec.lor_fid);
+ __swab32s(&ent->loe_rec.lor_uid);
+ __swab32s(&ent->loe_rec.lor_gid);
+}
+EXPORT_SYMBOL(lustre_swab_orphan_ent);