FreeBSD/Linux Kernel Cross Reference
sys/sqt/setconf.c
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991 Carnegie Mellon University
4 * Copyright (c) 1991 Sequent Computer Systems
5 * All Rights Reserved.
6 *
7 * Permission to use, copy, modify and distribute this software and its
8 * documentation is hereby granted, provided that both the copyright
9 * notice and this permission notice appear in all copies of the
10 * software, derivative works or modified versions, and any portions
11 * thereof, and that both notices appear in supporting documentation.
12 *
13 * CARNEGIE MELLON AND SEQUENT COMPUTER SYSTEMS ALLOW FREE USE OF
14 * THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON AND
15 * SEQUENT COMPUTER SYSTEMS DISCLAIM ANY LIABILITY OF ANY KIND FOR
16 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17 *
18 * Carnegie Mellon requests users of this software to return to
19 *
20 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
21 * School of Computer Science
22 * Carnegie Mellon University
23 * Pittsburgh PA 15213-3890
24 *
25 * any improvements or extensions that they make and grant Carnegie Mellon
26 * the rights to redistribute these changes.
27 */
28
29 /*
30 * HISTORY
31 * $Log: setconf.c,v $
32 * Revision 2.4 93/05/18 11:42:50 rvb
33 * Lint
34 *
35 * Revision 2.3 91/07/31 18:03:39 dbg
36 * Changed copyright.
37 * Moved root_name string out of text segment.
38 * [91/07/31 dbg]
39 *
40 * Revision 2.2 91/05/08 12:58:47 dbg
41 * Adapted for pure Mach kernel.
42 * [90/10/09 dbg]
43 *
44 */
45
46 /*
47 * $Header: setconf.c,v 2.4 93/05/18 11:42:50 rvb Exp $
48 */
49
50 /*
51 * Revision 1.1 89/11/14 18:35:23 root
52 * Initial revision
53 *
54 * Revision 1.2 89/08/16 15:17:31 root
55 * balance -> sqt
56 *
57 * Revision 1.1 89/07/05 13:17:37 kak
58 * Initial revision
59 *
60 * Revision 2.2 88/03/20 17:32:11 bak
61 * removed xp entry from genericconf structure. xp not supported in symmetry.
62 *
63 */
64 #include <mach/boolean.h>
65
66 #include <sqt/cfg.h>
67 #include <sqt/vm_defs.h>
68
69 char root_name_string[16] = "\0\0\0\0\0\0\0"; /* at least ddNNp */
70 char *root_name = root_name_string;
71
72 #define MINARGLEN 5
73
74 /*
75 * The generic rootdev is passed into the kernel as the
76 * 1st argument in the boot name. The argument specifies the device and
77 * unit number to use for the rootdev. The actual partitions to be used for
78 * a given device is specified in ../conf/conf_generic.c.
79 * The argument string is in the form:
80 * XXds (eg. sd0a)
81 *
82 * where XX is the device type (e.g. sd for scsi disk),
83 * d is the Dynix device unit number,
84 * s is the Dynix device slice (a-g)
85 */
86
87 setconf()
88 {
89 register struct genericconf *gc;
90 register char *boot_name;
91 register char *name;
92
93 /*
94 * Find Generic rootdev string.
95 *
96 * Skip past bootname, then till argument string.
97 * If argument string missing, use boot device name.
98 */
99
100 boot_name = PHYSTOKV(va_CD_LOC->c_boot_name, char *);
101
102 for (name = boot_name; *name != '\0'; name++)
103 continue;
104 while ((*name == '\0') && (name < &boot_name[BNAMESIZE]))
105 name++;
106 if (name > &boot_name[BNAMESIZE-MINARGLEN]) {
107 boot_name[BNAMESIZE-1] = '\0';
108
109 /*
110 * Use boot name prefix.
111 * zd(0,0) becomes zd0a.
112 */
113 name = boot_name;
114 root_name[0] = name[0];
115 root_name[1] = name[1];
116 if (name[2] != '(')
117 goto error;
118 root_name[2] = name[3];
119 if (name[4] != ',')
120 goto error;
121 root_name[3] = name[5] - '' + 'a';
122 }
123 else {
124 strncpy(root_name, name, 5);
125 }
126 root_name[4] = '\0';
127
128 printf("Root on %s.\n", root_name);
129 return;
130
131 error:
132 printf("Generic root device ");
133 if (*name == '')
134 printf("not specified.\n");
135 else
136 printf("\"%s\" is incorrect.\n", name);
137
138 printf("Returning to firmware\n");
139 return_fw(FALSE);
140 }
141
Cache object: 09f48eb7d0bc0fc022c00097b053575f
|