diff options
author | Peter Oberparleiter <peter.oberparleiter@de.ibm.com> | 2006-01-06 03:19:09 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 11:33:48 -0500 |
commit | 56dc6a88ec76019e0d0729165cb5b98536270e1d (patch) | |
tree | 4f79e6c12bae4be6bc8f78d786367076d38f4798 | |
parent | 973bd9937569146de0917f54f05b2942f8257912 (diff) |
[PATCH] s390: cms volume label definitions
Moved definition of CMS volume label to vtoc.h and modify partitions/ibm.c to
use this volume label definition instead of anonymous array.
Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/s390/block/dasd_diag.c | 7 | ||||
-rw-r--r-- | drivers/s390/block/dasd_diag.h | 23 | ||||
-rw-r--r-- | fs/partitions/ibm.c | 30 | ||||
-rw-r--r-- | include/asm-s390/vtoc.h | 24 |
4 files changed, 44 insertions, 40 deletions
diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c index ab8754e566bc..16c4b7d94bd7 100644 --- a/drivers/s390/block/dasd_diag.c +++ b/drivers/s390/block/dasd_diag.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * Bugreports.to..: <Linux390@de.ibm.com> | 6 | * Bugreports.to..: <Linux390@de.ibm.com> |
7 | * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 | 7 | * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 |
8 | * | 8 | * |
9 | * $Revision: 1.51 $ | 9 | * $Revision: 1.52 $ |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/config.h> | 12 | #include <linux/config.h> |
@@ -25,6 +25,7 @@ | |||
25 | #include <asm/io.h> | 25 | #include <asm/io.h> |
26 | #include <asm/s390_ext.h> | 26 | #include <asm/s390_ext.h> |
27 | #include <asm/todclk.h> | 27 | #include <asm/todclk.h> |
28 | #include <asm/vtoc.h> | ||
28 | 29 | ||
29 | #include "dasd_int.h" | 30 | #include "dasd_int.h" |
30 | #include "dasd_diag.h" | 31 | #include "dasd_diag.h" |
@@ -329,7 +330,7 @@ dasd_diag_check_device(struct dasd_device *device) | |||
329 | struct dasd_diag_private *private; | 330 | struct dasd_diag_private *private; |
330 | struct dasd_diag_characteristics *rdc_data; | 331 | struct dasd_diag_characteristics *rdc_data; |
331 | struct dasd_diag_bio bio; | 332 | struct dasd_diag_bio bio; |
332 | struct dasd_diag_cms_label *label; | 333 | struct vtoc_cms_label *label; |
333 | blocknum_t end_block; | 334 | blocknum_t end_block; |
334 | unsigned int sb, bsize; | 335 | unsigned int sb, bsize; |
335 | int rc; | 336 | int rc; |
@@ -380,7 +381,7 @@ dasd_diag_check_device(struct dasd_device *device) | |||
380 | mdsk_term_io(device); | 381 | mdsk_term_io(device); |
381 | 382 | ||
382 | /* figure out blocksize of device */ | 383 | /* figure out blocksize of device */ |
383 | label = (struct dasd_diag_cms_label *) get_zeroed_page(GFP_KERNEL); | 384 | label = (struct vtoc_cms_label *) get_zeroed_page(GFP_KERNEL); |
384 | if (label == NULL) { | 385 | if (label == NULL) { |
385 | DEV_MESSAGE(KERN_WARNING, device, "%s", | 386 | DEV_MESSAGE(KERN_WARNING, device, "%s", |
386 | "No memory to allocate initialization request"); | 387 | "No memory to allocate initialization request"); |
diff --git a/drivers/s390/block/dasd_diag.h b/drivers/s390/block/dasd_diag.h index df31484d73a7..37edf6e91715 100644 --- a/drivers/s390/block/dasd_diag.h +++ b/drivers/s390/block/dasd_diag.h | |||
@@ -6,7 +6,7 @@ | |||
6 | * Bugreports.to..: <Linux390@de.ibm.com> | 6 | * Bugreports.to..: <Linux390@de.ibm.com> |
7 | * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 | 7 | * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 |
8 | * | 8 | * |
9 | * $Revision: 1.8 $ | 9 | * $Revision: 1.9 $ |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #define MDSK_WRITE_REQ 0x01 | 12 | #define MDSK_WRITE_REQ 0x01 |
@@ -44,27 +44,6 @@ struct dasd_diag_characteristics { | |||
44 | u8 rdev_features; | 44 | u8 rdev_features; |
45 | } __attribute__ ((packed, aligned(4))); | 45 | } __attribute__ ((packed, aligned(4))); |
46 | 46 | ||
47 | struct dasd_diag_cms_label { | ||
48 | u8 label_id[4]; | ||
49 | u8 vol_id[6]; | ||
50 | u16 version_id; | ||
51 | u32 block_size; | ||
52 | u32 origin_ptr; | ||
53 | u32 usable_count; | ||
54 | u32 formatted_count; | ||
55 | u32 block_count; | ||
56 | u32 used_count; | ||
57 | u32 fst_size; | ||
58 | u32 fst_count; | ||
59 | u8 format_date[6]; | ||
60 | u8 reserved1[2]; | ||
61 | u32 disk_offset; | ||
62 | u32 map_block; | ||
63 | u32 hblk_disp; | ||
64 | u32 user_disp; | ||
65 | u8 reserved2[4]; | ||
66 | u8 segment_name[8]; | ||
67 | } __attribute__ ((packed)); | ||
68 | 47 | ||
69 | #ifdef CONFIG_ARCH_S390X | 48 | #ifdef CONFIG_ARCH_S390X |
70 | #define DASD_DIAG_FLAGA_DEFAULT DASD_DIAG_FLAGA_FORMAT_64BIT | 49 | #define DASD_DIAG_FLAGA_DEFAULT DASD_DIAG_FLAGA_FORMAT_64BIT |
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/include/asm-s390/vtoc.h b/include/asm-s390/vtoc.h index 41d369f38b0e..d1de5b7ebb0b 100644 --- a/include/asm-s390/vtoc.h +++ b/include/asm-s390/vtoc.h | |||
@@ -176,4 +176,28 @@ struct vtoc_format7_label | |||
176 | struct vtoc_cchhb DS7PTRDS; /* pointer to next FMT7 DSCB */ | 176 | struct vtoc_cchhb DS7PTRDS; /* pointer to next FMT7 DSCB */ |
177 | } __attribute__ ((packed)); | 177 | } __attribute__ ((packed)); |
178 | 178 | ||
179 | struct vtoc_cms_label { | ||
180 | u8 label_id[4]; /* Label identifier */ | ||
181 | u8 vol_id[6]; /* Volid */ | ||
182 | u16 version_id; /* Version identifier */ | ||
183 | u32 block_size; /* Disk block size */ | ||
184 | u32 origin_ptr; /* Disk origin pointer */ | ||
185 | u32 usable_count; /* Number of usable cylinders/blocks */ | ||
186 | u32 formatted_count; /* Maximum number of formatted cylinders/ | ||
187 | * blocks */ | ||
188 | u32 block_count; /* Disk size in CMS blocks */ | ||
189 | u32 used_count; /* Number of CMS blocks in use */ | ||
190 | u32 fst_size; /* File Status Table (FST) size */ | ||
191 | u32 fst_count; /* Number of FSTs per CMS block */ | ||
192 | u8 format_date[6]; /* Disk FORMAT date */ | ||
193 | u8 reserved1[2]; | ||
194 | u32 disk_offset; /* Disk offset when reserved*/ | ||
195 | u32 map_block; /* Allocation Map Block with next hole */ | ||
196 | u32 hblk_disp; /* Displacement into HBLK data of next hole */ | ||
197 | u32 user_disp; /* Displacement into user part of Allocation | ||
198 | * map */ | ||
199 | u8 reserved2[4]; | ||
200 | u8 segment_name[8]; /* Name of shared segment */ | ||
201 | } __attribute__ ((packed)); | ||
202 | |||
179 | #endif /* _ASM_S390_VTOC_H */ | 203 | #endif /* _ASM_S390_VTOC_H */ |