util.c (c1f3ee120bb61045b1c0a3ead620d1d65af47130) util.c (163a1859ec6c4c33547bf4613efabf52031566aa)
1/******************************************************************************
2*******************************************************************************
3**
4** Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved.
5**
6** This copyrighted material is made available to anyone wishing to use,
7** modify, copy, or redistribute it subject to the terms and conditions
8** of the GNU General Public License v.2.

--- 117 unchanged lines hidden (view full) ---

126 ms->m_status = le32_to_cpu(ms->m_status);
127 ms->m_grmode = le32_to_cpu(ms->m_grmode);
128 ms->m_rqmode = le32_to_cpu(ms->m_rqmode);
129 ms->m_bastmode = le32_to_cpu(ms->m_bastmode);
130 ms->m_asts = le32_to_cpu(ms->m_asts);
131 ms->m_result = from_dlm_errno(le32_to_cpu(ms->m_result));
132}
133
1/******************************************************************************
2*******************************************************************************
3**
4** Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved.
5**
6** This copyrighted material is made available to anyone wishing to use,
7** modify, copy, or redistribute it subject to the terms and conditions
8** of the GNU General Public License v.2.

--- 117 unchanged lines hidden (view full) ---

126 ms->m_status = le32_to_cpu(ms->m_status);
127 ms->m_grmode = le32_to_cpu(ms->m_grmode);
128 ms->m_rqmode = le32_to_cpu(ms->m_rqmode);
129 ms->m_bastmode = le32_to_cpu(ms->m_bastmode);
130 ms->m_asts = le32_to_cpu(ms->m_asts);
131 ms->m_result = from_dlm_errno(le32_to_cpu(ms->m_result));
132}
133
134static void rcom_lock_out(struct rcom_lock *rl)
135{
136 rl->rl_ownpid = cpu_to_le32(rl->rl_ownpid);
137 rl->rl_lkid = cpu_to_le32(rl->rl_lkid);
138 rl->rl_remid = cpu_to_le32(rl->rl_remid);
139 rl->rl_parent_lkid = cpu_to_le32(rl->rl_parent_lkid);
140 rl->rl_parent_remid = cpu_to_le32(rl->rl_parent_remid);
141 rl->rl_exflags = cpu_to_le32(rl->rl_exflags);
142 rl->rl_flags = cpu_to_le32(rl->rl_flags);
143 rl->rl_lvbseq = cpu_to_le32(rl->rl_lvbseq);
144 rl->rl_result = cpu_to_le32(rl->rl_result);
145 rl->rl_wait_type = cpu_to_le16(rl->rl_wait_type);
146 rl->rl_namelen = cpu_to_le16(rl->rl_namelen);
147}
148
149static void rcom_lock_in(struct rcom_lock *rl)
150{
151 rl->rl_ownpid = le32_to_cpu(rl->rl_ownpid);
152 rl->rl_lkid = le32_to_cpu(rl->rl_lkid);
153 rl->rl_remid = le32_to_cpu(rl->rl_remid);
154 rl->rl_parent_lkid = le32_to_cpu(rl->rl_parent_lkid);
155 rl->rl_parent_remid = le32_to_cpu(rl->rl_parent_remid);
156 rl->rl_exflags = le32_to_cpu(rl->rl_exflags);
157 rl->rl_flags = le32_to_cpu(rl->rl_flags);
158 rl->rl_lvbseq = le32_to_cpu(rl->rl_lvbseq);
159 rl->rl_result = le32_to_cpu(rl->rl_result);
160 rl->rl_wait_type = le16_to_cpu(rl->rl_wait_type);
161 rl->rl_namelen = le16_to_cpu(rl->rl_namelen);
162}
163
164static void rcom_config_out(struct rcom_config *rf)
165{
166 rf->rf_lvblen = cpu_to_le32(rf->rf_lvblen);
167 rf->rf_lsflags = cpu_to_le32(rf->rf_lsflags);
168}
169
170static void rcom_config_in(struct rcom_config *rf)
171{

--- 8 unchanged lines hidden (view full) ---

180 header_out(&rc->rc_header);
181
182 rc->rc_type = cpu_to_le32(rc->rc_type);
183 rc->rc_result = cpu_to_le32(rc->rc_result);
184 rc->rc_id = cpu_to_le64(rc->rc_id);
185 rc->rc_seq = cpu_to_le64(rc->rc_seq);
186 rc->rc_seq_reply = cpu_to_le64(rc->rc_seq_reply);
187
134static void rcom_config_out(struct rcom_config *rf)
135{
136 rf->rf_lvblen = cpu_to_le32(rf->rf_lvblen);
137 rf->rf_lsflags = cpu_to_le32(rf->rf_lsflags);
138}
139
140static void rcom_config_in(struct rcom_config *rf)
141{

--- 8 unchanged lines hidden (view full) ---

150 header_out(&rc->rc_header);
151
152 rc->rc_type = cpu_to_le32(rc->rc_type);
153 rc->rc_result = cpu_to_le32(rc->rc_result);
154 rc->rc_id = cpu_to_le64(rc->rc_id);
155 rc->rc_seq = cpu_to_le64(rc->rc_seq);
156 rc->rc_seq_reply = cpu_to_le64(rc->rc_seq_reply);
157
188 if ((type == DLM_RCOM_LOCK) || (type == DLM_RCOM_LOCK_REPLY))
189 rcom_lock_out((struct rcom_lock *) rc->rc_buf);
190
191 else if (type == DLM_RCOM_STATUS_REPLY)
158 if (type == DLM_RCOM_STATUS_REPLY)
192 rcom_config_out((struct rcom_config *) rc->rc_buf);
193}
194
195void dlm_rcom_in(struct dlm_rcom *rc)
196{
159 rcom_config_out((struct rcom_config *) rc->rc_buf);
160}
161
162void dlm_rcom_in(struct dlm_rcom *rc)
163{
197 int type;
198
199 header_in(&rc->rc_header);
200
201 rc->rc_type = le32_to_cpu(rc->rc_type);
202 rc->rc_result = le32_to_cpu(rc->rc_result);
203 rc->rc_id = le64_to_cpu(rc->rc_id);
204 rc->rc_seq = le64_to_cpu(rc->rc_seq);
205 rc->rc_seq_reply = le64_to_cpu(rc->rc_seq_reply);
206
164 header_in(&rc->rc_header);
165
166 rc->rc_type = le32_to_cpu(rc->rc_type);
167 rc->rc_result = le32_to_cpu(rc->rc_result);
168 rc->rc_id = le64_to_cpu(rc->rc_id);
169 rc->rc_seq = le64_to_cpu(rc->rc_seq);
170 rc->rc_seq_reply = le64_to_cpu(rc->rc_seq_reply);
171
207 type = rc->rc_type;
208
209 if ((type == DLM_RCOM_LOCK) || (type == DLM_RCOM_LOCK_REPLY))
210 rcom_lock_in((struct rcom_lock *) rc->rc_buf);
211
212 else if (type == DLM_RCOM_STATUS_REPLY)
172 if (rc->rc_type == DLM_RCOM_STATUS_REPLY)
213 rcom_config_in((struct rcom_config *) rc->rc_buf);
214}
173 rcom_config_in((struct rcom_config *) rc->rc_buf);
174}
215