2 * fs/partitions/check.c
4 * Code extracted from drivers/block/genhd.c
5 * Copyright (C) 1991-1998 Linus Torvalds
6 * Re-organised Feb 1998 Russell King
8 * We now have independent partition support from the
9 * block drivers, which allows all the partition code to
10 * be grouped in one location, and it to be mostly self
13 * Added needed MAJORS for new pairs, {hdi,hdj}, {hdk,hdl}
16 #include <linux/slab.h>
17 #include <linux/ctype.h>
18 #include <linux/genhd.h>
37 int warn_no_part
= 1; /*This is ugly: should make genhd removable media aware*/
39 static int (*check_part
[])(struct parsed_partitions
*) = {
41 * Probe partition formats with tables at disk address 0
42 * that also have an ADFS boot block at 0xdc0.
44 #ifdef CONFIG_ACORN_PARTITION_ICS
47 #ifdef CONFIG_ACORN_PARTITION_POWERTEC
48 adfspart_check_POWERTEC
,
50 #ifdef CONFIG_ACORN_PARTITION_EESOX
55 * Now move on to formats that only have partition info at
56 * disk address 0xdc0. Since these may also have stale
57 * PC/BIOS partition tables, they need to come before
60 #ifdef CONFIG_ACORN_PARTITION_CUMANA
61 adfspart_check_CUMANA
,
63 #ifdef CONFIG_ACORN_PARTITION_ADFS
67 #ifdef CONFIG_EFI_PARTITION
68 efi_partition
, /* this must come before msdos */
70 #ifdef CONFIG_SGI_PARTITION
73 #ifdef CONFIG_LDM_PARTITION
74 ldm_partition
, /* this must come before msdos */
76 #ifdef CONFIG_MSDOS_PARTITION
79 #ifdef CONFIG_OSF_PARTITION
82 #ifdef CONFIG_SUN_PARTITION
85 #ifdef CONFIG_AMIGA_PARTITION
88 #ifdef CONFIG_ATARI_PARTITION
91 #ifdef CONFIG_MAC_PARTITION
94 #ifdef CONFIG_ULTRIX_PARTITION
97 #ifdef CONFIG_IBM_PARTITION
100 #ifdef CONFIG_KARMA_PARTITION
103 #ifdef CONFIG_SYSV68_PARTITION
109 struct parsed_partitions
*
110 check_partition(struct gendisk
*hd
, struct block_device
*bdev
)
112 struct parsed_partitions
*state
;
115 state
= kzalloc(sizeof(struct parsed_partitions
), GFP_KERNEL
);
118 state
->pp_buf
= (char *)__get_free_page(GFP_KERNEL
);
119 if (!state
->pp_buf
) {
123 state
->pp_buf
[0] = '\0';
126 disk_name(hd
, 0, state
->name
);
127 snprintf(state
->pp_buf
, PAGE_SIZE
, " %s:", state
->name
);
128 if (isdigit(state
->name
[strlen(state
->name
)-1]))
129 sprintf(state
->name
, "p");
131 state
->limit
= disk_max_parts(hd
);
133 while (!res
&& check_part
[i
]) {
134 memset(&state
->parts
, 0, sizeof(state
->parts
));
135 res
= check_part
[i
++](state
);
137 /* We have hit an I/O error which we don't report now.
138 * But record it, and let the others do their job.
146 printk(KERN_INFO
"%s", state
->pp_buf
);
148 free_page((unsigned long)state
->pp_buf
);
151 if (state
->access_beyond_eod
)
154 /* The partition is unrecognized. So report I/O errors if there were any */
157 strlcat(state
->pp_buf
, " unknown partition table\n", PAGE_SIZE
);
158 else if (warn_no_part
)
159 strlcat(state
->pp_buf
, " unable to read partition table\n", PAGE_SIZE
);
161 printk(KERN_INFO
"%s", state
->pp_buf
);
163 free_page((unsigned long)state
->pp_buf
);
This page took 0.033793 seconds and 6 git commands to generate.