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