6 # The contents of this file are subject to the terms of the
7 # Common Development and Distribution License (the "License").
8 # You may not use this file except in compliance with the License.
10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 # or http://www.opensolaris.org/os/licensing.
12 # See the License for the specific language governing permissions
13 # and limitations under the License.
15 # When distributing Covered Code, include this CDDL HEADER in each
16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 # If applicable, add the following below this CDDL HEADER, with the
18 # fields enclosed by brackets "[]" replaced with your own identifying
19 # information: Portions Copyright [yyyy] [name of copyright owner]
23 # Copyright (c) 1993, 2010, Oracle and/or its affiliates. All rights reserved.
26 .
/lib
/svc
/share
/smf_include.sh
28 DEVALLOC
=/etc
/security
/device_allocate
29 DEVMAPS
=/etc
/security
/device_maps
30 DEVFSADM
=/usr
/sbin
/devfsadm
31 MKDEVALLOC
=/usr
/sbin
/mkdevalloc
32 MKDEVMAPS
=/usr
/sbin
/mkdevmaps
33 HALFDI
=/etc
/hal
/fdi
/policy
/30user
/90-solaris-device-allocation.fdi
35 # dev_allocation_convert
36 # All the real work gets done in this function
38 dev_allocation_convert
()
41 # If allocation already configured, just return
43 if [ -f ${HALFDI} -a -f ${DEVALLOC} -a -f ${DEVMAPS} ]; then
47 # Prevent automount of removable and hotpluggable volume
48 # by forcing volume.ignore HAL property on all such volumes.
49 if [ ! -f ${HALFDI} ]; then
51 <?xml version="1.0" encoding="UTF-8"?>
52 <deviceinfo version="0.2">
54 <match key="info.capabilities" contains="volume">
55 <match key="@block.storage_device:storage.removable" bool="true">
56 <merge key="volume.ignore" type="bool">true</merge>
58 <match key="@block.storage_device:storage.hotpluggable" bool="true">
59 <merge key="volume.ignore" type="bool">true</merge>
67 # Initialize device allocation
69 if [ ! -f ${DEVALLOC} ]; then
70 echo "DEVICE_ALLOCATION=ON" > $DEVALLOC
71 ${MKDEVALLOC} >> $DEVALLOC
73 if [ ! -f ${DEVMAPS} ]; then
74 ${MKDEVMAPS} > $DEVMAPS
78 dev_allocation_unconvert
()
80 # Turn off device allocation.
82 /usr
/bin
/rm -f $DEVALLOC $DEVMAPS
83 # Restore default policy for removable and hotpluggable volumes
84 /usr
/bin
/rm -f $HALFDI
89 dev_allocation_convert
93 state
=`/usr/bin/svcprop -c -p general/enabled $SMF_FMRI 2>/dev/null`
94 if [ "$state" = "true" ] ; then
97 dev_allocation_unconvert