1 # 2 # Copyright 2005 Sun Microsystems, Inc. All rights reserved. 3 # Use is subject to license terms. 4 # 5 # CDDL HEADER START 6 # 7 # The contents of this file are subject to the terms of the 8 # Common Development and Distribution License, Version 1.0 only 9 # (the "License"). You may not use this file except in compliance 10 # with the License. 11 # 12 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 13 # or http://www.opensolaris.org/os/licensing. 14 # See the License for the specific language governing permissions 15 # and limitations under the License. 16 # 17 # When distributing Covered Code, include this CDDL HEADER in each 18 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 19 # If applicable, add the following below this CDDL HEADER, with the 20 # fields enclosed by brackets "[]" replaced with your own identifying 21 # information: Portions Copyright [yyyy] [name of copyright owner] 22 # 23 # CDDL HEADER END 24 # 25 #ident "%Z%%M% %I% %E% SMI" 26 # 27 # This awk-script is the rule-base used in previous release for creating 28 # compatibility-mode names. 29 # 30 # WARNING: these rules are no longer used by default. ucblinks 31 # is now a binary, not a script. This rule-base can still 32 # be used, however, by running ucblinks with the option 33 # "-e /usr/ucblib/ucblinks.awk". See the ucblinks(1B) man 34 # page for more information. 35 # 36 # The idea is to create the names as symbolic links to their SunOS5 37 # counterparts by preference. If no counterpart exists a direct link to the 38 # devfs "/devices" directory is made. 39 # 40 # It does this base on input of the existing devices in the system. 41 # The format of the input file is: 42 # 43 # driver-name \t minor number \t [b|c] \t /devices-name \t first-minor-component 44 # 45 # That is, 46 # 47 # $1 driver-name 48 # $2 minor number 49 # $3 b(lock) or c(haracter) device 50 # $4 devices-directory name; relative to /dev (../devices/xxx) 51 # $5 first minor component name (string between ':' and nextr ',' 52 # in last path-component of the /devices-name) 53 # 54 # and these are referred to throughout the script. 55 # 56 # The output of the script-rules are lines of the form: 57 # 58 # devname["device-link-fullname"] = "compatname"; 59 # devdir["device-link-fullname"] = "compatdir"; 60 # 61 # The device-link-fullname should be relative to the directory in which the 62 # SunOS5 link is expected to be found. 'compatdir' is that directory name, 63 # FOLLOWED BY A SLASH. 'compatname' is the compatability name that should be 64 # generated. 65 # 66 67 #--------------------------------------------------------------------------- 68 # DATABASE: Only modify below this line! 69 # 70 # 71 # 72 # The following devices need no changes, since the 4.x and 5.x names 73 # are the same: 74 # 75 # console tty mem kmem null zero drum mouse klog kbd dump tcp udp 76 # mbmem mbio 77 # 78 # nit vd eeprom openprom des pp* vp* vpc* 79 80 $3 == "b" && $1 == "fd" { 81 if ($5 == "c") 82 out(sprintf("%s%d%s", $1, $2/8, $5), "./", 83 sprintf("%s%d", $1, $2/8)); 84 else 85 out(sprintf("%s%d%s", $1, $2/8, $5), "./"); 86 } 87 $3 == "c" && $1 == "fd" { 88 if ($5 == "c") 89 out(sprintf("r%s%d%s", $1, $2/8, $5), "./", 90 sprintf("r%s%d", $1, $2/8)); 91 else 92 out(sprintf("r%s%d%s", $1, $2/8, $5), "./"); 93 } 94 95 96 # 97 # Standard disks (all bar IPI) 98 # 99 # Note special 'cddev' array test to make sure device is not a CD device 100 # in the case of a SCSI disk 101 # 102 $3 == "b" && (($1 == "sd" && !cddev[$4]) || $1 == "xd" || $1 == "xy") { 103 if ($2 < 8) 104 out(sprintf("%s%d%s", $1, 3, $5), "dsk/"); 105 else if ($2 >= 24 && $2 < 32) 106 out(sprintf("%s%d%s", $1, 0, $5), "dsk/"); 107 else 108 out(sprintf("%s%d%s", $1, $2/8, $5), "dsk/"); 109 } 110 $3 == "c" && (($1 == "sd" && !cddev[$4]) || $1 == "xd" || $1 == "xy") { 111 if ($2 < 8) 112 out(sprintf("r%s%d%s", $1, 3, $5), "rdsk/"); 113 else if ($2 >= 24 && $2 < 32) 114 out(sprintf("r%s%d%s", $1, 0, $5), "rdsk/"); 115 else 116 out(sprintf("r%s%d%s", $1, $2/8, $5), "rdsk/"); 117 } 118 # 119 # SCSI CD drive 120 # 121 $1 == "sd" && cddev[$4] && $5 == "c" { 122 if (cdnum[$2] "" == "") cdnum[$2] = cdno++; 123 if ($3 == "c") pfx = "r"; else pfx = ""; 124 out(pfx "sr" cdnum[$2], pfx "dsk/"); 125 } 126 # 127 # Next assumes IPI unit number entirely within minor 128 # (that is, 5.0 numbering rather than 4.1 numbering) 129 # 130 $3 == "b" && $1 == "id" { 131 out(sprintf("id%x%s", $2, $5), "dsk/"); 132 } 133 $3 == "c" && $1 == "id" { 134 out(sprintf("rid%x%s", $2, $5), "rdsk/"); 135 } 136 # 137 # Tape drives 138 # 139 # SCSI and XT Tape Drives 140 # 141 ($1 == "st" || $1 == "xt") && NF == 5 && $5 !~ /^[bn]/ { 142 if (($2 % 128) < 64) break; # Not BSD-flavour 143 drive = ($2%4) + ((int($2/128)%32) * 4); 144 den = int($2/8) % 4; 145 if ($1 == "xt") $1 == "mt"; # xt drives appear as mt devices 146 if ($5 ~ /n$/) pfx = "nr"; else pfx = "r"; 147 link = pfx $1 ((den * 8) + drive); 148 if (tapelink[link] "" == "") { 149 out(link, "rmt/"); 150 tapelink[link] = 1; 151 } 152 } 153 # 154 # Obsolete drive entries 155 # 156 $1 == "mt" { 157 if (($2 % 8) >= 4) { 158 link = "rmt" $2; 159 if (tapelink[link] "" == "") { 160 out(link, "rmt/", "nrmt" ($2 - 4)); 161 tapelink[link] = 1; 162 } 163 } 164 else { 165 link = "rmt" $2; 166 if (tapelink[link] "" == "") { 167 out(link, "rmt/"); 168 tapelink[link] = 1; 169 } 170 } 171 } 172 173 # 174 # Wierd Archive tape stuff 175 # 176 $1 == "ar" && NF == 5 && $5 !~ /n$/ { 177 link = "rar" ($2/4); 178 if (tapelink[link] "" == "") { 179 out(link, "rmt/"); 180 tapelink[link] = 1; 181 } 182 } 183 $1 == "ar" && NF == 5 && $5 ~ /n$/ { 184 link = "nrar" (($2-16)/4); 185 if (tapelink[link] "" == "") { 186 out(link, "rmt/"); 187 tapelink[link] = 1; 188 } 189 } 190 # 191 # Screen-buffers are easy 192 # 193 $1 == "bwtwo" || $1 == "cgthree" || $1 == "cgsix" || $1 == "cgfour" || $1 == "cgfourteen" || $1 == "cgeight" || $1 == "cgnine" || $1 == "cgtwelve" { 194 out("" $5, "fbs/"); 195 } 196 # 197 # This catches the on-board ports, the 1st and second SCSI-board uarts, 198 # as well as the newer fast-serial "se" ports. 199 # Depends on the driver creating the right names. 200 # 201 ($1 == "zs" || $1 == "se" || $1 == "su") && $4 !~ /,cu$/ && ttbeenhere != 1 { 202 ttbeenhere = 1; 203 system("x=`ls term`; for i in $x ; do rm -f tty$i; ln -s term/$i tty$i ; done"); 204 } 205 # 206 # XXX Bus device support yet to go in, so the following are TBD: 207 # 208 # sbus vme16d16 vme24d16 vme32d16 vme32d32 209 # 210 # 211 # XXX Other device support to be added as drivers are added: 212 # 213 # mcp oct mti 214 # 215