diff options
Diffstat (limited to 'fs/partitions')
-rw-r--r-- | fs/partitions/Kconfig | 29 | ||||
-rw-r--r-- | fs/partitions/Makefile | 1 | ||||
-rw-r--r-- | fs/partitions/check.c | 37 | ||||
-rw-r--r-- | fs/partitions/ibm.c | 30 | ||||
-rw-r--r-- | fs/partitions/karma.c | 57 | ||||
-rw-r--r-- | fs/partitions/karma.h | 8 |
6 files changed, 133 insertions, 29 deletions
diff --git a/fs/partitions/Kconfig b/fs/partitions/Kconfig index 656bc43431b9..c9a478099281 100644 --- a/fs/partitions/Kconfig +++ b/fs/partitions/Kconfig | |||
@@ -21,26 +21,30 @@ config ACORN_PARTITION | |||
21 | Support hard disks partitioned under Acorn operating systems. | 21 | Support hard disks partitioned under Acorn operating systems. |
22 | 22 | ||
23 | config ACORN_PARTITION_CUMANA | 23 | config ACORN_PARTITION_CUMANA |
24 | bool "Cumana partition support" if PARTITION_ADVANCED && ACORN_PARTITION | 24 | bool "Cumana partition support" if PARTITION_ADVANCED |
25 | default y if ARCH_ACORN | 25 | default y if ARCH_ACORN |
26 | depends on ACORN_PARTITION | ||
26 | help | 27 | help |
27 | Say Y here if you would like to use hard disks under Linux which | 28 | Say Y here if you would like to use hard disks under Linux which |
28 | were partitioned using the Cumana interface on Acorn machines. | 29 | were partitioned using the Cumana interface on Acorn machines. |
29 | 30 | ||
30 | config ACORN_PARTITION_EESOX | 31 | config ACORN_PARTITION_EESOX |
31 | bool "EESOX partition support" if PARTITION_ADVANCED && ACORN_PARTITION | 32 | bool "EESOX partition support" if PARTITION_ADVANCED |
32 | default y if ARCH_ACORN | 33 | default y if ARCH_ACORN |
34 | depends on ACORN_PARTITION | ||
33 | 35 | ||
34 | config ACORN_PARTITION_ICS | 36 | config ACORN_PARTITION_ICS |
35 | bool "ICS partition support" if PARTITION_ADVANCED && ACORN_PARTITION | 37 | bool "ICS partition support" if PARTITION_ADVANCED |
36 | default y if ARCH_ACORN | 38 | default y if ARCH_ACORN |
39 | depends on ACORN_PARTITION | ||
37 | help | 40 | help |
38 | Say Y here if you would like to use hard disks under Linux which | 41 | Say Y here if you would like to use hard disks under Linux which |
39 | were partitioned using the ICS interface on Acorn machines. | 42 | were partitioned using the ICS interface on Acorn machines. |
40 | 43 | ||
41 | config ACORN_PARTITION_ADFS | 44 | config ACORN_PARTITION_ADFS |
42 | bool "Native filecore partition support" if PARTITION_ADVANCED && ACORN_PARTITION | 45 | bool "Native filecore partition support" if PARTITION_ADVANCED |
43 | default y if ARCH_ACORN | 46 | default y if ARCH_ACORN |
47 | depends on ACORN_PARTITION | ||
44 | help | 48 | help |
45 | The Acorn Disc Filing System is the standard file system of the | 49 | The Acorn Disc Filing System is the standard file system of the |
46 | RiscOS operating system which runs on Acorn's ARM-based Risc PC | 50 | RiscOS operating system which runs on Acorn's ARM-based Risc PC |
@@ -48,15 +52,17 @@ config ACORN_PARTITION_ADFS | |||
48 | `Y' here, Linux will support disk partitions created under ADFS. | 52 | `Y' here, Linux will support disk partitions created under ADFS. |
49 | 53 | ||
50 | config ACORN_PARTITION_POWERTEC | 54 | config ACORN_PARTITION_POWERTEC |
51 | bool "PowerTec partition support" if PARTITION_ADVANCED && ACORN_PARTITION | 55 | bool "PowerTec partition support" if PARTITION_ADVANCED |
52 | default y if ARCH_ACORN | 56 | default y if ARCH_ACORN |
57 | depends on ACORN_PARTITION | ||
53 | help | 58 | help |
54 | Support reading partition tables created on Acorn machines using | 59 | Support reading partition tables created on Acorn machines using |
55 | the PowerTec SCSI drive. | 60 | the PowerTec SCSI drive. |
56 | 61 | ||
57 | config ACORN_PARTITION_RISCIX | 62 | config ACORN_PARTITION_RISCIX |
58 | bool "RISCiX partition support" if PARTITION_ADVANCED && ACORN_PARTITION | 63 | bool "RISCiX partition support" if PARTITION_ADVANCED |
59 | default y if ARCH_ACORN | 64 | default y if ARCH_ACORN |
65 | depends on ACORN_PARTITION | ||
60 | help | 66 | help |
61 | Once upon a time, there was a native Unix port for the Acorn series | 67 | Once upon a time, there was a native Unix port for the Acorn series |
62 | of machines called RISCiX. If you say 'Y' here, Linux will be able | 68 | of machines called RISCiX. If you say 'Y' here, Linux will be able |
@@ -85,7 +91,7 @@ config ATARI_PARTITION | |||
85 | 91 | ||
86 | config IBM_PARTITION | 92 | config IBM_PARTITION |
87 | bool "IBM disk label and partition support" | 93 | bool "IBM disk label and partition support" |
88 | depends on PARTITION_ADVANCED && ARCH_S390 | 94 | depends on PARTITION_ADVANCED && S390 |
89 | help | 95 | help |
90 | Say Y here if you would like to be able to read the hard disk | 96 | Say Y here if you would like to be able to read the hard disk |
91 | partition table format used by IBM DASD disks operating under CMS. | 97 | partition table format used by IBM DASD disks operating under CMS. |
@@ -216,6 +222,13 @@ config SUN_PARTITION | |||
216 | given by the tar program ("man tar" or preferably "info tar"). If | 222 | given by the tar program ("man tar" or preferably "info tar"). If |
217 | you don't know what all this is about, say N. | 223 | you don't know what all this is about, say N. |
218 | 224 | ||
225 | config KARMA_PARTITION | ||
226 | bool "Karma Partition support" | ||
227 | depends on PARTITION_ADVANCED | ||
228 | help | ||
229 | Say Y here if you would like to mount the Rio Karma MP3 player, as it | ||
230 | uses a proprietary partition table. | ||
231 | |||
219 | config EFI_PARTITION | 232 | config EFI_PARTITION |
220 | bool "EFI GUID Partition support" | 233 | bool "EFI GUID Partition support" |
221 | depends on PARTITION_ADVANCED | 234 | depends on PARTITION_ADVANCED |
@@ -224,5 +237,3 @@ config EFI_PARTITION | |||
224 | Say Y here if you would like to use hard disks under Linux which | 237 | Say Y here if you would like to use hard disks under Linux which |
225 | were partitioned using EFI GPT. Presently only useful on the | 238 | were partitioned using EFI GPT. Presently only useful on the |
226 | IA-64 platform. | 239 | IA-64 platform. |
227 | |||
228 | # define_bool CONFIG_ACORN_PARTITION_CUMANA y | ||
diff --git a/fs/partitions/Makefile b/fs/partitions/Makefile index 66d5cc26fafb..42c7d3878ed0 100644 --- a/fs/partitions/Makefile +++ b/fs/partitions/Makefile | |||
@@ -17,3 +17,4 @@ obj-$(CONFIG_SUN_PARTITION) += sun.o | |||
17 | obj-$(CONFIG_ULTRIX_PARTITION) += ultrix.o | 17 | obj-$(CONFIG_ULTRIX_PARTITION) += ultrix.o |
18 | obj-$(CONFIG_IBM_PARTITION) += ibm.o | 18 | obj-$(CONFIG_IBM_PARTITION) += ibm.o |
19 | obj-$(CONFIG_EFI_PARTITION) += efi.o | 19 | obj-$(CONFIG_EFI_PARTITION) += efi.o |
20 | obj-$(CONFIG_KARMA_PARTITION) += karma.o | ||
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 8dc1822a7022..f924f459bdb8 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include "ibm.h" | 35 | #include "ibm.h" |
36 | #include "ultrix.h" | 36 | #include "ultrix.h" |
37 | #include "efi.h" | 37 | #include "efi.h" |
38 | #include "karma.h" | ||
38 | 39 | ||
39 | #ifdef CONFIG_BLK_DEV_MD | 40 | #ifdef CONFIG_BLK_DEV_MD |
40 | extern void md_autodetect_dev(dev_t dev); | 41 | extern void md_autodetect_dev(dev_t dev); |
@@ -103,6 +104,9 @@ static int (*check_part[])(struct parsed_partitions *, struct block_device *) = | |||
103 | #ifdef CONFIG_IBM_PARTITION | 104 | #ifdef CONFIG_IBM_PARTITION |
104 | ibm_partition, | 105 | ibm_partition, |
105 | #endif | 106 | #endif |
107 | #ifdef CONFIG_KARMA_PARTITION | ||
108 | karma_partition, | ||
109 | #endif | ||
106 | NULL | 110 | NULL |
107 | }; | 111 | }; |
108 | 112 | ||
@@ -226,7 +230,7 @@ static struct sysfs_ops part_sysfs_ops = { | |||
226 | static ssize_t part_uevent_store(struct hd_struct * p, | 230 | static ssize_t part_uevent_store(struct hd_struct * p, |
227 | const char *page, size_t count) | 231 | const char *page, size_t count) |
228 | { | 232 | { |
229 | kobject_hotplug(&p->kobj, KOBJ_ADD); | 233 | kobject_uevent(&p->kobj, KOBJ_ADD); |
230 | return count; | 234 | return count; |
231 | } | 235 | } |
232 | static ssize_t part_dev_read(struct hd_struct * p, char *page) | 236 | static ssize_t part_dev_read(struct hd_struct * p, char *page) |
@@ -336,12 +340,31 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len) | |||
336 | disk->part[part-1] = p; | 340 | disk->part[part-1] = p; |
337 | } | 341 | } |
338 | 342 | ||
343 | static char *make_block_name(struct gendisk *disk) | ||
344 | { | ||
345 | char *name; | ||
346 | static char *block_str = "block:"; | ||
347 | int size; | ||
348 | |||
349 | size = strlen(block_str) + strlen(disk->disk_name) + 1; | ||
350 | name = kmalloc(size, GFP_KERNEL); | ||
351 | if (!name) | ||
352 | return NULL; | ||
353 | strcpy(name, block_str); | ||
354 | strcat(name, disk->disk_name); | ||
355 | return name; | ||
356 | } | ||
357 | |||
339 | static void disk_sysfs_symlinks(struct gendisk *disk) | 358 | static void disk_sysfs_symlinks(struct gendisk *disk) |
340 | { | 359 | { |
341 | struct device *target = get_device(disk->driverfs_dev); | 360 | struct device *target = get_device(disk->driverfs_dev); |
342 | if (target) { | 361 | if (target) { |
362 | char *disk_name = make_block_name(disk); | ||
343 | sysfs_create_link(&disk->kobj,&target->kobj,"device"); | 363 | sysfs_create_link(&disk->kobj,&target->kobj,"device"); |
344 | sysfs_create_link(&target->kobj,&disk->kobj,"block"); | 364 | if (disk_name) { |
365 | sysfs_create_link(&target->kobj,&disk->kobj,disk_name); | ||
366 | kfree(disk_name); | ||
367 | } | ||
345 | } | 368 | } |
346 | } | 369 | } |
347 | 370 | ||
@@ -360,7 +383,7 @@ void register_disk(struct gendisk *disk) | |||
360 | if ((err = kobject_add(&disk->kobj))) | 383 | if ((err = kobject_add(&disk->kobj))) |
361 | return; | 384 | return; |
362 | disk_sysfs_symlinks(disk); | 385 | disk_sysfs_symlinks(disk); |
363 | kobject_hotplug(&disk->kobj, KOBJ_ADD); | 386 | kobject_uevent(&disk->kobj, KOBJ_ADD); |
364 | 387 | ||
365 | /* No minors to use for partitions */ | 388 | /* No minors to use for partitions */ |
366 | if (disk->minors == 1) { | 389 | if (disk->minors == 1) { |
@@ -461,10 +484,14 @@ void del_gendisk(struct gendisk *disk) | |||
461 | devfs_remove_disk(disk); | 484 | devfs_remove_disk(disk); |
462 | 485 | ||
463 | if (disk->driverfs_dev) { | 486 | if (disk->driverfs_dev) { |
487 | char *disk_name = make_block_name(disk); | ||
464 | sysfs_remove_link(&disk->kobj, "device"); | 488 | sysfs_remove_link(&disk->kobj, "device"); |
465 | sysfs_remove_link(&disk->driverfs_dev->kobj, "block"); | 489 | if (disk_name) { |
490 | sysfs_remove_link(&disk->driverfs_dev->kobj, disk_name); | ||
491 | kfree(disk_name); | ||
492 | } | ||
466 | put_device(disk->driverfs_dev); | 493 | put_device(disk->driverfs_dev); |
467 | } | 494 | } |
468 | kobject_hotplug(&disk->kobj, KOBJ_REMOVE); | 495 | kobject_uevent(&disk->kobj, KOBJ_REMOVE); |
469 | kobject_del(&disk->kobj); | 496 | kobject_del(&disk->kobj); |
470 | } | 497 | } |
diff --git a/fs/partitions/ibm.c b/fs/partitions/ibm.c index 6327bcb2d73d..78010ad60e47 100644 --- a/fs/partitions/ibm.c +++ b/fs/partitions/ibm.c | |||
@@ -56,7 +56,10 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev) | |||
56 | struct hd_geometry *geo; | 56 | struct hd_geometry *geo; |
57 | char type[5] = {0,}; | 57 | char type[5] = {0,}; |
58 | char name[7] = {0,}; | 58 | char name[7] = {0,}; |
59 | struct vtoc_volume_label *vlabel; | 59 | union label_t { |
60 | struct vtoc_volume_label vol; | ||
61 | struct vtoc_cms_label cms; | ||
62 | } *label; | ||
60 | unsigned char *data; | 63 | unsigned char *data; |
61 | Sector sect; | 64 | Sector sect; |
62 | 65 | ||
@@ -64,9 +67,8 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev) | |||
64 | goto out_noinfo; | 67 | goto out_noinfo; |
65 | if ((geo = kmalloc(sizeof(struct hd_geometry), GFP_KERNEL)) == NULL) | 68 | if ((geo = kmalloc(sizeof(struct hd_geometry), GFP_KERNEL)) == NULL) |
66 | goto out_nogeo; | 69 | goto out_nogeo; |
67 | if ((vlabel = kmalloc(sizeof(struct vtoc_volume_label), | 70 | if ((label = kmalloc(sizeof(union label_t), GFP_KERNEL)) == NULL) |
68 | GFP_KERNEL)) == NULL) | 71 | goto out_nolab; |
69 | goto out_novlab; | ||
70 | 72 | ||
71 | if (ioctl_by_bdev(bdev, BIODASDINFO, (unsigned long)info) != 0 || | 73 | if (ioctl_by_bdev(bdev, BIODASDINFO, (unsigned long)info) != 0 || |
72 | ioctl_by_bdev(bdev, HDIO_GETGEO, (unsigned long)geo) != 0) | 74 | ioctl_by_bdev(bdev, HDIO_GETGEO, (unsigned long)geo) != 0) |
@@ -87,7 +89,7 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev) | |||
87 | strncpy(name, data + 8, 6); | 89 | strncpy(name, data + 8, 6); |
88 | else | 90 | else |
89 | strncpy(name, data + 4, 6); | 91 | strncpy(name, data + 4, 6); |
90 | memcpy (vlabel, data, sizeof(struct vtoc_volume_label)); | 92 | memcpy(label, data, sizeof(union label_t)); |
91 | put_dev_sector(sect); | 93 | put_dev_sector(sect); |
92 | 94 | ||
93 | EBCASC(type, 4); | 95 | EBCASC(type, 4); |
@@ -100,14 +102,12 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev) | |||
100 | /* | 102 | /* |
101 | * VM style CMS1 labeled disk | 103 | * VM style CMS1 labeled disk |
102 | */ | 104 | */ |
103 | int *label = (int *) vlabel; | 105 | if (label->cms.disk_offset != 0) { |
104 | |||
105 | if (label[13] != 0) { | ||
106 | printk("CMS1/%8s(MDSK):", name); | 106 | printk("CMS1/%8s(MDSK):", name); |
107 | /* disk is reserved minidisk */ | 107 | /* disk is reserved minidisk */ |
108 | blocksize = label[3]; | 108 | blocksize = label->cms.block_size; |
109 | offset = label[13]; | 109 | offset = label->cms.disk_offset; |
110 | size = (label[7] - 1)*(blocksize >> 9); | 110 | size = (label->cms.block_count - 1) * (blocksize >> 9); |
111 | } else { | 111 | } else { |
112 | printk("CMS1/%8s:", name); | 112 | printk("CMS1/%8s:", name); |
113 | offset = (info->label_block + 1); | 113 | offset = (info->label_block + 1); |
@@ -126,7 +126,7 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev) | |||
126 | printk("VOL1/%8s:", name); | 126 | printk("VOL1/%8s:", name); |
127 | 127 | ||
128 | /* get block number and read then go through format1 labels */ | 128 | /* get block number and read then go through format1 labels */ |
129 | blk = cchhb2blk(&vlabel->vtoc, geo) + 1; | 129 | blk = cchhb2blk(&label->vol.vtoc, geo) + 1; |
130 | counter = 0; | 130 | counter = 0; |
131 | while ((data = read_dev_sector(bdev, blk*(blocksize/512), | 131 | while ((data = read_dev_sector(bdev, blk*(blocksize/512), |
132 | §)) != NULL) { | 132 | §)) != NULL) { |
@@ -174,7 +174,7 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev) | |||
174 | } | 174 | } |
175 | 175 | ||
176 | printk("\n"); | 176 | printk("\n"); |
177 | kfree(vlabel); | 177 | kfree(label); |
178 | kfree(geo); | 178 | kfree(geo); |
179 | kfree(info); | 179 | kfree(info); |
180 | return 1; | 180 | return 1; |
@@ -182,8 +182,8 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev) | |||
182 | out_readerr: | 182 | out_readerr: |
183 | out_badsect: | 183 | out_badsect: |
184 | out_noioctl: | 184 | out_noioctl: |
185 | kfree(vlabel); | 185 | kfree(label); |
186 | out_novlab: | 186 | out_nolab: |
187 | kfree(geo); | 187 | kfree(geo); |
188 | out_nogeo: | 188 | out_nogeo: |
189 | kfree(info); | 189 | kfree(info); |
diff --git a/fs/partitions/karma.c b/fs/partitions/karma.c new file mode 100644 index 000000000000..176d89bcf123 --- /dev/null +++ b/fs/partitions/karma.c | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | * fs/partitions/karma.c | ||
3 | * Rio Karma partition info. | ||
4 | * | ||
5 | * Copyright (C) 2006 Bob Copeland (me@bobcopeland.com) | ||
6 | * based on osf.c | ||
7 | */ | ||
8 | |||
9 | #include "check.h" | ||
10 | #include "karma.h" | ||
11 | |||
12 | int karma_partition(struct parsed_partitions *state, struct block_device *bdev) | ||
13 | { | ||
14 | int i; | ||
15 | int slot = 1; | ||
16 | Sector sect; | ||
17 | unsigned char *data; | ||
18 | struct disklabel { | ||
19 | u8 d_reserved[270]; | ||
20 | struct d_partition { | ||
21 | __le32 p_res; | ||
22 | u8 p_fstype; | ||
23 | u8 p_res2[3]; | ||
24 | __le32 p_offset; | ||
25 | __le32 p_size; | ||
26 | } d_partitions[2]; | ||
27 | u8 d_blank[208]; | ||
28 | __le16 d_magic; | ||
29 | } __attribute__((packed)) *label; | ||
30 | struct d_partition *p; | ||
31 | |||
32 | data = read_dev_sector(bdev, 0, §); | ||
33 | if (!data) | ||
34 | return -1; | ||
35 | |||
36 | label = (struct disklabel *)data; | ||
37 | if (le16_to_cpu(label->d_magic) != KARMA_LABEL_MAGIC) { | ||
38 | put_dev_sector(sect); | ||
39 | return 0; | ||
40 | } | ||
41 | |||
42 | p = label->d_partitions; | ||
43 | for (i = 0 ; i < 2; i++, p++) { | ||
44 | if (slot == state->limit) | ||
45 | break; | ||
46 | |||
47 | if (p->p_fstype == 0x4d && le32_to_cpu(p->p_size)) { | ||
48 | put_partition(state, slot, le32_to_cpu(p->p_offset), | ||
49 | le32_to_cpu(p->p_size)); | ||
50 | } | ||
51 | slot++; | ||
52 | } | ||
53 | printk("\n"); | ||
54 | put_dev_sector(sect); | ||
55 | return 1; | ||
56 | } | ||
57 | |||
diff --git a/fs/partitions/karma.h b/fs/partitions/karma.h new file mode 100644 index 000000000000..ecf7d3f2a3d8 --- /dev/null +++ b/fs/partitions/karma.h | |||
@@ -0,0 +1,8 @@ | |||
1 | /* | ||
2 | * fs/partitions/karma.h | ||
3 | */ | ||
4 | |||
5 | #define KARMA_LABEL_MAGIC 0xAB56 | ||
6 | |||
7 | int karma_partition(struct parsed_partitions *state, struct block_device *bdev); | ||
8 | |||