1// SPDX-License-Identifier: GPL-2.0 2/* 3 * GPL HEADER START 4 * 5 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 only, 9 * as published by the Free Software Foundation. 10 * 11 * This program is distributed in the hope that it will be useful, but 12 * WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * General Public License version 2 for more details (a copy is included 15 * in the LICENSE file that accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License 18 * version 2 along with this program; If not, see 19 * http://www.gnu.org/licenses/gpl-2.0.html 20 * 21 * GPL HEADER END 22 */ 23/* 24 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 25 * Use is subject to license terms. 26 * 27 * Copyright (c) 2011, 2014, Intel Corporation. 28 * 29 * Copyright 2015 Cray Inc, all rights reserved. 30 * Author: Ben Evans. 31 * 32 * We assume all nodes are either little-endian or big-endian, and we 33 * always send messages in the sender's native format. The receiver 34 * detects the message format by checking the 'magic' field of the message 35 * (see lustre_msg_swabbed() below). 36 * 37 * Each wire type has corresponding 'lustre_swab_xxxtypexxx()' routines 38 * are implemented in ptlrpc/lustre_swab.c. These 'swabbers' convert the 39 * type from "other" endian, in-place in the message buffer. 40 * 41 * A swabber takes a single pointer argument. The caller must already have 42 * verified that the length of the message buffer >= sizeof (type). 43 * 44 * For variable length types, a second 'lustre_swab_v_xxxtypexxx()' routine 45 * may be defined that swabs just the variable part, after the caller has 46 * verified that the message buffer is large enough. 47 */ 48 49#ifndef _LUSTRE_SWAB_H_ 50#define _LUSTRE_SWAB_H_ 51 52#include <uapi/linux/lustre/lustre_idl.h> 53 54void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb); 55void lustre_swab_connect(struct obd_connect_data *ocd); 56void lustre_swab_hsm_user_state(struct hsm_user_state *hus); 57void lustre_swab_hsm_state_set(struct hsm_state_set *hss); 58void lustre_swab_obd_statfs(struct obd_statfs *os); 59void lustre_swab_obd_ioobj(struct obd_ioobj *ioo); 60void lustre_swab_niobuf_remote(struct niobuf_remote *nbr); 61void lustre_swab_ost_lvb_v1(struct ost_lvb_v1 *lvb); 62void lustre_swab_ost_lvb(struct ost_lvb *lvb); 63void lustre_swab_obd_quotactl(struct obd_quotactl *q); 64void lustre_swab_lquota_lvb(struct lquota_lvb *lvb); 65void lustre_swab_generic_32s(__u32 *val); 66void lustre_swab_mdt_body(struct mdt_body *b); 67void lustre_swab_mdt_ioepoch(struct mdt_ioepoch *b); 68void lustre_swab_mdt_rec_setattr(struct mdt_rec_setattr *sa); 69void lustre_swab_mdt_rec_reint(struct mdt_rec_reint *rr); 70void lustre_swab_lmv_desc(struct lmv_desc *ld); 71void lustre_swab_lmv_mds_md(union lmv_mds_md *lmm); 72void lustre_swab_lov_desc(struct lov_desc *ld); 73void lustre_swab_gl_desc(union ldlm_gl_desc *desc); 74void lustre_swab_ldlm_intent(struct ldlm_intent *i); 75void lustre_swab_ldlm_request(struct ldlm_request *rq); 76void lustre_swab_ldlm_reply(struct ldlm_reply *r); 77void lustre_swab_mgs_target_info(struct mgs_target_info *oinfo); 78void lustre_swab_mgs_nidtbl_entry(struct mgs_nidtbl_entry *oinfo); 79void lustre_swab_mgs_config_body(struct mgs_config_body *body); 80void lustre_swab_mgs_config_res(struct mgs_config_res *body); 81void lustre_swab_ost_body(struct ost_body *b); 82void lustre_swab_ost_last_id(__u64 *id); 83void lustre_swab_fiemap(struct fiemap *fiemap); 84void lustre_swab_lov_user_md_v1(struct lov_user_md_v1 *lum); 85void lustre_swab_lov_user_md_v3(struct lov_user_md_v3 *lum); 86void lustre_swab_lov_user_md_objects(struct lov_user_ost_data *lod, 87 int stripe_count); 88void lustre_swab_lov_mds_md(struct lov_mds_md *lmm); 89void lustre_swab_lustre_capa(struct lustre_capa *c); 90void lustre_swab_lustre_capa_key(struct lustre_capa_key *k); 91void lustre_swab_fid2path(struct getinfo_fid2path *gf); 92void lustre_swab_layout_intent(struct layout_intent *li); 93void lustre_swab_hsm_user_state(struct hsm_user_state *hus); 94void lustre_swab_hsm_current_action(struct hsm_current_action *action); 95void lustre_swab_hsm_progress_kernel(struct hsm_progress_kernel *hpk); 96void lustre_swab_hsm_user_state(struct hsm_user_state *hus); 97void lustre_swab_hsm_user_item(struct hsm_user_item *hui); 98void lustre_swab_hsm_request(struct hsm_request *hr); 99void lustre_swab_swap_layouts(struct mdc_swap_layouts *msl); 100void lustre_swab_close_data(struct close_data *data); 101void lustre_swab_lmv_user_md(struct lmv_user_md *lum); 102 103/* Functions for dumping PTLRPC fields */ 104void dump_rniobuf(struct niobuf_remote *rnb); 105void dump_ioo(struct obd_ioobj *nb); 106void dump_ost_body(struct ost_body *ob); 107void dump_rcs(__u32 *rc); 108 109#endif 110