disklabel.c revision 1.1 1 1.1 tsutsui /* $NetBSD: disklabel.c,v 1.1 2013/01/05 17:44:24 tsutsui Exp $ */
2 1.1 tsutsui
3 1.1 tsutsui /*
4 1.1 tsutsui * Copyright (c) 1992 OMRON Corporation.
5 1.1 tsutsui *
6 1.1 tsutsui * This code is derived from software contributed to Berkeley by
7 1.1 tsutsui * OMRON Corporation.
8 1.1 tsutsui *
9 1.1 tsutsui * Redistribution and use in source and binary forms, with or without
10 1.1 tsutsui * modification, are permitted provided that the following conditions
11 1.1 tsutsui * are met:
12 1.1 tsutsui * 1. Redistributions of source code must retain the above copyright
13 1.1 tsutsui * notice, this list of conditions and the following disclaimer.
14 1.1 tsutsui * 2. Redistributions in binary form must reproduce the above copyright
15 1.1 tsutsui * notice, this list of conditions and the following disclaimer in the
16 1.1 tsutsui * documentation and/or other materials provided with the distribution.
17 1.1 tsutsui * 3. All advertising materials mentioning features or use of this software
18 1.1 tsutsui * must display the following acknowledgement:
19 1.1 tsutsui * This product includes software developed by the University of
20 1.1 tsutsui * California, Berkeley and its contributors.
21 1.1 tsutsui * 4. Neither the name of the University nor the names of its contributors
22 1.1 tsutsui * may be used to endorse or promote products derived from this software
23 1.1 tsutsui * without specific prior written permission.
24 1.1 tsutsui *
25 1.1 tsutsui * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 1.1 tsutsui * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 1.1 tsutsui * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 1.1 tsutsui * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 1.1 tsutsui * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 1.1 tsutsui * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 1.1 tsutsui * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 1.1 tsutsui * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 1.1 tsutsui * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 1.1 tsutsui * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 1.1 tsutsui * SUCH DAMAGE.
36 1.1 tsutsui *
37 1.1 tsutsui * @(#)disklabel.c 8.1 (Berkeley) 6/10/93
38 1.1 tsutsui */
39 1.1 tsutsui /*
40 1.1 tsutsui * Copyright (c) 1992, 1993
41 1.1 tsutsui * The Regents of the University of California. All rights reserved.
42 1.1 tsutsui *
43 1.1 tsutsui * This code is derived from software contributed to Berkeley by
44 1.1 tsutsui * OMRON Corporation.
45 1.1 tsutsui *
46 1.1 tsutsui * Redistribution and use in source and binary forms, with or without
47 1.1 tsutsui * modification, are permitted provided that the following conditions
48 1.1 tsutsui * are met:
49 1.1 tsutsui * 1. Redistributions of source code must retain the above copyright
50 1.1 tsutsui * notice, this list of conditions and the following disclaimer.
51 1.1 tsutsui * 2. Redistributions in binary form must reproduce the above copyright
52 1.1 tsutsui * notice, this list of conditions and the following disclaimer in the
53 1.1 tsutsui * documentation and/or other materials provided with the distribution.
54 1.1 tsutsui * 3. Neither the name of the University nor the names of its contributors
55 1.1 tsutsui * may be used to endorse or promote products derived from this software
56 1.1 tsutsui * without specific prior written permission.
57 1.1 tsutsui *
58 1.1 tsutsui * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
59 1.1 tsutsui * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
60 1.1 tsutsui * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
61 1.1 tsutsui * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
62 1.1 tsutsui * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
63 1.1 tsutsui * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
64 1.1 tsutsui * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
65 1.1 tsutsui * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
66 1.1 tsutsui * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
67 1.1 tsutsui * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
68 1.1 tsutsui * SUCH DAMAGE.
69 1.1 tsutsui *
70 1.1 tsutsui * @(#)disklabel.c 8.1 (Berkeley) 6/10/93
71 1.1 tsutsui */
72 1.1 tsutsui
73 1.1 tsutsui /*
74 1.1 tsutsui * disklabel.c -- operate disklabel for BSD & OMRON
75 1.1 tsutsui * by A.Fujita, FEB-17-1992
76 1.1 tsutsui */
77 1.1 tsutsui
78 1.1 tsutsui #include <sys/param.h>
79 1.1 tsutsui #define DKTYPENAMES
80 1.1 tsutsui #define FSTYPENAMES
81 1.1 tsutsui #include <sys/disklabel.h>
82 1.1 tsutsui #include <ufs/ffs/fs.h>
83 1.1 tsutsui #include <lib/libkern/libkern.h>
84 1.1 tsutsui #include <luna68k/stand/boot/samachdep.h>
85 1.1 tsutsui #include <luna68k/stand/boot/status.h>
86 1.1 tsutsui #include <luna68k/stand/boot/omron_disklabel.h>
87 1.1 tsutsui
88 1.1 tsutsui static void display(struct disklabel *);
89 1.1 tsutsui
90 1.1 tsutsui #define SBSIZE SBLOCKSIZE
91 1.1 tsutsui #define FS_MAGIC FS_UFS1_MAGIC
92 1.1 tsutsui #define LABEL_SIZE BBSIZE
93 1.1 tsutsui
94 1.1 tsutsui u_char lbl_buff[LABEL_SIZE];
95 1.1 tsutsui
96 1.1 tsutsui #if 0
97 1.1 tsutsui u_short
98 1.1 tsutsui dkcksum(struct disklabel *lp)
99 1.1 tsutsui {
100 1.1 tsutsui u_short *start, *end;
101 1.1 tsutsui u_short sum = 0;
102 1.1 tsutsui
103 1.1 tsutsui start = (u_short *)lp;
104 1.1 tsutsui end = (u_short *)&lp->d_partitions[lp->d_npartitions];
105 1.1 tsutsui while (start < end)
106 1.1 tsutsui sum ^= *start++;
107 1.1 tsutsui return (sum);
108 1.1 tsutsui }
109 1.1 tsutsui #endif
110 1.1 tsutsui
111 1.1 tsutsui int
112 1.1 tsutsui disklabel(int argc, char *argv[])
113 1.1 tsutsui {
114 1.1 tsutsui struct scd_dk_label *omp = (struct scd_dk_label *) lbl_buff;
115 1.1 tsutsui struct disklabel *bp = (struct disklabel *)omp->dkl_pad;
116 1.1 tsutsui struct fs *fp = (struct fs *) lbl_buff;
117 1.1 tsutsui u_short *p;
118 1.1 tsutsui u_long chksum, count;
119 1.1 tsutsui char *q;
120 1.1 tsutsui int i, j;
121 1.1 tsutsui
122 1.1 tsutsui if (argc < 2) {
123 1.1 tsutsui printf("This command is required sub command !!\n");
124 1.1 tsutsui return(ST_ERROR);
125 1.1 tsutsui }
126 1.1 tsutsui
127 1.1 tsutsui if (!strcmp(argv[1], "help")) {
128 1.1 tsutsui printf("Subcommand of disklabel\n\n");
129 1.1 tsutsui printf("\thelp:\t\tthis command\n");
130 1.1 tsutsui printf("\tread:\t\tread disklabel from scsi_device\n");
131 1.1 tsutsui printf("\twrite:\t\twrite disklabel to scsi_device\n");
132 1.1 tsutsui printf("\tomron:\t\tshow OMRON disklabel infomation\n");
133 1.1 tsutsui printf("\tbsd:\t\tshow BSD disklabel infomation\n");
134 1.1 tsutsui printf("\tcopy:\t\tcopy disklabel infomation from OMRON to BSD\n");
135 1.1 tsutsui printf("\tchecksum:\tdoing checksum\n");
136 1.1 tsutsui printf("\tset:\t\tchange BSD disklabel infomation\n");
137 1.1 tsutsui printf("\n\n");
138 1.1 tsutsui } else if (!strcmp(argv[1], "read")) {
139 1.1 tsutsui if (scsi_read( 0, lbl_buff, LABEL_SIZE)) {
140 1.1 tsutsui printf("Disk Label read done.\n");
141 1.1 tsutsui } else {
142 1.1 tsutsui printf("Disk Label read error !!\n");
143 1.1 tsutsui }
144 1.1 tsutsui } else if (!strcmp(argv[1], "omron")) {
145 1.1 tsutsui i = (int) &omp->dkl_badchk;
146 1.1 tsutsui i -= (int) lbl_buff;
147 1.1 tsutsui printf("Offset = %d\n", i);
148 1.1 tsutsui printf("\n");
149 1.1 tsutsui printf("Checksum of Bad Track:\t0x%x\n", omp->dkl_badchk);
150 1.1 tsutsui printf("Logical Block Total:\t%lu(0x%lx)\n", omp->dkl_maxblk, omp->dkl_maxblk);
151 1.1 tsutsui printf("Disk Drive Type:\t0x%x\n", omp->dkl_dtype);
152 1.1 tsutsui printf("Number of Disk Drives:\t%d(0x%x)\n", omp->dkl_ndisk, omp->dkl_ndisk);
153 1.1 tsutsui printf("Number of Data Cylinders:\t%d(0x%x)\n", omp->dkl_ncyl, omp->dkl_ncyl);
154 1.1 tsutsui printf("Number of Alternate Cylinders:\t%d(0x%x)\n",
155 1.1 tsutsui omp->dkl_acyl,omp->dkl_acyl);
156 1.1 tsutsui printf("Number of Heads in This Partition:\t%d(0x%x)\n",
157 1.1 tsutsui omp->dkl_nhead, omp->dkl_nhead);
158 1.1 tsutsui printf("Number of 512 byte Sectors per Track:\t%d(0x%x)\n",
159 1.1 tsutsui omp->dkl_nsect, omp->dkl_nsect);
160 1.1 tsutsui printf("Identifies Proper Label Locations:\t0x%x\n",
161 1.1 tsutsui omp->dkl_bhead);
162 1.1 tsutsui printf("Physical Partition Number:\t%d(0x%x)\n",
163 1.1 tsutsui omp->dkl_ppart, omp->dkl_ppart);
164 1.1 tsutsui for (i = 0; i < NLPART; i++)
165 1.1 tsutsui printf("\t%d:\t%ld\t%ld\n", i,
166 1.1 tsutsui (long)omp->dkl_map[i].dkl_blkno, (long)omp->dkl_map[i].dkl_nblk);
167 1.1 tsutsui printf("Identifies This Label Format:\t0x%x\n", omp->dkl_magic);
168 1.1 tsutsui printf("XOR Checksum of Sector:\t0x%x\n", omp->dkl_cksum);
169 1.1 tsutsui } else if (!strcmp(argv[1], "checksum")) {
170 1.1 tsutsui if (omp->dkl_magic == DKL_MAGIC){
171 1.1 tsutsui /* checksum of disk-label */
172 1.1 tsutsui chksum = 0;
173 1.1 tsutsui count = sizeof(struct scd_dk_label) / sizeof(short int);
174 1.1 tsutsui for (p= (u_short *) lbl_buff; count > 0; count--) {
175 1.1 tsutsui if (count == 1)
176 1.1 tsutsui printf("Check Sum: 0x%lx\n", chksum);
177 1.1 tsutsui chksum ^= *p++;
178 1.1 tsutsui }
179 1.1 tsutsui
180 1.1 tsutsui printf("dkl_cksum: 0x%x\n", omp->dkl_cksum);
181 1.1 tsutsui
182 1.1 tsutsui if (chksum != 0) {
183 1.1 tsutsui printf("OMRON Disklabel check sum error.\n");
184 1.1 tsutsui }
185 1.1 tsutsui } else {
186 1.1 tsutsui printf("OMRON Disklabel not found.\n");
187 1.1 tsutsui }
188 1.1 tsutsui } else if (!strcmp(argv[1], "copy")) {
189 1.1 tsutsui memset(bp, 0, sizeof(struct disklabel));
190 1.1 tsutsui
191 1.1 tsutsui memcpy(bp->d_typename, lbl_buff, 16);
192 1.1 tsutsui
193 1.1 tsutsui bp->d_secsize = DEV_BSIZE;
194 1.1 tsutsui bp->d_nsectors = 38;
195 1.1 tsutsui bp->d_ntracks = 12;
196 1.1 tsutsui bp->d_ncylinders = 1076;
197 1.1 tsutsui
198 1.1 tsutsui bp->d_type = DTYPE_SCSI;
199 1.1 tsutsui
200 1.1 tsutsui bp->d_secpercyl = bp->d_nsectors * bp->d_ntracks;
201 1.1 tsutsui bp->d_secperunit = bp->d_secpercyl * bp->d_ncylinders;
202 1.1 tsutsui bp->d_rpm = 3600;
203 1.1 tsutsui bp->d_interleave = 1;
204 1.1 tsutsui bp->d_trackskew = 0;
205 1.1 tsutsui bp->d_cylskew = 0;
206 1.1 tsutsui bp->d_headswitch = 0;
207 1.1 tsutsui bp->d_trkseek = 0;
208 1.1 tsutsui bp->d_bbsize = BBSIZE;
209 1.1 tsutsui bp->d_sbsize = SBSIZE;
210 1.1 tsutsui
211 1.1 tsutsui for (i = 0; i < MAXPARTITIONS; i++) {
212 1.1 tsutsui bp->d_partitions[i].p_size = omp->dkl_map[i].dkl_nblk;
213 1.1 tsutsui bp->d_partitions[i].p_offset = omp->dkl_map[i].dkl_blkno;
214 1.1 tsutsui bp->d_partitions[i].p_fsize = 1024;
215 1.1 tsutsui bp->d_partitions[i].p_frag = 8192 / 1024;
216 1.1 tsutsui bp->d_partitions[i].p_fstype = FS_UNUSED;
217 1.1 tsutsui }
218 1.1 tsutsui
219 1.1 tsutsui bp->d_npartitions = MAXPARTITIONS;
220 1.1 tsutsui
221 1.1 tsutsui for (i = 0; i < NDDATA; i++) {
222 1.1 tsutsui bp->d_drivedata[i] = 0;
223 1.1 tsutsui }
224 1.1 tsutsui
225 1.1 tsutsui memset(bp->d_packname, 0, 16);
226 1.1 tsutsui
227 1.1 tsutsui bp->d_magic = DISKMAGIC;
228 1.1 tsutsui bp->d_magic2 = DISKMAGIC;
229 1.1 tsutsui bp->d_checksum = 0;
230 1.1 tsutsui bp->d_checksum = dkcksum(bp);
231 1.1 tsutsui
232 1.1 tsutsui /* restump checksum of OMRON disklabel */
233 1.1 tsutsui chksum = 0;
234 1.1 tsutsui count = sizeof(struct scd_dk_label) / sizeof(short int);
235 1.1 tsutsui for (p= (u_short *) lbl_buff; count > 1; count--) {
236 1.1 tsutsui chksum ^= *p++;
237 1.1 tsutsui }
238 1.1 tsutsui printf("chksum: 0x%lx\n", chksum);
239 1.1 tsutsui
240 1.1 tsutsui omp->dkl_cksum = chksum;
241 1.1 tsutsui printf("dkl_cksum: 0x%x\n", omp->dkl_cksum);
242 1.1 tsutsui } else if (!strcmp(argv[1], "bsd")) {
243 1.1 tsutsui display(bp);
244 1.1 tsutsui } else if (!strcmp(argv[1], "write")) {
245 1.1 tsutsui if (scsi_write( 0, lbl_buff, LABEL_SIZE)) {
246 1.1 tsutsui printf("Disk Label write done.\n");
247 1.1 tsutsui } else {
248 1.1 tsutsui printf("Disk Label write error !!\n");
249 1.1 tsutsui }
250 1.1 tsutsui } else if (!strcmp(argv[1], "set")) {
251 1.1 tsutsui i = (argv[2])[1] - 'a';
252 1.1 tsutsui for (q = argv[3], j = 0; *q != '\0'; q++) {
253 1.1 tsutsui j = (j * 10) + (*q - '0');
254 1.1 tsutsui }
255 1.1 tsutsui switch (*argv[2]) {
256 1.1 tsutsui case 'b':
257 1.1 tsutsui bp->d_partitions[i].p_frag = j / bp->d_partitions[i].p_fsize;
258 1.1 tsutsui break;
259 1.1 tsutsui case 'f': /* fragment size */
260 1.1 tsutsui bp->d_partitions[i].p_fsize = j;
261 1.1 tsutsui break;
262 1.1 tsutsui case 'o': /* offset */
263 1.1 tsutsui bp->d_partitions[i].p_offset = j;
264 1.1 tsutsui omp->dkl_map[i].dkl_blkno = j;
265 1.1 tsutsui break;
266 1.1 tsutsui case 'p': /* size */
267 1.1 tsutsui bp->d_partitions[i].p_size = j;
268 1.1 tsutsui omp->dkl_map[i].dkl_nblk = j;
269 1.1 tsutsui break;
270 1.1 tsutsui case 't': /* FS type */
271 1.1 tsutsui bp->d_partitions[i].p_fstype = j;
272 1.1 tsutsui break;
273 1.1 tsutsui default:
274 1.1 tsutsui break;
275 1.1 tsutsui }
276 1.1 tsutsui
277 1.1 tsutsui /* restump checksum of BSD disklabel */
278 1.1 tsutsui bp->d_checksum = 0;
279 1.1 tsutsui bp->d_checksum = dkcksum(bp);
280 1.1 tsutsui
281 1.1 tsutsui /* restump checksum of OMRON disklabel */
282 1.1 tsutsui chksum = 0;
283 1.1 tsutsui count = sizeof(struct scd_dk_label) / sizeof(short int);
284 1.1 tsutsui for (p= (u_short *) lbl_buff; count > 1; count--) {
285 1.1 tsutsui chksum ^= *p++;
286 1.1 tsutsui }
287 1.1 tsutsui omp->dkl_cksum = chksum;
288 1.1 tsutsui
289 1.1 tsutsui } else if (!strcmp(argv[1], "sb")) {
290 1.1 tsutsui #define BLOCK_SIZE SBSIZE
291 1.1 tsutsui
292 1.1 tsutsui printf("checking Super Block: block size = %d bytes, seek amount = 1 blocks\n",
293 1.1 tsutsui BLOCK_SIZE);
294 1.1 tsutsui i = j = 0;
295 1.1 tsutsui while(1) {
296 1.1 tsutsui if (!scsi_read( i, lbl_buff, BLOCK_SIZE))
297 1.1 tsutsui break;
298 1.1 tsutsui
299 1.1 tsutsui if (fp->fs_magic == FS_MAGIC) {
300 1.1 tsutsui printf("%d, (%d)\n", i, i - j);
301 1.1 tsutsui j = i;
302 1.1 tsutsui }
303 1.1 tsutsui i++;
304 1.1 tsutsui }
305 1.1 tsutsui } else if (!strcmp(argv[1], "sbcopy")) {
306 1.1 tsutsui if (!scsi_read(32, lbl_buff, BLOCK_SIZE)) {
307 1.1 tsutsui printf("sbcopy: read failed\n");
308 1.1 tsutsui return(ST_ERROR);
309 1.1 tsutsui }
310 1.1 tsutsui if (scsi_write(16, lbl_buff, BLOCK_SIZE)) {
311 1.1 tsutsui printf("sbcopy: copy done\n");
312 1.1 tsutsui } else {
313 1.1 tsutsui printf("sbcopy: write failed\n");
314 1.1 tsutsui }
315 1.1 tsutsui }
316 1.1 tsutsui
317 1.1 tsutsui return(ST_NORMAL);
318 1.1 tsutsui }
319 1.1 tsutsui
320 1.1 tsutsui void
321 1.1 tsutsui display(struct disklabel *lp)
322 1.1 tsutsui {
323 1.1 tsutsui int i, j;
324 1.1 tsutsui struct partition *pp;
325 1.1 tsutsui
326 1.1 tsutsui if ((unsigned) lp->d_type < DKMAXTYPES)
327 1.1 tsutsui printf("type: %s\n", dktypenames[lp->d_type]);
328 1.1 tsutsui else
329 1.1 tsutsui printf("type: %d\n", lp->d_type);
330 1.1 tsutsui printf("disk: %s\n", lp->d_typename);
331 1.1 tsutsui printf("label: %s\n", lp->d_packname);
332 1.1 tsutsui printf("flags:");
333 1.1 tsutsui if (lp->d_flags & D_REMOVABLE)
334 1.1 tsutsui printf(" removeable");
335 1.1 tsutsui if (lp->d_flags & D_ECC)
336 1.1 tsutsui printf(" ecc");
337 1.1 tsutsui if (lp->d_flags & D_BADSECT)
338 1.1 tsutsui printf(" badsect");
339 1.1 tsutsui printf("\n");
340 1.1 tsutsui printf("bytes/sector: %d\n", lp->d_secsize);
341 1.1 tsutsui printf("sectors/track: %d\n", lp->d_nsectors);
342 1.1 tsutsui printf("tracks/cylinder: %d\n", lp->d_ntracks);
343 1.1 tsutsui printf("sectors/cylinder: %d\n", lp->d_secpercyl);
344 1.1 tsutsui printf("cylinders: %d\n", lp->d_ncylinders);
345 1.1 tsutsui printf("rpm: %d\n", lp->d_rpm);
346 1.1 tsutsui printf("interleave: %d\n", lp->d_interleave);
347 1.1 tsutsui printf("trackskew: %d\n", lp->d_trackskew);
348 1.1 tsutsui printf("cylinderskew: %d\n", lp->d_cylskew);
349 1.1 tsutsui printf("headswitch: %d\t\t# milliseconds\n", lp->d_headswitch);
350 1.1 tsutsui printf("track-to-track seek: %d\t# milliseconds\n", lp->d_trkseek);
351 1.1 tsutsui printf("drivedata: ");
352 1.1 tsutsui for (i = NDDATA - 1; i >= 0; i--)
353 1.1 tsutsui if (lp->d_drivedata[i])
354 1.1 tsutsui break;
355 1.1 tsutsui if (i < 0)
356 1.1 tsutsui i = 0;
357 1.1 tsutsui for (j = 0; j <= i; j++)
358 1.1 tsutsui printf("%d ", lp->d_drivedata[j]);
359 1.1 tsutsui printf("\n\n%d partitions:\n", lp->d_npartitions);
360 1.1 tsutsui printf("# size offset fstype [fsize bsize cpg]\n");
361 1.1 tsutsui pp = lp->d_partitions;
362 1.1 tsutsui for (i = 0; i < lp->d_npartitions; i++, pp++) {
363 1.1 tsutsui if (pp->p_size) {
364 1.1 tsutsui printf(" %c: %d %d ", 'a' + i,
365 1.1 tsutsui pp->p_size, pp->p_offset);
366 1.1 tsutsui if ((unsigned) pp->p_fstype < FSMAXTYPES)
367 1.1 tsutsui printf("%s", fstypenames[pp->p_fstype]);
368 1.1 tsutsui else
369 1.1 tsutsui printf("%d", pp->p_fstype);
370 1.1 tsutsui switch (pp->p_fstype) {
371 1.1 tsutsui
372 1.1 tsutsui case FS_UNUSED: /* XXX */
373 1.1 tsutsui printf(" %d %d %s ",
374 1.1 tsutsui pp->p_fsize, pp->p_fsize * pp->p_frag, "");
375 1.1 tsutsui break;
376 1.1 tsutsui
377 1.1 tsutsui case FS_BSDFFS:
378 1.1 tsutsui printf(" %d %d %d ",
379 1.1 tsutsui pp->p_fsize, pp->p_fsize * pp->p_frag,
380 1.1 tsutsui pp->p_cpg);
381 1.1 tsutsui break;
382 1.1 tsutsui
383 1.1 tsutsui default:
384 1.1 tsutsui printf("%s", "");
385 1.1 tsutsui break;
386 1.1 tsutsui }
387 1.1 tsutsui printf("\t# (Cyl. %d",
388 1.1 tsutsui pp->p_offset / lp->d_secpercyl);
389 1.1 tsutsui if (pp->p_offset % lp->d_secpercyl)
390 1.1 tsutsui cnputc('*');
391 1.1 tsutsui else
392 1.1 tsutsui cnputc(' ');
393 1.1 tsutsui printf("- %d",
394 1.1 tsutsui (pp->p_offset +
395 1.1 tsutsui pp->p_size + lp->d_secpercyl - 1) /
396 1.1 tsutsui lp->d_secpercyl - 1);
397 1.1 tsutsui if (pp->p_size % lp->d_secpercyl)
398 1.1 tsutsui cnputc('*');
399 1.1 tsutsui printf(")\n");
400 1.1 tsutsui }
401 1.1 tsutsui }
402 1.1 tsutsui }
403