Home | History | Annotate | Download | only in common_files
      1 #!/bin/sh
      2 #
      3 # CDDL HEADER START
      4 #
      5 # The contents of this file are subject to the terms of the
      6 # Common Development and Distribution License (the "License").
      7 # You may not use this file except in compliance with the License.
      8 #
      9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     10 # or http://www.opensolaris.org/os/licensing.
     11 # See the License for the specific language governing permissions
     12 # and limitations under the License.
     13 #
     14 # When distributing Covered Code, include this CDDL HEADER in each
     15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     16 # If applicable, add the following below this CDDL HEADER, with the
     17 # fields enclosed by brackets "[]" replaced with your own identifying
     18 # information: Portions Copyright [yyyy] [name of copyright owner]
     19 #
     20 # CDDL HEADER END
     21 #
     22 
     23 #
     24 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
     25 # Use is subject to license terms.
     26 #
     27 #ident	"%Z%%M%	%I%	%E% SMI"
     28 #
     29 
     30 PATH="/usr/bin:/usr/sbin:${PATH}"
     31 export PATH
     32 
     33 add_mpt_entry() {
     34 cat >> $dest << EOF
     35 
     36 #
     37 # Enable Target 7 for the mpt SCSI/SAS/SATA driver.  Target 7 has
     38 # traditionally been reserved for legacy SCSI HBAs, but SAS controllers
     39 # supported by the mpt driver do not use target 7 for that purpose.
     40 # Enabling Target 7 allows the use of 8 disks on those controllers.
     41 #
     42 name="sd" parent="mpt"
     43 	target=7 lun=0;
     44 EOF
     45 }
     46 
     47 add_self_identifying_entry() {
     48 cat >> $dest <<EOF
     49 
     50 #
     51 # The following stub node is needed for pathological bottom-up
     52 # devid resolution on a self-identifying transport. 
     53 #
     54 name="sd" class="scsi-self-identifying";
     55 EOF
     56 }
     57 
     58 while read src dest; do
     59 	if [ ! -f $dest ]; then
     60 		cp $src $dest
     61 	else
     62 		line1="name=\"sd\" parent=\"mpt\""
     63 		line2="target=7 lun=0;"
     64 		echo `cat $dest` | grep "$line1[# ]*$line2" >/dev/null
     65 
     66 		if [ $? -ne 0 ]; then
     67 			add_mpt_entry
     68 		fi
     69 		echo `cat $dest` | grep "scsi-self-identifying" > /dev/null
     70 
     71 		if [ $? -ne 0 ]; then
     72 			add_self_identifying_entry
     73 		fi	
     74 	fi
     75 done
     76 
     77 exit 0
     78