diff options
author | Tristan Ye <tristan.ye@oracle.com> | 2011-05-24 03:22:59 -0400 |
---|---|---|
committer | Tristan Ye <tristan.ye@oracle.com> | 2011-05-25 00:17:18 -0400 |
commit | 8aa1fa360d0e2b31891f180d8b8e0f8d38f9243c (patch) | |
tree | 26d543b8b88a32db75a286895a12c69c2280b081 /fs/ocfs2 | |
parent | 4a7df24ddc7097cd789a7527187826552ea0765e (diff) |
Ocfs2: Using inline funcs to set/clear *FILLED* flags in info handler.
It just removes some macros for the sake of typechecking gains.
Signed-off-by: Tristan Ye <tristan.ye@oracle.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/ioctl.c | 47 |
1 files changed, 19 insertions, 28 deletions
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c index 8f13c5989eae..373c1d153a99 100644 --- a/fs/ocfs2/ioctl.c +++ b/fs/ocfs2/ioctl.c | |||
@@ -35,32 +35,23 @@ | |||
35 | * be -EFAULT. The error will be returned from the ioctl(2) call. It's | 35 | * be -EFAULT. The error will be returned from the ioctl(2) call. It's |
36 | * just a best-effort to tell userspace that this request caused the error. | 36 | * just a best-effort to tell userspace that this request caused the error. |
37 | */ | 37 | */ |
38 | static inline void __o2info_set_request_error(struct ocfs2_info_request *kreq, | 38 | static inline void o2info_set_request_error(struct ocfs2_info_request *kreq, |
39 | struct ocfs2_info_request __user *req) | 39 | struct ocfs2_info_request __user *req) |
40 | { | 40 | { |
41 | kreq->ir_flags |= OCFS2_INFO_FL_ERROR; | 41 | kreq->ir_flags |= OCFS2_INFO_FL_ERROR; |
42 | (void)put_user(kreq->ir_flags, (__u32 __user *)&(req->ir_flags)); | 42 | (void)put_user(kreq->ir_flags, (__u32 __user *)&(req->ir_flags)); |
43 | } | 43 | } |
44 | 44 | ||
45 | #define o2info_set_request_error(a, b) \ | 45 | static inline void o2info_set_request_filled(struct ocfs2_info_request *req) |
46 | __o2info_set_request_error((struct ocfs2_info_request *)&(a), b) | ||
47 | |||
48 | static inline void __o2info_set_request_filled(struct ocfs2_info_request *req) | ||
49 | { | 46 | { |
50 | req->ir_flags |= OCFS2_INFO_FL_FILLED; | 47 | req->ir_flags |= OCFS2_INFO_FL_FILLED; |
51 | } | 48 | } |
52 | 49 | ||
53 | #define o2info_set_request_filled(a) \ | 50 | static inline void o2info_clear_request_filled(struct ocfs2_info_request *req) |
54 | __o2info_set_request_filled((struct ocfs2_info_request *)&(a)) | ||
55 | |||
56 | static inline void __o2info_clear_request_filled(struct ocfs2_info_request *req) | ||
57 | { | 51 | { |
58 | req->ir_flags &= ~OCFS2_INFO_FL_FILLED; | 52 | req->ir_flags &= ~OCFS2_INFO_FL_FILLED; |
59 | } | 53 | } |
60 | 54 | ||
61 | #define o2info_clear_request_filled(a) \ | ||
62 | __o2info_clear_request_filled((struct ocfs2_info_request *)&(a)) | ||
63 | |||
64 | static int ocfs2_get_inode_attr(struct inode *inode, unsigned *flags) | 55 | static int ocfs2_get_inode_attr(struct inode *inode, unsigned *flags) |
65 | { | 56 | { |
66 | int status; | 57 | int status; |
@@ -153,7 +144,7 @@ int ocfs2_info_handle_blocksize(struct inode *inode, | |||
153 | 144 | ||
154 | oib.ib_blocksize = inode->i_sb->s_blocksize; | 145 | oib.ib_blocksize = inode->i_sb->s_blocksize; |
155 | 146 | ||
156 | o2info_set_request_filled(oib); | 147 | o2info_set_request_filled(&oib.ib_req); |
157 | 148 | ||
158 | if (o2info_to_user(oib, req)) | 149 | if (o2info_to_user(oib, req)) |
159 | goto bail; | 150 | goto bail; |
@@ -161,7 +152,7 @@ int ocfs2_info_handle_blocksize(struct inode *inode, | |||
161 | status = 0; | 152 | status = 0; |
162 | bail: | 153 | bail: |
163 | if (status) | 154 | if (status) |
164 | o2info_set_request_error(oib, req); | 155 | o2info_set_request_error(&oib.ib_req, req); |
165 | 156 | ||
166 | return status; | 157 | return status; |
167 | } | 158 | } |
@@ -178,7 +169,7 @@ int ocfs2_info_handle_clustersize(struct inode *inode, | |||
178 | 169 | ||
179 | oic.ic_clustersize = osb->s_clustersize; | 170 | oic.ic_clustersize = osb->s_clustersize; |
180 | 171 | ||
181 | o2info_set_request_filled(oic); | 172 | o2info_set_request_filled(&oic.ic_req); |
182 | 173 | ||
183 | if (o2info_to_user(oic, req)) | 174 | if (o2info_to_user(oic, req)) |
184 | goto bail; | 175 | goto bail; |
@@ -186,7 +177,7 @@ int ocfs2_info_handle_clustersize(struct inode *inode, | |||
186 | status = 0; | 177 | status = 0; |
187 | bail: | 178 | bail: |
188 | if (status) | 179 | if (status) |
189 | o2info_set_request_error(oic, req); | 180 | o2info_set_request_error(&oic.ic_req, req); |
190 | 181 | ||
191 | return status; | 182 | return status; |
192 | } | 183 | } |
@@ -203,7 +194,7 @@ int ocfs2_info_handle_maxslots(struct inode *inode, | |||
203 | 194 | ||
204 | oim.im_max_slots = osb->max_slots; | 195 | oim.im_max_slots = osb->max_slots; |
205 | 196 | ||
206 | o2info_set_request_filled(oim); | 197 | o2info_set_request_filled(&oim.im_req); |
207 | 198 | ||
208 | if (o2info_to_user(oim, req)) | 199 | if (o2info_to_user(oim, req)) |
209 | goto bail; | 200 | goto bail; |
@@ -211,7 +202,7 @@ int ocfs2_info_handle_maxslots(struct inode *inode, | |||
211 | status = 0; | 202 | status = 0; |
212 | bail: | 203 | bail: |
213 | if (status) | 204 | if (status) |
214 | o2info_set_request_error(oim, req); | 205 | o2info_set_request_error(&oim.im_req, req); |
215 | 206 | ||
216 | return status; | 207 | return status; |
217 | } | 208 | } |
@@ -228,7 +219,7 @@ int ocfs2_info_handle_label(struct inode *inode, | |||
228 | 219 | ||
229 | memcpy(oil.il_label, osb->vol_label, OCFS2_MAX_VOL_LABEL_LEN); | 220 | memcpy(oil.il_label, osb->vol_label, OCFS2_MAX_VOL_LABEL_LEN); |
230 | 221 | ||
231 | o2info_set_request_filled(oil); | 222 | o2info_set_request_filled(&oil.il_req); |
232 | 223 | ||
233 | if (o2info_to_user(oil, req)) | 224 | if (o2info_to_user(oil, req)) |
234 | goto bail; | 225 | goto bail; |
@@ -236,7 +227,7 @@ int ocfs2_info_handle_label(struct inode *inode, | |||
236 | status = 0; | 227 | status = 0; |
237 | bail: | 228 | bail: |
238 | if (status) | 229 | if (status) |
239 | o2info_set_request_error(oil, req); | 230 | o2info_set_request_error(&oil.il_req, req); |
240 | 231 | ||
241 | return status; | 232 | return status; |
242 | } | 233 | } |
@@ -253,7 +244,7 @@ int ocfs2_info_handle_uuid(struct inode *inode, | |||
253 | 244 | ||
254 | memcpy(oiu.iu_uuid_str, osb->uuid_str, OCFS2_TEXT_UUID_LEN + 1); | 245 | memcpy(oiu.iu_uuid_str, osb->uuid_str, OCFS2_TEXT_UUID_LEN + 1); |
255 | 246 | ||
256 | o2info_set_request_filled(oiu); | 247 | o2info_set_request_filled(&oiu.iu_req); |
257 | 248 | ||
258 | if (o2info_to_user(oiu, req)) | 249 | if (o2info_to_user(oiu, req)) |
259 | goto bail; | 250 | goto bail; |
@@ -261,7 +252,7 @@ int ocfs2_info_handle_uuid(struct inode *inode, | |||
261 | status = 0; | 252 | status = 0; |
262 | bail: | 253 | bail: |
263 | if (status) | 254 | if (status) |
264 | o2info_set_request_error(oiu, req); | 255 | o2info_set_request_error(&oiu.iu_req, req); |
265 | 256 | ||
266 | return status; | 257 | return status; |
267 | } | 258 | } |
@@ -280,7 +271,7 @@ int ocfs2_info_handle_fs_features(struct inode *inode, | |||
280 | oif.if_incompat_features = osb->s_feature_incompat; | 271 | oif.if_incompat_features = osb->s_feature_incompat; |
281 | oif.if_ro_compat_features = osb->s_feature_ro_compat; | 272 | oif.if_ro_compat_features = osb->s_feature_ro_compat; |
282 | 273 | ||
283 | o2info_set_request_filled(oif); | 274 | o2info_set_request_filled(&oif.if_req); |
284 | 275 | ||
285 | if (o2info_to_user(oif, req)) | 276 | if (o2info_to_user(oif, req)) |
286 | goto bail; | 277 | goto bail; |
@@ -288,7 +279,7 @@ int ocfs2_info_handle_fs_features(struct inode *inode, | |||
288 | status = 0; | 279 | status = 0; |
289 | bail: | 280 | bail: |
290 | if (status) | 281 | if (status) |
291 | o2info_set_request_error(oif, req); | 282 | o2info_set_request_error(&oif.if_req, req); |
292 | 283 | ||
293 | return status; | 284 | return status; |
294 | } | 285 | } |
@@ -305,7 +296,7 @@ int ocfs2_info_handle_journal_size(struct inode *inode, | |||
305 | 296 | ||
306 | oij.ij_journal_size = osb->journal->j_inode->i_size; | 297 | oij.ij_journal_size = osb->journal->j_inode->i_size; |
307 | 298 | ||
308 | o2info_set_request_filled(oij); | 299 | o2info_set_request_filled(&oij.ij_req); |
309 | 300 | ||
310 | if (o2info_to_user(oij, req)) | 301 | if (o2info_to_user(oij, req)) |
311 | goto bail; | 302 | goto bail; |
@@ -313,7 +304,7 @@ int ocfs2_info_handle_journal_size(struct inode *inode, | |||
313 | status = 0; | 304 | status = 0; |
314 | bail: | 305 | bail: |
315 | if (status) | 306 | if (status) |
316 | o2info_set_request_error(oij, req); | 307 | o2info_set_request_error(&oij.ij_req, req); |
317 | 308 | ||
318 | return status; | 309 | return status; |
319 | } | 310 | } |
@@ -327,7 +318,7 @@ int ocfs2_info_handle_unknown(struct inode *inode, | |||
327 | if (o2info_from_user(oir, req)) | 318 | if (o2info_from_user(oir, req)) |
328 | goto bail; | 319 | goto bail; |
329 | 320 | ||
330 | o2info_clear_request_filled(oir); | 321 | o2info_clear_request_filled(&oir); |
331 | 322 | ||
332 | if (o2info_to_user(oir, req)) | 323 | if (o2info_to_user(oir, req)) |
333 | goto bail; | 324 | goto bail; |
@@ -335,7 +326,7 @@ int ocfs2_info_handle_unknown(struct inode *inode, | |||
335 | status = 0; | 326 | status = 0; |
336 | bail: | 327 | bail: |
337 | if (status) | 328 | if (status) |
338 | o2info_set_request_error(oir, req); | 329 | o2info_set_request_error(&oir, req); |
339 | 330 | ||
340 | return status; | 331 | return status; |
341 | } | 332 | } |