diff options
| author | Tristan Ye <tristan.ye@oracle.com> | 2011-01-30 01:25:59 -0500 |
|---|---|---|
| committer | Joel Becker <jlbec@evilplan.org> | 2011-02-20 06:56:16 -0500 |
| commit | 1936a267f1b5a32d4a846608fdcce82ca0f6ac8e (patch) | |
| tree | df86547732db46dab5d1529ff310eebc117ded3b /fs | |
| parent | 1dd9ffc827b8591aabcf5fea6ea83b69e846deb9 (diff) | |
Ocfs2: Using macro to set/clear *FILLED* flags in info handler.
It's a best-effort attempt to simplize duplicated codes here.
Signed-off-by: Tristan Ye <tristan.ye@oracle.com>
Signed-off-by: Joel Becker <jlbec@evilplan.org>
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/ocfs2/ioctl.c | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c index 7a4868196152..731cf4670b97 100644 --- a/fs/ocfs2/ioctl.c +++ b/fs/ocfs2/ioctl.c | |||
| @@ -46,6 +46,22 @@ static inline void __o2info_set_request_error(struct ocfs2_info_request *kreq, | |||
| 46 | #define o2info_set_request_error(a, b) \ | 46 | #define o2info_set_request_error(a, b) \ |
| 47 | __o2info_set_request_error((struct ocfs2_info_request *)&(a), b) | 47 | __o2info_set_request_error((struct ocfs2_info_request *)&(a), b) |
| 48 | 48 | ||
| 49 | static inline void __o2info_set_request_filled(struct ocfs2_info_request *req) | ||
| 50 | { | ||
| 51 | req->ir_flags |= OCFS2_INFO_FL_FILLED; | ||
| 52 | } | ||
| 53 | |||
| 54 | #define o2info_set_request_filled(a) \ | ||
| 55 | __o2info_set_request_filled((struct ocfs2_info_request *)&(a)) | ||
| 56 | |||
| 57 | static inline void __o2info_clear_request_filled(struct ocfs2_info_request *req) | ||
| 58 | { | ||
| 59 | req->ir_flags &= ~OCFS2_INFO_FL_FILLED; | ||
| 60 | } | ||
| 61 | |||
| 62 | #define o2info_clear_request_filled(a) \ | ||
| 63 | __o2info_clear_request_filled((struct ocfs2_info_request *)&(a)) | ||
| 64 | |||
| 49 | static int ocfs2_get_inode_attr(struct inode *inode, unsigned *flags) | 65 | static int ocfs2_get_inode_attr(struct inode *inode, unsigned *flags) |
| 50 | { | 66 | { |
| 51 | int status; | 67 | int status; |
| @@ -139,7 +155,8 @@ int ocfs2_info_handle_blocksize(struct inode *inode, | |||
| 139 | goto bail; | 155 | goto bail; |
| 140 | 156 | ||
| 141 | oib.ib_blocksize = inode->i_sb->s_blocksize; | 157 | oib.ib_blocksize = inode->i_sb->s_blocksize; |
| 142 | oib.ib_req.ir_flags |= OCFS2_INFO_FL_FILLED; | 158 | |
| 159 | o2info_set_request_filled(oib); | ||
| 143 | 160 | ||
| 144 | if (o2info_to_user(oib, req)) | 161 | if (o2info_to_user(oib, req)) |
| 145 | goto bail; | 162 | goto bail; |
| @@ -163,7 +180,8 @@ int ocfs2_info_handle_clustersize(struct inode *inode, | |||
| 163 | goto bail; | 180 | goto bail; |
| 164 | 181 | ||
| 165 | oic.ic_clustersize = osb->s_clustersize; | 182 | oic.ic_clustersize = osb->s_clustersize; |
| 166 | oic.ic_req.ir_flags |= OCFS2_INFO_FL_FILLED; | 183 | |
| 184 | o2info_set_request_filled(oic); | ||
| 167 | 185 | ||
| 168 | if (o2info_to_user(oic, req)) | 186 | if (o2info_to_user(oic, req)) |
| 169 | goto bail; | 187 | goto bail; |
| @@ -187,7 +205,8 @@ int ocfs2_info_handle_maxslots(struct inode *inode, | |||
| 187 | goto bail; | 205 | goto bail; |
| 188 | 206 | ||
| 189 | oim.im_max_slots = osb->max_slots; | 207 | oim.im_max_slots = osb->max_slots; |
| 190 | oim.im_req.ir_flags |= OCFS2_INFO_FL_FILLED; | 208 | |
| 209 | o2info_set_request_filled(oim); | ||
| 191 | 210 | ||
| 192 | if (o2info_to_user(oim, req)) | 211 | if (o2info_to_user(oim, req)) |
| 193 | goto bail; | 212 | goto bail; |
| @@ -211,7 +230,8 @@ int ocfs2_info_handle_label(struct inode *inode, | |||
| 211 | goto bail; | 230 | goto bail; |
| 212 | 231 | ||
| 213 | memcpy(oil.il_label, osb->vol_label, OCFS2_MAX_VOL_LABEL_LEN); | 232 | memcpy(oil.il_label, osb->vol_label, OCFS2_MAX_VOL_LABEL_LEN); |
| 214 | oil.il_req.ir_flags |= OCFS2_INFO_FL_FILLED; | 233 | |
| 234 | o2info_set_request_filled(oil); | ||
| 215 | 235 | ||
| 216 | if (o2info_to_user(oil, req)) | 236 | if (o2info_to_user(oil, req)) |
| 217 | goto bail; | 237 | goto bail; |
| @@ -235,7 +255,8 @@ int ocfs2_info_handle_uuid(struct inode *inode, | |||
| 235 | goto bail; | 255 | goto bail; |
| 236 | 256 | ||
| 237 | memcpy(oiu.iu_uuid_str, osb->uuid_str, OCFS2_TEXT_UUID_LEN + 1); | 257 | memcpy(oiu.iu_uuid_str, osb->uuid_str, OCFS2_TEXT_UUID_LEN + 1); |
| 238 | oiu.iu_req.ir_flags |= OCFS2_INFO_FL_FILLED; | 258 | |
| 259 | o2info_set_request_filled(oiu); | ||
| 239 | 260 | ||
| 240 | if (o2info_to_user(oiu, req)) | 261 | if (o2info_to_user(oiu, req)) |
| 241 | goto bail; | 262 | goto bail; |
| @@ -261,7 +282,8 @@ int ocfs2_info_handle_fs_features(struct inode *inode, | |||
| 261 | oif.if_compat_features = osb->s_feature_compat; | 282 | oif.if_compat_features = osb->s_feature_compat; |
| 262 | oif.if_incompat_features = osb->s_feature_incompat; | 283 | oif.if_incompat_features = osb->s_feature_incompat; |
| 263 | oif.if_ro_compat_features = osb->s_feature_ro_compat; | 284 | oif.if_ro_compat_features = osb->s_feature_ro_compat; |
| 264 | oif.if_req.ir_flags |= OCFS2_INFO_FL_FILLED; | 285 | |
| 286 | o2info_set_request_filled(oif); | ||
| 265 | 287 | ||
| 266 | if (o2info_to_user(oif, req)) | 288 | if (o2info_to_user(oif, req)) |
| 267 | goto bail; | 289 | goto bail; |
| @@ -286,7 +308,7 @@ int ocfs2_info_handle_journal_size(struct inode *inode, | |||
| 286 | 308 | ||
| 287 | oij.ij_journal_size = osb->journal->j_inode->i_size; | 309 | oij.ij_journal_size = osb->journal->j_inode->i_size; |
| 288 | 310 | ||
| 289 | oij.ij_req.ir_flags |= OCFS2_INFO_FL_FILLED; | 311 | o2info_set_request_filled(oij); |
| 290 | 312 | ||
| 291 | if (o2info_to_user(oij, req)) | 313 | if (o2info_to_user(oij, req)) |
| 292 | goto bail; | 314 | goto bail; |
| @@ -308,7 +330,7 @@ int ocfs2_info_handle_unknown(struct inode *inode, | |||
| 308 | if (o2info_from_user(oir, req)) | 330 | if (o2info_from_user(oir, req)) |
| 309 | goto bail; | 331 | goto bail; |
| 310 | 332 | ||
| 311 | oir.ir_flags &= ~OCFS2_INFO_FL_FILLED; | 333 | o2info_clear_request_filled(oir); |
| 312 | 334 | ||
| 313 | if (o2info_to_user(oir, req)) | 335 | if (o2info_to_user(oir, req)) |
| 314 | goto bail; | 336 | goto bail; |
