diff options
Diffstat (limited to '')
-rw-r--r-- | block/partitions/Kconfig (renamed from fs/partitions/Kconfig) | 0 | ||||
-rw-r--r-- | block/partitions/Makefile (renamed from fs/partitions/Makefile) | 0 | ||||
-rw-r--r-- | block/partitions/acorn.c (renamed from fs/partitions/acorn.c) | 0 | ||||
-rw-r--r-- | block/partitions/acorn.h (renamed from fs/partitions/acorn.h) | 0 | ||||
-rw-r--r-- | block/partitions/amiga.c (renamed from fs/partitions/amiga.c) | 0 | ||||
-rw-r--r-- | block/partitions/amiga.h (renamed from fs/partitions/amiga.h) | 0 | ||||
-rw-r--r-- | block/partitions/atari.c (renamed from fs/partitions/atari.c) | 0 | ||||
-rw-r--r-- | block/partitions/atari.h (renamed from fs/partitions/atari.h) | 0 | ||||
-rw-r--r-- | block/partitions/check.c | 166 | ||||
-rw-r--r-- | block/partitions/check.h (renamed from fs/partitions/check.h) | 3 | ||||
-rw-r--r-- | block/partitions/efi.c (renamed from fs/partitions/efi.c) | 0 | ||||
-rw-r--r-- | block/partitions/efi.h (renamed from fs/partitions/efi.h) | 0 | ||||
-rw-r--r-- | block/partitions/ibm.c (renamed from fs/partitions/ibm.c) | 0 | ||||
-rw-r--r-- | block/partitions/ibm.h (renamed from fs/partitions/ibm.h) | 0 | ||||
-rw-r--r-- | block/partitions/karma.c (renamed from fs/partitions/karma.c) | 0 | ||||
-rw-r--r-- | block/partitions/karma.h (renamed from fs/partitions/karma.h) | 0 | ||||
-rw-r--r-- | block/partitions/ldm.c (renamed from fs/partitions/ldm.c) | 0 | ||||
-rw-r--r-- | block/partitions/ldm.h (renamed from fs/partitions/ldm.h) | 0 | ||||
-rw-r--r-- | block/partitions/mac.c (renamed from fs/partitions/mac.c) | 0 | ||||
-rw-r--r-- | block/partitions/mac.h (renamed from fs/partitions/mac.h) | 0 | ||||
-rw-r--r-- | block/partitions/msdos.c (renamed from fs/partitions/msdos.c) | 0 | ||||
-rw-r--r-- | block/partitions/msdos.h (renamed from fs/partitions/msdos.h) | 0 | ||||
-rw-r--r-- | block/partitions/osf.c (renamed from fs/partitions/osf.c) | 0 | ||||
-rw-r--r-- | block/partitions/osf.h (renamed from fs/partitions/osf.h) | 0 | ||||
-rw-r--r-- | block/partitions/sgi.c (renamed from fs/partitions/sgi.c) | 0 | ||||
-rw-r--r-- | block/partitions/sgi.h (renamed from fs/partitions/sgi.h) | 0 | ||||
-rw-r--r-- | block/partitions/sun.c (renamed from fs/partitions/sun.c) | 0 | ||||
-rw-r--r-- | block/partitions/sun.h (renamed from fs/partitions/sun.h) | 0 | ||||
-rw-r--r-- | block/partitions/sysv68.c (renamed from fs/partitions/sysv68.c) | 0 | ||||
-rw-r--r-- | block/partitions/sysv68.h (renamed from fs/partitions/sysv68.h) | 0 | ||||
-rw-r--r-- | block/partitions/ultrix.c (renamed from fs/partitions/ultrix.c) | 0 | ||||
-rw-r--r-- | block/partitions/ultrix.h (renamed from fs/partitions/ultrix.h) | 0 |
32 files changed, 169 insertions, 0 deletions
diff --git a/fs/partitions/Kconfig b/block/partitions/Kconfig index cb5f0a3f1b03..cb5f0a3f1b03 100644 --- a/fs/partitions/Kconfig +++ b/block/partitions/Kconfig diff --git a/fs/partitions/Makefile b/block/partitions/Makefile index 03af8eac51da..03af8eac51da 100644 --- a/fs/partitions/Makefile +++ b/block/partitions/Makefile diff --git a/fs/partitions/acorn.c b/block/partitions/acorn.c index fbeb697374d5..fbeb697374d5 100644 --- a/fs/partitions/acorn.c +++ b/block/partitions/acorn.c diff --git a/fs/partitions/acorn.h b/block/partitions/acorn.h index ede828529692..ede828529692 100644 --- a/fs/partitions/acorn.h +++ b/block/partitions/acorn.h diff --git a/fs/partitions/amiga.c b/block/partitions/amiga.c index 70cbf44a1560..70cbf44a1560 100644 --- a/fs/partitions/amiga.c +++ b/block/partitions/amiga.c diff --git a/fs/partitions/amiga.h b/block/partitions/amiga.h index d094585cadaa..d094585cadaa 100644 --- a/fs/partitions/amiga.h +++ b/block/partitions/amiga.h diff --git a/fs/partitions/atari.c b/block/partitions/atari.c index 9875b05e80a2..9875b05e80a2 100644 --- a/fs/partitions/atari.c +++ b/block/partitions/atari.c diff --git a/fs/partitions/atari.h b/block/partitions/atari.h index fe2d32a89f36..fe2d32a89f36 100644 --- a/fs/partitions/atari.h +++ b/block/partitions/atari.h diff --git a/block/partitions/check.c b/block/partitions/check.c new file mode 100644 index 000000000000..bc908672c976 --- /dev/null +++ b/block/partitions/check.c @@ -0,0 +1,166 @@ +/* + * 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 <linux/slab.h> +#include <linux/ctype.h> +#include <linux/genhd.h> + +#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" + +int warn_no_part = 1; /*This is ugly: should make genhd removable media aware*/ + +static int (*check_part[])(struct parsed_partitions *) = { + /* + * 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 +}; + +struct parsed_partitions * +check_partition(struct gendisk *hd, struct block_device *bdev) +{ + struct parsed_partitions *state; + int i, res, err; + + state = kzalloc(sizeof(struct parsed_partitions), GFP_KERNEL); + if (!state) + return NULL; + state->pp_buf = (char *)__get_free_page(GFP_KERNEL); + if (!state->pp_buf) { + kfree(state); + return NULL; + } + state->pp_buf[0] = '\0'; + + state->bdev = bdev; + disk_name(hd, 0, state->name); + snprintf(state->pp_buf, PAGE_SIZE, " %s:", state->name); + if (isdigit(state->name[strlen(state->name)-1])) + sprintf(state->name, "p"); + + state->limit = disk_max_parts(hd); + i = res = err = 0; + while (!res && check_part[i]) { + memset(&state->parts, 0, sizeof(state->parts)); + res = check_part[i++](state); + 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) { + printk(KERN_INFO "%s", state->pp_buf); + + free_page((unsigned long)state->pp_buf); + return state; + } + if (state->access_beyond_eod) + err = -ENOSPC; + if (err) + /* The partition is unrecognized. So report I/O errors if there were any */ + res = err; + if (!res) + strlcat(state->pp_buf, " unknown partition table\n", PAGE_SIZE); + else if (warn_no_part) + strlcat(state->pp_buf, " unable to read partition table\n", PAGE_SIZE); + + printk(KERN_INFO "%s", state->pp_buf); + + free_page((unsigned long)state->pp_buf); + kfree(state); + return ERR_PTR(res); +} diff --git a/fs/partitions/check.h b/block/partitions/check.h index d68bf4dc3bc2..52b100311ec3 100644 --- a/fs/partitions/check.h +++ b/block/partitions/check.h @@ -22,6 +22,9 @@ struct parsed_partitions { char *pp_buf; }; +struct parsed_partitions * +check_partition(struct gendisk *, struct block_device *); + static inline void *read_part_sector(struct parsed_partitions *state, sector_t n, Sector *p) { diff --git a/fs/partitions/efi.c b/block/partitions/efi.c index 6296b403c67a..6296b403c67a 100644 --- a/fs/partitions/efi.c +++ b/block/partitions/efi.c diff --git a/fs/partitions/efi.h b/block/partitions/efi.h index b69ab729558f..b69ab729558f 100644 --- a/fs/partitions/efi.h +++ b/block/partitions/efi.h diff --git a/fs/partitions/ibm.c b/block/partitions/ibm.c index d513a07f44bb..d513a07f44bb 100644 --- a/fs/partitions/ibm.c +++ b/block/partitions/ibm.c diff --git a/fs/partitions/ibm.h b/block/partitions/ibm.h index 08fb0804a812..08fb0804a812 100644 --- a/fs/partitions/ibm.h +++ b/block/partitions/ibm.h diff --git a/fs/partitions/karma.c b/block/partitions/karma.c index 0ea19312706b..0ea19312706b 100644 --- a/fs/partitions/karma.c +++ b/block/partitions/karma.c diff --git a/fs/partitions/karma.h b/block/partitions/karma.h index c764b2e9df21..c764b2e9df21 100644 --- a/fs/partitions/karma.h +++ b/block/partitions/karma.h diff --git a/fs/partitions/ldm.c b/block/partitions/ldm.c index bd8ae788f689..bd8ae788f689 100644 --- a/fs/partitions/ldm.c +++ b/block/partitions/ldm.c diff --git a/fs/partitions/ldm.h b/block/partitions/ldm.h index 374242c0971a..374242c0971a 100644 --- a/fs/partitions/ldm.h +++ b/block/partitions/ldm.h diff --git a/fs/partitions/mac.c b/block/partitions/mac.c index 11f688bd76c5..11f688bd76c5 100644 --- a/fs/partitions/mac.c +++ b/block/partitions/mac.c diff --git a/fs/partitions/mac.h b/block/partitions/mac.h index 3c7d98436380..3c7d98436380 100644 --- a/fs/partitions/mac.h +++ b/block/partitions/mac.h diff --git a/fs/partitions/msdos.c b/block/partitions/msdos.c index 5f79a6677c69..5f79a6677c69 100644 --- a/fs/partitions/msdos.c +++ b/block/partitions/msdos.c diff --git a/fs/partitions/msdos.h b/block/partitions/msdos.h index 38c781c490b3..38c781c490b3 100644 --- a/fs/partitions/msdos.h +++ b/block/partitions/msdos.h diff --git a/fs/partitions/osf.c b/block/partitions/osf.c index 764b86a01965..764b86a01965 100644 --- a/fs/partitions/osf.c +++ b/block/partitions/osf.c diff --git a/fs/partitions/osf.h b/block/partitions/osf.h index 20ed2315ec16..20ed2315ec16 100644 --- a/fs/partitions/osf.h +++ b/block/partitions/osf.h diff --git a/fs/partitions/sgi.c b/block/partitions/sgi.c index ea8a86dceaf4..ea8a86dceaf4 100644 --- a/fs/partitions/sgi.c +++ b/block/partitions/sgi.c diff --git a/fs/partitions/sgi.h b/block/partitions/sgi.h index b9553ebdd5a9..b9553ebdd5a9 100644 --- a/fs/partitions/sgi.h +++ b/block/partitions/sgi.h diff --git a/fs/partitions/sun.c b/block/partitions/sun.c index b5b6fcfb3d36..b5b6fcfb3d36 100644 --- a/fs/partitions/sun.c +++ b/block/partitions/sun.c diff --git a/fs/partitions/sun.h b/block/partitions/sun.h index 2424baa8319f..2424baa8319f 100644 --- a/fs/partitions/sun.h +++ b/block/partitions/sun.h diff --git a/fs/partitions/sysv68.c b/block/partitions/sysv68.c index 9627ccffc1c4..9627ccffc1c4 100644 --- a/fs/partitions/sysv68.c +++ b/block/partitions/sysv68.c diff --git a/fs/partitions/sysv68.h b/block/partitions/sysv68.h index bf2f5ffa97ac..bf2f5ffa97ac 100644 --- a/fs/partitions/sysv68.h +++ b/block/partitions/sysv68.h diff --git a/fs/partitions/ultrix.c b/block/partitions/ultrix.c index 8dbaf9f77a99..8dbaf9f77a99 100644 --- a/fs/partitions/ultrix.c +++ b/block/partitions/ultrix.c diff --git a/fs/partitions/ultrix.h b/block/partitions/ultrix.h index a3cc00b2bded..a3cc00b2bded 100644 --- a/fs/partitions/ultrix.h +++ b/block/partitions/ultrix.h |