diff options
author | Jeff Mahoney <jeffm@suse.com> | 2014-04-23 10:00:43 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2014-05-06 17:14:24 -0400 |
commit | 16da167c167529e466235414c9e06cf4726e2058 (patch) | |
tree | 46d91baf6dc861ccdbfa28caf07c57fb8cc9187e /fs | |
parent | b491dd1769f11c2cd07278c1e285a63ccb1918ae (diff) |
reiserfs: cleanup, remove unnecessary parens in dirent creation
make_empty_dir_item_v1 and make_empty_dir_item also needed a bit of cleanup
but it's clearer to use separate pointers rather than the array positions
for just two items.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/reiserfs/dir.c | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c index 8d51f28d6345..57b20efd4c3b 100644 --- a/fs/reiserfs/dir.c +++ b/fs/reiserfs/dir.c | |||
@@ -281,65 +281,66 @@ static int reiserfs_readdir(struct file *file, struct dir_context *ctx) | |||
281 | void make_empty_dir_item_v1(char *body, __le32 dirid, __le32 objid, | 281 | void make_empty_dir_item_v1(char *body, __le32 dirid, __le32 objid, |
282 | __le32 par_dirid, __le32 par_objid) | 282 | __le32 par_dirid, __le32 par_objid) |
283 | { | 283 | { |
284 | struct reiserfs_de_head *deh; | 284 | struct reiserfs_de_head *dot, *dotdot; |
285 | 285 | ||
286 | memset(body, 0, EMPTY_DIR_SIZE_V1); | 286 | memset(body, 0, EMPTY_DIR_SIZE_V1); |
287 | deh = (struct reiserfs_de_head *)body; | 287 | dot = (struct reiserfs_de_head *)body; |
288 | dotdot = dot + 1; | ||
288 | 289 | ||
289 | /* direntry header of "." */ | 290 | /* direntry header of "." */ |
290 | put_deh_offset(&(deh[0]), DOT_OFFSET); | 291 | put_deh_offset(dot, DOT_OFFSET); |
291 | /* these two are from make_le_item_head, and are are LE */ | 292 | /* these two are from make_le_item_head, and are are LE */ |
292 | deh[0].deh_dir_id = dirid; | 293 | dot->deh_dir_id = dirid; |
293 | deh[0].deh_objectid = objid; | 294 | dot->deh_objectid = objid; |
294 | deh[0].deh_state = 0; /* Endian safe if 0 */ | 295 | dot->deh_state = 0; /* Endian safe if 0 */ |
295 | put_deh_location(&(deh[0]), EMPTY_DIR_SIZE_V1 - strlen(".")); | 296 | put_deh_location(dot, EMPTY_DIR_SIZE_V1 - strlen(".")); |
296 | mark_de_visible(&(deh[0])); | 297 | mark_de_visible(dot); |
297 | 298 | ||
298 | /* direntry header of ".." */ | 299 | /* direntry header of ".." */ |
299 | put_deh_offset(&(deh[1]), DOT_DOT_OFFSET); | 300 | put_deh_offset(dotdot, DOT_DOT_OFFSET); |
300 | /* key of ".." for the root directory */ | 301 | /* key of ".." for the root directory */ |
301 | /* these two are from the inode, and are are LE */ | 302 | /* these two are from the inode, and are are LE */ |
302 | deh[1].deh_dir_id = par_dirid; | 303 | dotdot->deh_dir_id = par_dirid; |
303 | deh[1].deh_objectid = par_objid; | 304 | dotdot->deh_objectid = par_objid; |
304 | deh[1].deh_state = 0; /* Endian safe if 0 */ | 305 | dotdot->deh_state = 0; /* Endian safe if 0 */ |
305 | put_deh_location(&(deh[1]), deh_location(&(deh[0])) - strlen("..")); | 306 | put_deh_location(dotdot, deh_location(dot) - strlen("..")); |
306 | mark_de_visible(&(deh[1])); | 307 | mark_de_visible(dotdot); |
307 | 308 | ||
308 | /* copy ".." and "." */ | 309 | /* copy ".." and "." */ |
309 | memcpy(body + deh_location(&(deh[0])), ".", 1); | 310 | memcpy(body + deh_location(dot), ".", 1); |
310 | memcpy(body + deh_location(&(deh[1])), "..", 2); | 311 | memcpy(body + deh_location(dotdot), "..", 2); |
311 | } | 312 | } |
312 | 313 | ||
313 | /* compose directory item containing "." and ".." entries */ | 314 | /* compose directory item containing "." and ".." entries */ |
314 | void make_empty_dir_item(char *body, __le32 dirid, __le32 objid, | 315 | void make_empty_dir_item(char *body, __le32 dirid, __le32 objid, |
315 | __le32 par_dirid, __le32 par_objid) | 316 | __le32 par_dirid, __le32 par_objid) |
316 | { | 317 | { |
317 | struct reiserfs_de_head *deh; | 318 | struct reiserfs_de_head *dot, *dotdot; |
318 | 319 | ||
319 | memset(body, 0, EMPTY_DIR_SIZE); | 320 | memset(body, 0, EMPTY_DIR_SIZE); |
320 | deh = (struct reiserfs_de_head *)body; | 321 | dot = (struct reiserfs_de_head *)body; |
322 | dotdot = dot + 1; | ||
321 | 323 | ||
322 | /* direntry header of "." */ | 324 | /* direntry header of "." */ |
323 | put_deh_offset(&(deh[0]), DOT_OFFSET); | 325 | put_deh_offset(dot, DOT_OFFSET); |
324 | /* these two are from make_le_item_head, and are are LE */ | 326 | /* these two are from make_le_item_head, and are are LE */ |
325 | deh[0].deh_dir_id = dirid; | 327 | dot->deh_dir_id = dirid; |
326 | deh[0].deh_objectid = objid; | 328 | dot->deh_objectid = objid; |
327 | deh[0].deh_state = 0; /* Endian safe if 0 */ | 329 | dot->deh_state = 0; /* Endian safe if 0 */ |
328 | put_deh_location(&(deh[0]), EMPTY_DIR_SIZE - ROUND_UP(strlen("."))); | 330 | put_deh_location(dot, EMPTY_DIR_SIZE - ROUND_UP(strlen("."))); |
329 | mark_de_visible(&(deh[0])); | 331 | mark_de_visible(dot); |
330 | 332 | ||
331 | /* direntry header of ".." */ | 333 | /* direntry header of ".." */ |
332 | put_deh_offset(&(deh[1]), DOT_DOT_OFFSET); | 334 | put_deh_offset(dotdot, DOT_DOT_OFFSET); |
333 | /* key of ".." for the root directory */ | 335 | /* key of ".." for the root directory */ |
334 | /* these two are from the inode, and are are LE */ | 336 | /* these two are from the inode, and are are LE */ |
335 | deh[1].deh_dir_id = par_dirid; | 337 | dotdot->deh_dir_id = par_dirid; |
336 | deh[1].deh_objectid = par_objid; | 338 | dotdot->deh_objectid = par_objid; |
337 | deh[1].deh_state = 0; /* Endian safe if 0 */ | 339 | dotdot->deh_state = 0; /* Endian safe if 0 */ |
338 | put_deh_location(&(deh[1]), | 340 | put_deh_location(dotdot, deh_location(dot) - ROUND_UP(strlen(".."))); |
339 | deh_location(&(deh[0])) - ROUND_UP(strlen(".."))); | 341 | mark_de_visible(dotdot); |
340 | mark_de_visible(&(deh[1])); | ||
341 | 342 | ||
342 | /* copy ".." and "." */ | 343 | /* copy ".." and "." */ |
343 | memcpy(body + deh_location(&(deh[0])), ".", 1); | 344 | memcpy(body + deh_location(dot), ".", 1); |
344 | memcpy(body + deh_location(&(deh[1])), "..", 2); | 345 | memcpy(body + deh_location(dotdot), "..", 2); |
345 | } | 346 | } |