]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] FAT: misc cleanups/fixes
authorAndrew Morton <akpm@osdl.org>
Tue, 30 Dec 2003 07:45:57 +0000 (23:45 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Tue, 30 Dec 2003 07:45:57 +0000 (23:45 -0800)
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

fatfs misc cleanups/fixes.

fs/fat/inode.c
include/linux/msdos_fs_sb.h

index 4e5d0c08517b232d5f92a95740078085574b455b..065b12513bf916accf93c085ff927fb2469cc603 100644 (file)
@@ -765,8 +765,9 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
        struct buffer_head *bh;
        struct fat_boot_sector *b;
        struct msdos_sb_info *sbi;
+       u16 logical_sector_size;
        u32 total_sectors, total_clusters, fat_clusters, rootdir_sectors;
-       int logical_sector_size, debug, cp, first;
+       int debug, cp, first;
        unsigned int media;
        long error;
        char buf[50];
@@ -831,14 +832,13 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
                brelse(bh);
                goto out_invalid;
        }
-       logical_sector_size =
-               CF_LE_W(get_unaligned((unsigned short *) &b->sector_size));
+       logical_sector_size = CF_LE_W(get_unaligned((u16 *)&b->sector_size));
        if (!logical_sector_size
            || (logical_sector_size & (logical_sector_size - 1))
            || (logical_sector_size < 512)
            || (PAGE_CACHE_SIZE < logical_sector_size)) {
                if (!silent)
-                       printk(KERN_ERR "FAT: bogus logical sector size %d\n",
+                       printk(KERN_ERR "FAT: bogus logical sector size %u\n",
                               logical_sector_size);
                brelse(bh);
                goto out_invalid;
@@ -847,7 +847,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
        if (!sbi->sec_per_clus
            || (sbi->sec_per_clus & (sbi->sec_per_clus - 1))) {
                if (!silent)
-                       printk(KERN_ERR "FAT: bogus sectors per cluster %d\n",
+                       printk(KERN_ERR "FAT: bogus sectors per cluster %u\n",
                               sbi->sec_per_clus);
                brelse(bh);
                goto out_invalid;
@@ -855,7 +855,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
 
        if (logical_sector_size < sb->s_blocksize) {
                printk(KERN_ERR "FAT: logical sector size too small for device"
-                      " (logical sector size = %d)\n", logical_sector_size);
+                      " (logical sector size = %u)\n", logical_sector_size);
                brelse(bh);
                goto out_fail;
        }
@@ -863,7 +863,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
                brelse(bh);
 
                if (!sb_set_blocksize(sb, logical_sector_size)) {
-                       printk(KERN_ERR "FAT: unable to set blocksize %d\n",
+                       printk(KERN_ERR "FAT: unable to set blocksize %u\n",
                               logical_sector_size);
                        goto out_fail;
                }
@@ -932,10 +932,11 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
        sbi->dir_per_block_bits = ffs(sbi->dir_per_block) - 1;
 
        sbi->dir_start = sbi->fat_start + sbi->fats * sbi->fat_length;
-       sbi->dir_entries =
-               CF_LE_W(get_unaligned((unsigned short *)&b->dir_entries));
+       sbi->dir_entries = CF_LE_W(get_unaligned((u16 *)&b->dir_entries));
        if (sbi->dir_entries & (sbi->dir_per_block - 1)) {
-               printk(KERN_ERR "FAT: bogus directroy-entries per block\n");
+               if (!silent)
+                       printk(KERN_ERR "FAT: bogus directroy-entries per block"
+                              " (%u)\n", sbi->dir_entries);
                brelse(bh);
                goto out_invalid;
        }
@@ -943,7 +944,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
        rootdir_sectors = sbi->dir_entries
                * sizeof(struct msdos_dir_entry) / sb->s_blocksize;
        sbi->data_start = sbi->dir_start + rootdir_sectors;
-       total_sectors = CF_LE_W(get_unaligned((unsigned short *)&b->sectors));
+       total_sectors = CF_LE_W(get_unaligned((u16 *)&b->sectors));
        if (total_sectors == 0)
                total_sectors = CF_LE_L(b->total_sect);
 
index 26d64203f08663c4a014022fe4b5d6b12b3884cd..c79a172225d324c88c460b814a5d358ff4678b59 100644 (file)
@@ -47,7 +47,7 @@ struct msdos_sb_info {
        unsigned long data_start;    /* first data sector */
        unsigned long clusters;      /* number of clusters */
        unsigned long root_cluster;  /* first cluster of the root directory */
-       unsigned long fsinfo_sector; /* FAT32 fsinfo offset from start of disk */
+       unsigned long fsinfo_sector; /* sector number of FAT32 fsinfo */
        struct semaphore fat_lock;
        int prev_free;               /* previously allocated cluster number */
        int free_clusters;           /* -1 if undefined */