diff options
author | Mike Lockwood <lockwood@android.com> | 2008-03-15 13:29:36 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:37:55 -0800 |
commit | 633171e8cd2e38f735e2a96b1a21974a89156a25 (patch) | |
tree | 2b8154d0cca8cae54e120fee3202aef6784a8a9b /fs/fat/inode.c | |
parent | 78a2dce1100b2520ac881f5e7a0f9dad9d250b2c (diff) |
FAT: Add new ioctl VFAT_IOCTL_GET_VOLUME_ID for reading the volume ID.
Signed-off-by: Brian Swetland <swetland@google.com>
Diffstat (limited to 'fs/fat/inode.c')
-rw-r--r-- | fs/fat/inode.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 1726d7303047..b2eae577b91a 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -1247,6 +1247,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, struct inode *root_inode = NULL, *fat_inode = NULL; struct buffer_head *bh; struct fat_boot_sector *b; + struct fat_boot_bsx *bsx; struct msdos_sb_info *sbi; u16 logical_sector_size; u32 total_sectors, total_clusters, fat_clusters, rootdir_sectors; @@ -1391,6 +1392,8 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, goto out_fail; } + bsx = (struct fat_boot_bsx *)(bh->b_data + FAT32_BSX_OFFSET); + fsinfo = (struct fat_boot_fsinfo *)fsinfo_bh->b_data; if (!IS_FSINFO(fsinfo)) { fat_msg(sb, KERN_WARNING, "Invalid FSINFO signature: " @@ -1406,8 +1409,14 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, } brelse(fsinfo_bh); + } else { + bsx = (struct fat_boot_bsx *)(bh->b_data + FAT16_BSX_OFFSET); } + /* interpret volume ID as a little endian 32 bit integer */ + sbi->vol_id = (((u32)bsx->vol_id[0]) | ((u32)bsx->vol_id[1] << 8) | + ((u32)bsx->vol_id[2] << 16) | ((u32)bsx->vol_id[3] << 24)); + sbi->dir_per_block = sb->s_blocksize / sizeof(struct msdos_dir_entry); sbi->dir_per_block_bits = ffs(sbi->dir_per_block) - 1; |