fat: fix the type of get_inode_mode()
authorH. Peter Anvin <hpa@zytor.com>
Wed, 10 Mar 2010 05:20:55 +0000 (21:20 -0800)
committerH. Peter Anvin <hpa@zytor.com>
Wed, 10 Mar 2010 05:22:43 +0000 (21:22 -0800)
get_inode_mode() returns enum dirent_type.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
core/fs/fat/fat.c

index 97997d5..029c2d4 100644 (file)
@@ -423,12 +423,9 @@ static inline sector_t first_sector(struct fs_info *fs,
     return sector;
 }
 
-static inline int get_inode_mode(uint8_t attr)
+static inline enum dirent_type get_inode_mode(uint8_t attr)
 {
-    if (attr == FAT_ATTR_DIRECTORY)
-       return DT_DIR;
-    else
-       return DT_REG;
+    return (attr & FAT_ATTR_DIRECTORY) ? DT_DIR : DT_REG;
 }
 
 
@@ -590,7 +587,6 @@ static int vfat_readdir(struct file *file, struct dirent *dirent)
     uint8_t vfat_init, vfat_next, vfat_csum;
     uint8_t id;
     int entries_left;
-    int checksum;
     bool long_entry = false;
     int sec_off = file->offset & ((1 << fs->sector_shift) - 1);