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];
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;
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;
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;
}
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;
}
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;
}
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);
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 */