i.nametomajor revision 7c478bd95313f5f23a4c958a745db2134aa03244
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
#
# add_major - adds new major numbers to system for device drivers on older
# Solaris systems where add_drv -b was not available or had bugs. This
# code will be removed when doing a server_upgrade on systems with missing
# or broken add_drv is eventually EOL'd. DO NOT COPY THIS CODE TO OTHER
# PACKAGE SCRIPTS!
#
{
if [ -f $BASEDIR/etc/rem_name_to_major ]; then
fi
BEGIN {oldmajor = -1}
NR == 1 {n=split(namelist,x)
if (n < 1)
exit(1)
for (i=1; i<=n; i++)
chklist[x[i]]++
}
{for (name in chklist)
{
if ($1 == name)
delete chklist[name]
}
if (($2 - oldmajor) > 1)
{
gap++
gaplist[gap] = oldmajor " " $2;
}
oldmajor = $2;
}
END {addsize=1
for (name in chklist)
addlist[addsize++] = name
addidx = 1
for (i=1; i<=gap && addidx < addsize; i++)
{
split(gaplist[i],x)
begmajor = x[1]
endmajor = x[2]
for (begmajor++;begmajor < endmajor && addidx < addsize;)
{
printf "%s %d\n",addlist[addidx],begmajor
addidx++
begmajor++
}
}
for (; addidx < addsize; addidx++)
{
oldmajor++
printf "%s %d\n",addlist[addidx],oldmajor
}
}
if [ -s $tmpfile ]; then
echo "Adding the following devices to $dest :"
fi
}
#
# obsolete_sparc - Filter function to remove obsolete SPARC driver entries.
# We define an associative array of bad driver names, and then nawk out
# lines where the first token is defined in our array.
#
{
nawk 'BEGIN {
obs["rip"] = 1;
obs["svloop"] = 1;
obs["tcl"] = 1;
obs["tco"] = 1;
obs["tcoo"] = 1;
obs["sp"] = 1;
obs["consfb"] = 1;
obs["XXunusedXX"] = 1;
obs["sw"] = 1;
obs["cgtwo"] = 1;
obs["xy"] = 1;
obs["xd"] = 1;
obs["pc"] = 1;
obs["app"] = 1;
obs["evq"] = 1;
obs["win"] = 1;
obs["svarp"] = 1;
obs["svip"] = 1;
obs["svrip"] = 1;
obs["svicmp"] = 1;
obs["svudp"] = 1;
obs["svtcp"] = 1;
obs["vme"] = 1;
obs["ie"] = 1;
obs["qe"] = 1;
obs["qec"] = 1;
obs["ncr"] = 1;
obs["xt"] = 1;
obs["id"] = 1;
obs["vmemem"] = 1;
obs["pn"] = 1;
obs["kmac"] = 1;
obs["ipi3sc"] = 1;
obs["cgfour"] = 1;
obs["cgeight-p4"] = 1;
obs["xdc"] = 1;
obs["xyc"] = 1;
obs["mcp"] = 1;
obs["mcpzsa"] = 1;
obs["mcpp"] = 1;
obs["be"] = 1;
obs["p9000"] = 1;
obs["p9100"] = 1;
obs["pci"] = 1;
obs["profile"] = 1;
obs["eeprom"] = 1;
obs["PFUaga"] = 1;
obs["atapicd"] = 1;
obs["cgeight"] = 1;
obs["cgfourteen"] = 1;
obs["xbox"] = 1;
obs["sx"] = 1;
obs["sx_cmem"] = 1;
obs["stc"] = 1;
obs["bbc"] = 1;
obs["gptwo"] = 1;
obs["bwtwo"] = 1;
obs["cgthree"] = 1;
obs["obio"] = 1;
obs["cpu"] = 1;
obs["bootbus"] = 1;
obs["sbi"] = 1;
obs["mic"] = 1;
obs["pln"] = 1;
obs["soc"] = 1;
obs["sc_nct"] = 1;
obs["tomtppm"] = 1;
} !($1 in obs) { print $1, $2 }'
}
#
# obsolete_i386 - Filter function to remove obsolete i386 driver entries.
# We define an associative array of bad driver names, and then nawk out
# lines where the first token is defined in our array.
#
{
nawk 'BEGIN {
obs["aha"] = 1;
obs["aic"] = 1;
obs["app"] = 1;
obs["audiocs"] = 1;
obs["blogic"] = 1;
obs["chanmux"] = 1;
obs["cmtp"] = 1;
obs["corvette"] = 1;
obs["cpqncr"] = 1;
obs["csa"] = 1;
obs["dpt"] = 1;
obs["dsa"] = 1;
obs["eepro"] = 1;
obs["eha"] = 1;
obs["el"] = 1;
obs["elink"] = 1;
obs["elx"] = 1;
obs["envm"] = 1;
obs["esa"] = 1;
obs["esa"] = 1;
obs["iee"] = 1;
obs["ieef"] = 1;
obs["iss"] = 1;
obs["kd"] = 1;
obs["kdmouse"] = 1;
obs["lp"] = 1;
obs["mc"] = 1;
obs["mcis"] = 1;
obs["mega"] = 1;
obs["mlx"] = 1;
obs["nee"] = 1;
obs["nei"] = 1;
obs["nfe"] = 1;
obs["p9000"] = 1;
obs["p9100"] = 1;
obs["pcaic"] = 1;
obs["profile"] = 1;
obs["riles"] = 1;
obs["rip"] = 1;
obs["smartii"] = 1;
obs["smc"] = 1;
obs["smce"] = 1;
obs["smceu"] = 1;
obs["smcf"] = 1;
obs["sp"] = 1;
obs["svarp"] = 1;
obs["svicmp"] = 1;
obs["svip"] = 1;
obs["svloop"] = 1;
obs["svrip"] = 1;
obs["svtcp"] = 1;
obs["svudp"] = 1;
obs["tcl"] = 1;
obs["tco"] = 1;
obs["tcoo"] = 1;
obs["tiqmouse"] = 1;
obs["tr"] = 1;
obs["trantor"] = 1;
} !($1 in obs) { print $1, $2 }'
}
#
# Useful debugging which is reasonable to include in a production system:
# we copy the salient driver files to the package undo directory before
# doing any work. This will help diagnose add_drv errors before the system
# becomes an unbootable smoldering ruin.
#
done
#
# Add_drv needs /etc/driver_aliases in order to work properly; if for
# some reason it has been removed, create an empty one at this time.
# Recall that in SUNWcsr's pkginfo.tmpl, the driver_aliases class-action
# script is invoked *after* this class-action script. This is critical
# because if we are going to add_drv a new driver 'foo', and 'foo' has
# an alias 'bar', the add_drv of 'foo' will fail if the alias is already
# present. Thus new aliases must be added *after* new driver major entries.
# The driver_aliases class-action script will add the complete set of aliases
# if we create an empty file here, so this code allows us to continue and
# get a correct upgrade in the face of a missing driver_aliases file.
#
fi
if [ -f $dest ]; then
#
# Strip obsolete entries from the existing name_to_major
#
else
fi
# PKG_CLIENT_VERSION is provided by PSARC 2001/472 for allowing
# package developers to inspect a client's OS VERSION from
# within a package procedure script. It returns following
# possible OS VERSION #'s(up to S10): 2.3, 2.4, 2.5, 2.5.1, 2.6
# 2.7, 8, 9, 10...
if [ "$PKG_CLIENT_VERSION" ]; then
# remove the leading "2.", if any
else
# fall back to use "uname" and remove the leading "5."
fi
#
# If the driver is already present in name_to_major,
# leave the existing number and continue
#
#
# Otherwise add the driver to name_to_major using
# add_major or add_drv:
#
*)
#
# add_drv produces spurious output even on
# success, so save its output in a temporary
# file in case an error occurs.
#
else
"$dest:" >& 2
fi
;;
esac
done < $src
else
#
# If no name_to_major is present on the target system,
# just copy over the one from the package.
#
fi
done
exit 0