diff options
Diffstat (limited to 'fs/partitions')
-rw-r--r-- | fs/partitions/Kconfig | 9 | ||||
-rw-r--r-- | fs/partitions/Makefile | 1 | ||||
-rw-r--r-- | fs/partitions/check.c | 4 | ||||
-rw-r--r-- | fs/partitions/sysv68.c | 92 | ||||
-rw-r--r-- | fs/partitions/sysv68.h | 1 |
5 files changed, 107 insertions, 0 deletions
diff --git a/fs/partitions/Kconfig b/fs/partitions/Kconfig index 6e8bb66fe619..01207042048b 100644 --- a/fs/partitions/Kconfig +++ b/fs/partitions/Kconfig | |||
@@ -236,3 +236,12 @@ config EFI_PARTITION | |||
236 | help | 236 | help |
237 | 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 |
238 | were partitioned using EFI GPT. | 238 | were partitioned using EFI GPT. |
239 | |||
240 | config SYSV68_PARTITION | ||
241 | bool "SYSV68 partition table support" if PARTITION_ADVANCED | ||
242 | default y if M68K | ||
243 | help | ||
244 | Say Y here if you would like to be able to read the hard disk | ||
245 | partition table format used by Motorola Delta machines (using | ||
246 | sysv68). | ||
247 | Otherwise, say N. | ||
diff --git a/fs/partitions/Makefile b/fs/partitions/Makefile index 67e665fdb7fc..03af8eac51da 100644 --- a/fs/partitions/Makefile +++ b/fs/partitions/Makefile | |||
@@ -17,3 +17,4 @@ obj-$(CONFIG_ULTRIX_PARTITION) += ultrix.o | |||
17 | obj-$(CONFIG_IBM_PARTITION) += ibm.o | 17 | obj-$(CONFIG_IBM_PARTITION) += ibm.o |
18 | obj-$(CONFIG_EFI_PARTITION) += efi.o | 18 | obj-$(CONFIG_EFI_PARTITION) += efi.o |
19 | obj-$(CONFIG_KARMA_PARTITION) += karma.o | 19 | obj-$(CONFIG_KARMA_PARTITION) += karma.o |
20 | obj-$(CONFIG_SYSV68_PARTITION) += sysv68.o | ||
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 6b9dae3f0e6c..9a3a058f3553 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include "ultrix.h" | 34 | #include "ultrix.h" |
35 | #include "efi.h" | 35 | #include "efi.h" |
36 | #include "karma.h" | 36 | #include "karma.h" |
37 | #include "sysv68.h" | ||
37 | 38 | ||
38 | #ifdef CONFIG_BLK_DEV_MD | 39 | #ifdef CONFIG_BLK_DEV_MD |
39 | extern void md_autodetect_dev(dev_t dev); | 40 | extern void md_autodetect_dev(dev_t dev); |
@@ -105,6 +106,9 @@ static int (*check_part[])(struct parsed_partitions *, struct block_device *) = | |||
105 | #ifdef CONFIG_KARMA_PARTITION | 106 | #ifdef CONFIG_KARMA_PARTITION |
106 | karma_partition, | 107 | karma_partition, |
107 | #endif | 108 | #endif |
109 | #ifdef CONFIG_SYSV68_PARTITION | ||
110 | sysv68_partition, | ||
111 | #endif | ||
108 | NULL | 112 | NULL |
109 | }; | 113 | }; |
110 | 114 | ||
diff --git a/fs/partitions/sysv68.c b/fs/partitions/sysv68.c new file mode 100644 index 000000000000..4eba27b78643 --- /dev/null +++ b/fs/partitions/sysv68.c | |||
@@ -0,0 +1,92 @@ | |||
1 | /* | ||
2 | * fs/partitions/sysv68.c | ||
3 | * | ||
4 | * Copyright (C) 2007 Philippe De Muyter <phdm@macqel.be> | ||
5 | */ | ||
6 | |||
7 | #include "check.h" | ||
8 | #include "sysv68.h" | ||
9 | |||
10 | /* | ||
11 | * Volume ID structure: on first 256-bytes sector of disk | ||
12 | */ | ||
13 | |||
14 | struct volumeid { | ||
15 | u8 vid_unused[248]; | ||
16 | u8 vid_mac[8]; /* ASCII string "MOTOROLA" */ | ||
17 | }; | ||
18 | |||
19 | /* | ||
20 | * config block: second 256-bytes sector on disk | ||
21 | */ | ||
22 | |||
23 | struct dkconfig { | ||
24 | u8 ios_unused0[128]; | ||
25 | __be32 ios_slcblk; /* Slice table block number */ | ||
26 | __be16 ios_slccnt; /* Number of entries in slice table */ | ||
27 | u8 ios_unused1[122]; | ||
28 | }; | ||
29 | |||
30 | /* | ||
31 | * combined volumeid and dkconfig block | ||
32 | */ | ||
33 | |||
34 | struct dkblk0 { | ||
35 | struct volumeid dk_vid; | ||
36 | struct dkconfig dk_ios; | ||
37 | }; | ||
38 | |||
39 | /* | ||
40 | * Slice Table Structure | ||
41 | */ | ||
42 | |||
43 | struct slice { | ||
44 | __be32 nblocks; /* slice size (in blocks) */ | ||
45 | __be32 blkoff; /* block offset of slice */ | ||
46 | }; | ||
47 | |||
48 | |||
49 | int sysv68_partition(struct parsed_partitions *state, struct block_device *bdev) | ||
50 | { | ||
51 | int i, slices; | ||
52 | int slot = 1; | ||
53 | Sector sect; | ||
54 | unsigned char *data; | ||
55 | struct dkblk0 *b; | ||
56 | struct slice *slice; | ||
57 | |||
58 | data = read_dev_sector(bdev, 0, §); | ||
59 | if (!data) | ||
60 | return -1; | ||
61 | |||
62 | b = (struct dkblk0 *)data; | ||
63 | if (memcmp(b->dk_vid.vid_mac, "MOTOROLA", sizeof(b->dk_vid.vid_mac))) { | ||
64 | put_dev_sector(sect); | ||
65 | return 0; | ||
66 | } | ||
67 | slices = be16_to_cpu(b->dk_ios.ios_slccnt); | ||
68 | i = be32_to_cpu(b->dk_ios.ios_slcblk); | ||
69 | put_dev_sector(sect); | ||
70 | |||
71 | data = read_dev_sector(bdev, i, §); | ||
72 | if (!data) | ||
73 | return -1; | ||
74 | |||
75 | slices -= 1; /* last slice is the whole disk */ | ||
76 | printk("sysV68: %s(s%u)", state->name, slices); | ||
77 | slice = (struct slice *)data; | ||
78 | for (i = 0; i < slices; i++, slice++) { | ||
79 | if (slot == state->limit) | ||
80 | break; | ||
81 | if (be32_to_cpu(slice->nblocks)) { | ||
82 | put_partition(state, slot, | ||
83 | be32_to_cpu(slice->blkoff), | ||
84 | be32_to_cpu(slice->nblocks)); | ||
85 | printk("(s%u)", i); | ||
86 | } | ||
87 | slot++; | ||
88 | } | ||
89 | printk("\n"); | ||
90 | put_dev_sector(sect); | ||
91 | return 1; | ||
92 | } | ||
diff --git a/fs/partitions/sysv68.h b/fs/partitions/sysv68.h new file mode 100644 index 000000000000..fa733f68431b --- /dev/null +++ b/fs/partitions/sysv68.h | |||
@@ -0,0 +1 @@ | |||
extern int sysv68_partition(struct parsed_partitions *state, struct block_device *bdev); | |||