Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756996AbYGNJHd (ORCPT ); Mon, 14 Jul 2008 05:07:33 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755826AbYGNJHZ (ORCPT ); Mon, 14 Jul 2008 05:07:25 -0400 Received: from smtp7.tech.numericable.fr ([82.216.111.43]:39671 "EHLO smtp7.tech.numericable.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754508AbYGNJHX (ORCPT ); Mon, 14 Jul 2008 05:07:23 -0400 Message-ID: <487B1748.8010107@numericable.fr> Date: Mon, 14 Jul 2008 11:07:20 +0200 From: Rufus & Azrael User-Agent: Thunderbird 3.0a1 (X11/2008051919) MIME-Version: 1.0 To: Linux-kernel Mailing List CC: Tejun Heo Subject: PATCH] block: update add_partition() error handling Content-Type: multipart/mixed; boundary="------------090108040403090605030302" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 34954 Lines: 901 This is a multi-part message in MIME format. --------------090108040403090605030302 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Hello TJ, I try your patch but it fails on apply (see check.c.X in attachment) and = when compiling the kernel this build error occurs :l fs/partitions/check.c:347: erreur: conflicting types for =E2=80=98add_par= tition=E2=80=99 include/linux/genhd.h:533: erreur: previous declaration of=20 =E2=80=98add_partition=E2=80=99 was here fs/partitions/check.c: In function =E2=80=98add_partition=E2=80=99: fs/partitions/check.c:406: attention : =E2=80=98return=E2=80=99 with a va= lue, in=20 function returning void fs/partitions/check.c:412: attention : =E2=80=98return=E2=80=99 with a va= lue, in=20 function returning void fs/partitions/check.c: In function =E2=80=98rescan_partitions=E2=80=99: fs/partitions/check.c:512: erreur: valeur void n'a pas =C3=A9t=C3=A9 igno= r=C3=A9e comme=20 elle aurait d=C3=BB l'=C3=AAtre make[2]: *** [fs/partitions/check.o] Erreur 1 make[1]: *** [fs/partitions] Erreur 2 make: *** [fs] Erreur 2 Regards. --------------090108040403090605030302 Content-Type: text/x-csrc; name="check.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="check.c" /* * fs/partitions/check.c * * Code extracted from drivers/block/genhd.c * Copyright (C) 1991-1998 Linus Torvalds * Re-organised Feb 1998 Russell King * * We now have independent partition support from the * block drivers, which allows all the partition code to * be grouped in one location, and it to be mostly self * contained. * * Added needed MAJORS for new pairs, {hdi,hdj}, {hdk,hdl} */ #include #include #include #include #include #include #include "check.h" #include "acorn.h" #include "amiga.h" #include "atari.h" #include "ldm.h" #include "mac.h" #include "msdos.h" #include "osf.h" #include "sgi.h" #include "sun.h" #include "ibm.h" #include "ultrix.h" #include "efi.h" #include "karma.h" #include "sysv68.h" #ifdef CONFIG_BLK_DEV_MD extern void md_autodetect_dev(dev_t dev); #endif int warn_no_part = 1; /*This is ugly: should make genhd removable media aware*/ static int (*check_part[])(struct parsed_partitions *, struct block_device *) = { /* * Probe partition formats with tables at disk address 0 * that also have an ADFS boot block at 0xdc0. */ #ifdef CONFIG_ACORN_PARTITION_ICS adfspart_check_ICS, #endif #ifdef CONFIG_ACORN_PARTITION_POWERTEC adfspart_check_POWERTEC, #endif #ifdef CONFIG_ACORN_PARTITION_EESOX adfspart_check_EESOX, #endif /* * Now move on to formats that only have partition info at * disk address 0xdc0. Since these may also have stale * PC/BIOS partition tables, they need to come before * the msdos entry. */ #ifdef CONFIG_ACORN_PARTITION_CUMANA adfspart_check_CUMANA, #endif #ifdef CONFIG_ACORN_PARTITION_ADFS adfspart_check_ADFS, #endif #ifdef CONFIG_EFI_PARTITION efi_partition, /* this must come before msdos */ #endif #ifdef CONFIG_SGI_PARTITION sgi_partition, #endif #ifdef CONFIG_LDM_PARTITION ldm_partition, /* this must come before msdos */ #endif #ifdef CONFIG_MSDOS_PARTITION msdos_partition, #endif #ifdef CONFIG_OSF_PARTITION osf_partition, #endif #ifdef CONFIG_SUN_PARTITION sun_partition, #endif #ifdef CONFIG_AMIGA_PARTITION amiga_partition, #endif #ifdef CONFIG_ATARI_PARTITION atari_partition, #endif #ifdef CONFIG_MAC_PARTITION mac_partition, #endif #ifdef CONFIG_ULTRIX_PARTITION ultrix_partition, #endif #ifdef CONFIG_IBM_PARTITION ibm_partition, #endif #ifdef CONFIG_KARMA_PARTITION karma_partition, #endif #ifdef CONFIG_SYSV68_PARTITION sysv68_partition, #endif NULL }; /* * disk_name() is used by partition check code and the genhd driver. * It formats the devicename of the indicated disk into * the supplied buffer (of size at least 32), and returns * a pointer to that same buffer (for convenience). */ char *disk_name(struct gendisk *hd, int part, char *buf) { if (!part) snprintf(buf, BDEVNAME_SIZE, "%s", hd->disk_name); else if (isdigit(hd->disk_name[strlen(hd->disk_name)-1])) snprintf(buf, BDEVNAME_SIZE, "%sp%d", hd->disk_name, part); else snprintf(buf, BDEVNAME_SIZE, "%s%d", hd->disk_name, part); return buf; } const char *bdevname(struct block_device *bdev, char *buf) { int part = MINOR(bdev->bd_dev) - bdev->bd_disk->first_minor; return disk_name(bdev->bd_disk, part, buf); } EXPORT_SYMBOL(bdevname); /* * There's very little reason to use this, you should really * have a struct block_device just about everywhere and use * bdevname() instead. */ const char *__bdevname(dev_t dev, char *buffer) { scnprintf(buffer, BDEVNAME_SIZE, "unknown-block(%u,%u)", MAJOR(dev), MINOR(dev)); return buffer; } EXPORT_SYMBOL(__bdevname); static struct parsed_partitions * check_partition(struct gendisk *hd, struct block_device *bdev) { struct parsed_partitions *state; int i, res, err; state = kmalloc(sizeof(struct parsed_partitions), GFP_KERNEL); if (!state) return NULL; disk_name(hd, 0, state->name); printk(KERN_INFO " %s:", state->name); if (isdigit(state->name[strlen(state->name)-1])) sprintf(state->name, "p"); state->limit = hd->minors; i = res = err = 0; while (!res && check_part[i]) { memset(&state->parts, 0, sizeof(state->parts)); res = check_part[i++](state, bdev); if (res < 0) { /* We have hit an I/O error which we don't report now. * But record it, and let the others do their job. */ err = res; res = 0; } } if (res > 0) return state; if (err) /* The partition is unrecognized. So report I/O errors if there were any */ res = err; if (!res) printk(" unknown partition table\n"); else if (warn_no_part) printk(" unable to read partition table\n"); kfree(state); return ERR_PTR(res); } static ssize_t part_start_show(struct device *dev, struct device_attribute *attr, char *buf) { struct hd_struct *p = dev_to_part(dev); return sprintf(buf, "%llu\n",(unsigned long long)p->start_sect); } static ssize_t part_size_show(struct device *dev, struct device_attribute *attr, char *buf) { struct hd_struct *p = dev_to_part(dev); return sprintf(buf, "%llu\n",(unsigned long long)p->nr_sects); } static ssize_t part_stat_show(struct device *dev, struct device_attribute *attr, char *buf) { struct hd_struct *p = dev_to_part(dev); preempt_disable(); part_round_stats(p); preempt_enable(); return sprintf(buf, "%8lu %8lu %8llu %8u " "%8lu %8lu %8llu %8u " "%8u %8u %8u" "\n", part_stat_read(p, ios[READ]), part_stat_read(p, merges[READ]), (unsigned long long)part_stat_read(p, sectors[READ]), jiffies_to_msecs(part_stat_read(p, ticks[READ])), part_stat_read(p, ios[WRITE]), part_stat_read(p, merges[WRITE]), (unsigned long long)part_stat_read(p, sectors[WRITE]), jiffies_to_msecs(part_stat_read(p, ticks[WRITE])), p->in_flight, jiffies_to_msecs(part_stat_read(p, io_ticks)), jiffies_to_msecs(part_stat_read(p, time_in_queue))); } #ifdef CONFIG_FAIL_MAKE_REQUEST static ssize_t part_fail_show(struct device *dev, struct device_attribute *attr, char *buf) { struct hd_struct *p = dev_to_part(dev); return sprintf(buf, "%d\n", p->make_it_fail); } static ssize_t part_fail_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct hd_struct *p = dev_to_part(dev); int i; if (count > 0 && sscanf(buf, "%d", &i) > 0) p->make_it_fail = (i == 0) ? 0 : 1; return count; } #endif static DEVICE_ATTR(start, S_IRUGO, part_start_show, NULL); static DEVICE_ATTR(size, S_IRUGO, part_size_show, NULL); static DEVICE_ATTR(stat, S_IRUGO, part_stat_show, NULL); #ifdef CONFIG_FAIL_MAKE_REQUEST static struct device_attribute dev_attr_fail = __ATTR(make-it-fail, S_IRUGO|S_IWUSR, part_fail_show, part_fail_store); #endif static struct attribute *part_attrs[] = { &dev_attr_start.attr, &dev_attr_size.attr, &dev_attr_stat.attr, #ifdef CONFIG_FAIL_MAKE_REQUEST &dev_attr_fail.attr, #endif NULL }; static struct attribute_group part_attr_group = { .attrs = part_attrs, }; static struct attribute_group *part_attr_groups[] = { &part_attr_group, NULL }; static void part_release(struct device *dev) { struct hd_struct *p = dev_to_part(dev); free_part_stats(p); kfree(p); } struct device_type part_type = { .name = "partition", .groups = part_attr_groups, .release = part_release, }; static inline void partition_sysfs_add_subdir(struct hd_struct *p) { struct kobject *k; k = kobject_get(&p->dev.kobj); p->holder_dir = kobject_create_and_add("holders", k); kobject_put(k); } static inline void disk_sysfs_add_subdirs(struct gendisk *disk) { struct kobject *k; k = kobject_get(&disk->dev.kobj); disk->holder_dir = kobject_create_and_add("holders", k); disk->slave_dir = kobject_create_and_add("slaves", k); kobject_put(k); } void delete_partition(struct gendisk *disk, int part) { struct hd_struct *p = disk->part[part-1]; if (!p) return; if (!p->nr_sects) return; disk->part[part-1] = NULL; p->start_sect = 0; p->nr_sects = 0; part_stat_set_all(p, 0); kobject_put(p->holder_dir); device_del(&p->dev); put_device(&p->dev); } static ssize_t whole_disk_show(struct device *dev, struct device_attribute *attr, char *buf) { return 0; } static DEVICE_ATTR(whole_disk, S_IRUSR | S_IRGRP | S_IROTH, whole_disk_show, NULL); void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len, int flags) { char name[BDEVNAME_SIZE]; struct hd_struct *p; int err; disk_name(disk, part, name); p = kzalloc(sizeof(*p), GFP_KERNEL); if (!p) { printk(KERN_WARNING "%s: failed to allocate partition " "structure (part=%d)\n", name, part); return; } if (!init_part_stats(p)) { printk(KERN_WARNING "%s: failed to initialize partition stats " "structure (part=%d)\n", name, part); kfree(p); return; } p->start_sect = start; p->nr_sects = len; p->disk = disk; p->partno = part; p->policy = disk->policy; if (isdigit(disk->dev.bus_id[strlen(disk->dev.bus_id)-1])) snprintf(p->dev.bus_id, BUS_ID_SIZE, "%sp%d", disk->dev.bus_id, part); else snprintf(p->dev.bus_id, BUS_ID_SIZE, "%s%d", disk->dev.bus_id, part); device_initialize(&p->dev); p->dev.devt = MKDEV(disk->major, disk->first_minor + part); p->dev.class = &block_class; p->dev.type = &part_type; p->dev.parent = &disk->dev; disk->part[part-1] = p; /* delay uevent until 'holders' subdir is created */ p->dev.uevent_suppress = 1; err = device_add(&p->dev); if (err) goto fail; partition_sysfs_add_subdir(p); p->dev.uevent_suppress = 0; if (flags & ADDPART_FLAG_WHOLEDISK) { err = device_create_file(&p->dev, &dev_attr_whole_disk); printk(" %s: failed to create sysfs attrs (%d)\n", dev_name(&p->dev), err); } /* suppress uevent if the disk supresses it */ if (!disk->dev.uevent_suppress) kobject_uevent(&p->dev.kobj, KOBJ_ADD); return 0; fail: if (p) free_part_stats(p); kfree(p); return err; } /* Not exported, helper to add_disk(). */ void register_disk(struct gendisk *disk) { struct block_device *bdev; char *s; int i; struct hd_struct *p; int err; disk->dev.parent = disk->driverfs_dev; disk->dev.devt = MKDEV(disk->major, disk->first_minor); strlcpy(disk->dev.bus_id, disk->disk_name, KOBJ_NAME_LEN); /* ewww... some of these buggers have / in the name... */ s = strchr(disk->dev.bus_id, '/'); if (s) *s = '!'; /* delay uevents, until we scanned partition table */ disk->dev.uevent_suppress = 1; if (device_add(&disk->dev)) return; #ifndef CONFIG_SYSFS_DEPRECATED err = sysfs_create_link(block_depr, &disk->dev.kobj, kobject_name(&disk->dev.kobj)); if (err) { device_del(&disk->dev); return; } #endif disk_sysfs_add_subdirs(disk); /* No minors to use for partitions */ if (disk->minors == 1) goto exit; /* No such device (e.g., media were just removed) */ if (!get_capacity(disk)) goto exit; bdev = bdget_disk(disk, 0); if (!bdev) goto exit; bdev->bd_invalidated = 1; err = blkdev_get(bdev, FMODE_READ, 0); if (err < 0) goto exit; blkdev_put(bdev); exit: /* announce disk after possible partitions are created */ disk->dev.uevent_suppress = 0; kobject_uevent(&disk->dev.kobj, KOBJ_ADD); /* announce possible partitions */ for (i = 1; i < disk->minors; i++) { p = disk->part[i-1]; if (!p || !p->nr_sects) continue; kobject_uevent(&p->dev.kobj, KOBJ_ADD); } } int rescan_partitions(struct gendisk *disk, struct block_device *bdev) { struct parsed_partitions *state; int p, res; if (bdev->bd_part_count) return -EBUSY; res = invalidate_partition(disk, 0); if (res) return res; bdev->bd_invalidated = 0; for (p = 1; p < disk->minors; p++) delete_partition(disk, p); if (disk->fops->revalidate_disk) disk->fops->revalidate_disk(disk); if (!get_capacity(disk) || !(state = check_partition(disk, bdev))) return 0; if (IS_ERR(state)) /* I/O error reading the partition table */ return -EIO; /* tell userspace that the media / partition table may have changed */ kobject_uevent(&disk->dev.kobj, KOBJ_CHANGE); for (p = 1; p < state->limit; p++) { sector_t size = state->parts[p].size; sector_t from = state->parts[p].from; if (!size) continue; if (from + size > get_capacity(disk)) { printk(" %s: p%d exceeds device capacity\n", disk->disk_name, p); } res = add_partition(disk, p, from, size, state->parts[p].flags); if (res) { printk(" %s: failed to add p%d (%d)\n", disk->disk_name, p, res); continue; } #ifdef CONFIG_BLK_DEV_MD if (state->parts[p].flags & ADDPART_FLAG_RAID) md_autodetect_dev(bdev->bd_dev+p); #endif } kfree(state); 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; struct page *page; page = read_mapping_page(mapping, (pgoff_t)(n >> (PAGE_CACHE_SHIFT-9)), NULL); if (!IS_ERR(page)) { if (PageError(page)) goto fail; p->v = page; return (unsigned char *)page_address(page) + ((n & ((1 << (PAGE_CACHE_SHIFT - 9)) - 1)) << 9); fail: page_cache_release(page); } p->v = NULL; return NULL; } EXPORT_SYMBOL(read_dev_sector); void del_gendisk(struct gendisk *disk) { int p; /* invalidate stuff */ for (p = disk->minors - 1; p > 0; p--) { invalidate_partition(disk, p); delete_partition(disk, p); } invalidate_partition(disk, 0); disk->capacity = 0; disk->flags &= ~GENHD_FL_UP; unlink_gendisk(disk); disk_stat_set_all(disk, 0); disk->stamp = 0; kobject_put(disk->holder_dir); kobject_put(disk->slave_dir); disk->driverfs_dev = NULL; #ifndef CONFIG_SYSFS_DEPRECATED sysfs_remove_link(block_depr, disk->dev.bus_id); #endif device_del(&disk->dev); } --------------090108040403090605030302 Content-Type: text/plain; name="check.c.orig" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="check.c.orig" LyoKICogIGZzL3BhcnRpdGlvbnMvY2hlY2suYwogKgogKiAgQ29kZSBleHRyYWN0ZWQgZnJv bSBkcml2ZXJzL2Jsb2NrL2dlbmhkLmMKICogIENvcHlyaWdodCAoQykgMTk5MS0xOTk4ICBM aW51cyBUb3J2YWxkcwogKiAgUmUtb3JnYW5pc2VkIEZlYiAxOTk4IFJ1c3NlbGwgS2luZwog KgogKiAgV2Ugbm93IGhhdmUgaW5kZXBlbmRlbnQgcGFydGl0aW9uIHN1cHBvcnQgZnJvbSB0 aGUKICogIGJsb2NrIGRyaXZlcnMsIHdoaWNoIGFsbG93cyBhbGwgdGhlIHBhcnRpdGlvbiBj b2RlIHRvCiAqICBiZSBncm91cGVkIGluIG9uZSBsb2NhdGlvbiwgYW5kIGl0IHRvIGJlIG1v c3RseSBzZWxmCiAqICBjb250YWluZWQuCiAqCiAqICBBZGRlZCBuZWVkZWQgTUFKT1JTIGZv ciBuZXcgcGFpcnMsIHtoZGksaGRqfSwge2hkayxoZGx9CiAqLwoKI2luY2x1ZGUgPGxpbnV4 L2luaXQuaD4KI2luY2x1ZGUgPGxpbnV4L21vZHVsZS5oPgojaW5jbHVkZSA8bGludXgvZnMu aD4KI2luY2x1ZGUgPGxpbnV4L2ttb2QuaD4KI2luY2x1ZGUgPGxpbnV4L2N0eXBlLmg+CiNp bmNsdWRlIDxsaW51eC9nZW5oZC5oPgoKI2luY2x1ZGUgImNoZWNrLmgiCgojaW5jbHVkZSAi YWNvcm4uaCIKI2luY2x1ZGUgImFtaWdhLmgiCiNpbm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2U7CgkJcmV0dXJuICh1bnNpZ25lZCBjaGFyICopcGFnZV9hZGRyZXNzKHBhZ2Up ICsgICgobiAmICgoMSA8PCAoUEFHRV9DQUNIRV9TSElGVCAtIDkpKSAtIDEpKSA8PCA5KTsK ZmFpbDoKCQlwYWdlX2NhY2hlX3JlbGVhc2UocGFnZSk7Cgl9CglwLT52ID0gTlVMTDsKCXJl dHVybiBOVUxMOwp9CgpFWFBPUlRfU1lNQk9MKHJlYWRfZGV2X3NlY3Rvcik7Cgp2b2lkIGRl bF9nZW5kaXNrKHN0cnVjdCBnZW5kaXNrICpkaXNrKQp7CglpbnQgcDsKCgkvKiBpbnZhbGlk YXRlIHN0dWZmICovCglmb3IgKHAgPSBkaXNrLT5taW5vcnMgLSAxOyBwID4gMDsgcC0tKSB7 CgkJaW52YWxpZGF0ZV9wYXJ0aXRpb24oZGlzaywgcCk7CgkJZGVsZXRlX3BhcnRpdGlvbihk aXNrLCBwKTsKCX0KCWludmFsaWRhdGVfcGFydGl0aW9uKGRpc2ssIDApOwoJZGlzay0+Y2Fw YWNpdHkgPSAwOwoJZGlzay0+ZmxhZ3MgJj0gfkdFTkhEX0ZMX1VQOwoJdW5saW5rX2dlbmRp c2soZGlzayk7CglkaXNrX3N0YXRfc2V0X2FsbChkaXNrLCAwKTsKCWRpc2stPnN0YW1wID0g MDsKCglrb2JqZWN0X3B1dChkaXNrLT5ob2xkZXJfZGlyKTsKCWtvYmplY3RfcHV0KGRpc2st PnNsYXZlX2Rpcik7CglkaXNrLT5kcml2ZXJmc19kZXYgPSBOVUxMOwojaWZuZGVmIENPTkZJ R19TWVNGU19ERVBSRUNBVEVECglzeXNmc19yZW1vdmVfbGluayhibG9ja19kZXByLCBkaXNr LT5kZXYuYnVzX2lkKTsKI2VuZGlmCglkZXZpY2VfZGVsKCZkaXNrLT5kZXYpOwp9Cg== --------------090108040403090605030302 Content-Type: application/x-reject; name="check.c.rej" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="check.c.rej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XAgPSBremFsbG9jKHNpemVvZigqcCksIEdGUF9LRVJORUwpOwogIAlpZiAoIXAp CisgCQlnb3RvIGZhaWw7CisgCWlmICghaW5pdF9wYXJ0X3N0YXRzKHApKQorIAkJZ290byBm YWlsOwogIAogIAlwLT5zdGFydF9zZWN0ID0gc3RhcnQ7CiAgCXAtPm5yX3NlY3RzID0gbGVu OwogIAlwLT5wYXJ0bm8gPSBwYXJ0Owo= --------------090108040403090605030302-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/