diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fat/dir.c | 9 | ||||
-rw-r--r-- | fs/fat/fat.h | 1 | ||||
-rw-r--r-- | fs/fat/inode.c | 9 | ||||
-rw-r--r-- | fs/jffs2/fs.c | 6 | ||||
-rw-r--r-- | fs/jffs2/os-linux.h | 2 | ||||
-rw-r--r-- | fs/jffs2/scan.c | 24 | ||||
-rw-r--r-- | fs/partitions/check.c | 8 |
7 files changed, 45 insertions, 14 deletions
diff --git a/fs/fat/dir.c b/fs/fat/dir.c index ee42b9e0b16a..2242ac239866 100644 --- a/fs/fat/dir.c +++ b/fs/fat/dir.c @@ -753,6 +753,13 @@ static int fat_ioctl_readdir(struct inode *inode, struct file *filp, return ret; } +static int fat_ioctl_volume_id(struct inode *dir) +{ + struct super_block *sb = dir->i_sb; + struct msdos_sb_info *sbi = MSDOS_SB(sb); + return sbi->vol_id; +} + static long fat_dir_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { @@ -769,6 +776,8 @@ static long fat_dir_ioctl(struct file *filp, unsigned int cmd, short_only = 0; both = 1; break; + case VFAT_IOCTL_GET_VOLUME_ID: + return fat_ioctl_volume_id(inode); default: return fat_generic_ioctl(filp, cmd, arg); } diff --git a/fs/fat/fat.h b/fs/fat/fat.h index 27ac25725954..a488c7750e72 100644 --- a/fs/fat/fat.h +++ b/fs/fat/fat.h @@ -78,6 +78,7 @@ struct msdos_sb_info { const void *dir_ops; /* Opaque; default directory operations */ int dir_per_block; /* dir entries per block */ int dir_per_block_bits; /* log2(dir_per_block) */ + unsigned long vol_id; /* volume ID */ int fatent_shift; struct fatent_operations *fatent_ops; diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 7bf45aee56d7..1afa217d9050 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -1249,6 +1249,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, 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; @@ -1393,6 +1394,8 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, 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)) { printk(KERN_WARNING "FAT: Invalid FSINFO signature: " @@ -1408,8 +1411,14 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, } 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; diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index 459d39d1ea0b..8a7ca85024c2 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c @@ -673,7 +673,9 @@ void jffs2_gc_release_page(struct jffs2_sb_info *c, static int jffs2_flash_setup(struct jffs2_sb_info *c) { int ret = 0; - if (jffs2_cleanmarker_oob(c)) { + if (c->mtd->type == MTD_NANDFLASH) { + if (!(c->mtd->flags & MTD_OOB_WRITEABLE)) + printk(KERN_INFO "JFFS2 doesn't use OOB.\n"); /* NAND flash... do setup accordingly */ ret = jffs2_nand_flash_setup(c); if (ret) @@ -706,7 +708,7 @@ static int jffs2_flash_setup(struct jffs2_sb_info *c) { void jffs2_flash_cleanup(struct jffs2_sb_info *c) { - if (jffs2_cleanmarker_oob(c)) { + if (c->mtd->type == MTD_NANDFLASH) { jffs2_nand_flash_cleanup(c); } diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h index 4791aacf3084..9bf830b4f7c0 100644 --- a/fs/jffs2/os-linux.h +++ b/fs/jffs2/os-linux.h @@ -106,7 +106,7 @@ static inline void jffs2_init_inode_info(struct jffs2_inode_info *f) #define jffs2_can_mark_obsolete(c) (c->mtd->flags & (MTD_BIT_WRITEABLE)) #endif -#define jffs2_cleanmarker_oob(c) (c->mtd->type == MTD_NANDFLASH) +#define jffs2_cleanmarker_oob(c) (c->mtd->type == MTD_NANDFLASH && (c->mtd->flags & MTD_OOB_WRITEABLE)) #define jffs2_flash_write_oob(c, ofs, len, retlen, buf) ((c)->mtd->write_oob((c)->mtd, ofs, len, retlen, buf)) #define jffs2_flash_read_oob(c, ofs, len, retlen, buf) ((c)->mtd->read_oob((c)->mtd, ofs, len, retlen, buf)) diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c index 46f870d1cc36..a0d222496a3d 100644 --- a/fs/jffs2/scan.c +++ b/fs/jffs2/scan.c @@ -112,7 +112,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) if (!flashbuf) { /* For NAND it's quicker to read a whole eraseblock at a time, apparently */ - if (jffs2_cleanmarker_oob(c)) + if (c->mtd->type == MTD_NANDFLASH) buf_size = c->sector_size; else buf_size = PAGE_SIZE; @@ -451,22 +451,24 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo D1(printk(KERN_DEBUG "jffs2_scan_eraseblock(): Scanning block at 0x%x\n", ofs)); #ifdef CONFIG_JFFS2_FS_WRITEBUFFER - if (jffs2_cleanmarker_oob(c)) { + if (c->mtd->type == MTD_NANDFLASH) { int ret; if (c->mtd->block_isbad(c->mtd, jeb->offset)) return BLK_STATE_BADBLOCK; - ret = jffs2_check_nand_cleanmarker(c, jeb); - D2(printk(KERN_NOTICE "jffs_check_nand_cleanmarker returned %d\n",ret)); + if (jffs2_cleanmarker_oob(c)) { + ret = jffs2_check_nand_cleanmarker(c, jeb); + D2(printk(KERN_NOTICE "jffs_check_nand_cleanmarker returned %d\n", ret)); - /* Even if it's not found, we still scan to see - if the block is empty. We use this information - to decide whether to erase it or not. */ - switch (ret) { - case 0: cleanmarkerfound = 1; break; - case 1: break; - default: return ret; + /* Even if it's not found, we still scan to see + if the block is empty. We use this information + to decide whether to erase it or not. */ + switch (ret) { + case 0: cleanmarkerfound = 1; break; + case 1: break; + default: return ret; + } } } #endif diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 5dcd4b0c5533..e37a2930189a 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c @@ -341,10 +341,18 @@ static void part_release(struct device *dev) kfree(p); } +static int part_uevent(struct device *dev, struct kobj_uevent_env *env) +{ + struct hd_struct *part = dev_to_part(dev); + add_uevent_var(env, "PARTN=%u", part->partno); + return 0; +} + struct device_type part_type = { .name = "partition", .groups = part_attr_groups, .release = part_release, + .uevent = part_uevent, }; static void delete_partition_rcu_cb(struct rcu_head *head) |