FreeBSD/Linux Kernel Cross Reference
sys/scsi/pc_label.c
1 /*
2 * Mach Operating System
3 * Copyright (c) 1993 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: pc_label.c,v $
29 * Revision 2.2 93/08/10 16:00:13 mrt
30 * Created by Robert Baron.
31 *
32 *
33 */
34
35 #include <sys/types.h>
36 #include <mach/std_types.h>
37 #include <scsi/rz_labels.h>
38
39 #include <i386at/disk.h>
40 #include <i386at/hdreg.h>
41 #include <device/device_types.h>
42 #include <device/disk_status.h>
43
44 int label_flag = 0;
45 int allow_bsd_label = 1;
46 int OS;
47
48 print_dos_partition(i, part)
49 int i;
50 struct bios_partition_info *part;
51 {
52 printf("%d: id %d(%x), start %d, size %d, Activ = %x\n",
53 i, part->systid, part->systid,
54 part->offset, part->n_sectors,
55 part->bootid);
56 printf(" start C%d:H%d:S%d, end C%d:H%d:S%d\n",
57 part->begcyl, part->beghead, part->begsect,
58 part->endcyl, part->endhead, part->endsect);
59 }
60
61 print_local_label(evp, str)
62 struct evtoc *evp;
63 char *str;
64 {
65 int i, j;
66
67 printf("%s sectors %d, tracks %d, cylinders %d\n",
68 str, i = evp->sectors, evp->tracks, j = evp->cyls);
69 i *= evp->tracks;
70 j *= i;
71 printf("%s secpercyl %d, secperunit %d, npartitions %d\n",
72 str, i, j, evp->nparts);
73
74 for (i = 0; i < evp->nparts; i++) {
75 printf("%s %c: size = %d, offset = %d\n",
76 str, 'a'+i,
77 evp->part[i].p_size,
78 evp->part[i].p_start);
79 }
80 }
81
82 fudge_bsd_label(label, type, cyls, tracks, sectors, n)
83 struct disklabel *label;
84 int type, cyls, tracks, sectors, n;
85 {
86 int secunit;
87
88 label->d_ncylinders = cyls;
89 label->d_ntracks = tracks;
90 label->d_nsectors = sectors;
91
92 secunit = label->d_ntracks * label->d_nsectors;
93 label->d_secpercyl = secunit;
94 secunit *= label->d_ncylinders;
95 label->d_secperunit = secunit;
96
97 label->d_partitions[MAXPARTITIONS].p_offset = 0;
98 label->d_partitions[MAXPARTITIONS].p_size = secunit;
99
100 /* ??
101 */
102 label->d_secsize = SECSIZE;
103 label->d_type = type;
104 label->d_subtype = 0xa;
105 label->d_rpm = 3600;
106 label->d_interleave = 1;
107 label->d_bbsize = 0x2000; /* 8k max boot */
108 label->d_sbsize = 0x2000; /* 8k max SuperBlock */
109
110 label->d_npartitions = n; /* up to 'c' */
111
112 label->d_checksum = 0;
113 }
Cache object: b0b6c22fb464c9f567cb618f59f4eb59
|