aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fat/inode.c
diff options
context:
space:
mode:
authorSteven J. Magnani <steve@digidescorp.com>2012-07-30 17:42:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-30 20:25:19 -0400
commita943ed71c9171fb5e3b256e8022bbedff95cc826 (patch)
treee4b3a997bac0a802677557dbc52e5a55fb526a28 /fs/fat/inode.c
parent497d48bd27ec1c44b4600e8e98a776188f2e11f2 (diff)
fat: accessors for msdos_dir_entry 'start' fields
Simplify code by providing accessor functions for the directory entry start cluster fields. Signed-off-by: Steven J. Magnani <steve@digidescorp.com> Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/fat/inode.c')
-rw-r--r--fs/fat/inode.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 0038b32cb362..05e897fe9866 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -369,10 +369,7 @@ static int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de)
369 inode->i_op = sbi->dir_ops; 369 inode->i_op = sbi->dir_ops;
370 inode->i_fop = &fat_dir_operations; 370 inode->i_fop = &fat_dir_operations;
371 371
372 MSDOS_I(inode)->i_start = le16_to_cpu(de->start); 372 MSDOS_I(inode)->i_start = fat_get_start(sbi, de);
373 if (sbi->fat_bits == 32)
374 MSDOS_I(inode)->i_start |= (le16_to_cpu(de->starthi) << 16);
375
376 MSDOS_I(inode)->i_logstart = MSDOS_I(inode)->i_start; 373 MSDOS_I(inode)->i_logstart = MSDOS_I(inode)->i_start;
377 error = fat_calc_dir_size(inode); 374 error = fat_calc_dir_size(inode);
378 if (error < 0) 375 if (error < 0)
@@ -385,9 +382,7 @@ static int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de)
385 inode->i_mode = fat_make_mode(sbi, de->attr, 382 inode->i_mode = fat_make_mode(sbi, de->attr,
386 ((sbi->options.showexec && !is_exec(de->name + 8)) 383 ((sbi->options.showexec && !is_exec(de->name + 8))
387 ? S_IRUGO|S_IWUGO : S_IRWXUGO)); 384 ? S_IRUGO|S_IWUGO : S_IRWXUGO));
388 MSDOS_I(inode)->i_start = le16_to_cpu(de->start); 385 MSDOS_I(inode)->i_start = fat_get_start(sbi, de);
389 if (sbi->fat_bits == 32)
390 MSDOS_I(inode)->i_start |= (le16_to_cpu(de->starthi) << 16);
391 386
392 MSDOS_I(inode)->i_logstart = MSDOS_I(inode)->i_start; 387 MSDOS_I(inode)->i_logstart = MSDOS_I(inode)->i_start;
393 inode->i_size = le32_to_cpu(de->size); 388 inode->i_size = le32_to_cpu(de->size);
@@ -613,8 +608,7 @@ retry:
613 else 608 else
614 raw_entry->size = cpu_to_le32(inode->i_size); 609 raw_entry->size = cpu_to_le32(inode->i_size);
615 raw_entry->attr = fat_make_attrs(inode); 610 raw_entry->attr = fat_make_attrs(inode);
616 raw_entry->start = cpu_to_le16(MSDOS_I(inode)->i_logstart); 611 fat_set_start(raw_entry, MSDOS_I(inode)->i_logstart);
617 raw_entry->starthi = cpu_to_le16(MSDOS_I(inode)->i_logstart >> 16);
618 fat_time_unix2fat(sbi, &inode->i_mtime, &raw_entry->time, 612 fat_time_unix2fat(sbi, &inode->i_mtime, &raw_entry->time,
619 &raw_entry->date, NULL); 613 &raw_entry->date, NULL);
620 if (sbi->options.isvfat) { 614 if (sbi->options.isvfat) {