--- zzzz-none-000/linux-2.6.39.4/fs/partitions/check.c 2011-08-03 19:43:28.000000000 +0000 +++ puma6-arm-6490-729/linux-2.6.39.4/fs/partitions/check.c 2021-11-10 13:23:10.000000000 +0000 @@ -11,7 +11,10 @@ * contained. * * Added needed MAJORS for new pairs, {hdi,hdj}, {hdk,hdl} - */ + ******************************************************************** + * Includes Intel Corporation's changes/modifications dated: 03/2013. + * Changed/modified portions - Copyright(c) 2011,2013 Intel Corporation. + ********************************************************************/ #include #include @@ -416,6 +419,10 @@ static DEVICE_ATTR(whole_disk, S_IRUSR | S_IRGRP | S_IROTH, whole_disk_show, NULL); +#if defined(CONFIG_ARCH_GEN3) || defined(CONFIG_MACH_PUMA6) +extern void puma6_partition_add(struct hd_struct *part); +#endif + struct hd_struct *add_partition(struct gendisk *disk, int partno, sector_t start, sector_t len, int flags, struct partition_meta_info *info) @@ -505,6 +512,11 @@ kobject_uevent(&pdev->kobj, KOBJ_ADD); hd_ref_init(p); + +#if defined(CONFIG_ARCH_GEN3) || defined(CONFIG_MACH_PUMA6) + puma6_partition_add(p); +#endif + return p; out_free_info: @@ -539,17 +551,11 @@ } } -int rescan_partitions(struct gendisk *disk, struct block_device *bdev) +static int drop_partitions(struct gendisk *disk, struct block_device *bdev) { - struct parsed_partitions *state = NULL; struct disk_part_iter piter; struct hd_struct *part; - int p, highest, res; -rescan: - if (state && !IS_ERR(state)) { - kfree(state); - state = NULL; - } + int res; if (bdev->bd_part_count) return -EBUSY; @@ -562,6 +568,24 @@ delete_partition(disk, part->partno); disk_part_iter_exit(&piter); + return 0; +} + +int rescan_partitions(struct gendisk *disk, struct block_device *bdev) +{ + struct parsed_partitions *state = NULL; + struct hd_struct *part; + int p, highest, res; +rescan: + if (state && !IS_ERR(state)) { + kfree(state); + state = NULL; + } + + res = drop_partitions(disk, bdev); + if (res) + return res; + if (disk->fops->revalidate_disk) disk->fops->revalidate_disk(disk); check_disk_size_change(disk, bdev); @@ -611,7 +635,6 @@ /* add partitions */ for (p = 1; p < state->limit; p++) { sector_t size, from; - struct partition_meta_info *info = NULL; size = state->parts[p].size; if (!size) @@ -646,8 +669,6 @@ } } - if (state->parts[p].has_info) - info = &state->parts[p].info; part = add_partition(disk, p, from, size, state->parts[p].flags, &state->parts[p].info); @@ -665,6 +686,26 @@ return 0; } +int invalidate_partitions(struct gendisk *disk, struct block_device *bdev) +{ + int res; + + if (!bdev->bd_invalidated) + return 0; + + res = drop_partitions(disk, bdev); + if (res) + return res; + + set_capacity(disk, 0); + check_disk_size_change(disk, bdev); + bdev->bd_invalidated = 0; + /* tell userspace that the media / partition table may have changed */ + kobject_uevent(&disk_to_dev(disk)->kobj, KOBJ_CHANGE); + + return 0; +} + unsigned char *read_dev_sector(struct block_device *bdev, sector_t n, Sector *p) { struct address_space *mapping = bdev->bd_inode->i_mapping;