8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / rcm_daemon / common / SUNW,rdsv3u.sh
blobc54565f860bf00d574b3a25abb22e5630b6487b3
1 #!/sbin/sh
3 # CDDL HEADER START
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.
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.
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]
20 # CDDL HEADER END
24 # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
28 # RCM script to inform if RDSv3 is currently used
30 rcm_script_version=1
31 rcm_script_func_info="RDSv3 (un)configuration rcm script"
32 rcm_cmd_timeout=10
33 rcm_resource_name=/devices/ib/rdsv3@0:rdsv3
35 do_scriptinfo()
37 printf "rcm_script_version=%d\n" $rcm_script_version;
38 printf "rcm_script_func_info=$rcm_script_func_info\n";
39 printf "rcm_cmd_timeout=%d\n" $rcm_cmd_timeout;
40 exit 0;
43 do_register()
45 printf "rcm_resource_name=%s\n" $rcm_resource_name;
46 exit 0;
49 do_resourceinfo()
51 if [ x"$1" = x"/devices/ib/rdsv3@0:rdsv3" ]
52 then
53 printf "rcm_resource_usage_info=RDSv3 IB device 0\n";
54 exit 0;
55 else
56 printf "rcm_failure_reason=Unknown RDSv3 device\n";
57 exit 3;
61 do_queryremove()
63 output=`/usr/sbin/fuser $rcm_resource_name 2>&1`
64 ret=$?
66 sockrds=`echo "$output" | grep 'sockrds'`
68 if [ $ret -eq 0 ] && [ ! -z "$sockrds" ]
69 then
70 printf "rcm_log_warn=RDSv3 is being used currently. "
71 printf "Please stop processes currently running on it "
72 printf "before un-configuring IB HCA/RDSv3.\n";
73 printf "rcm_failure_reason=RDSv3 is being used on this system\n";
74 exit 3;
75 elif [ $ret -ne 0 ]
76 then
77 printf "rcm_log_warn='fuser $rcm_resource_name' command failed."
78 printf "rcm_failure_reason='fuser $rcm_resource_name' command "
79 printf "failed.\n";
80 exit 1;
82 exit 0;
85 do_preremove()
87 exit 0;
90 do_undoremove()
92 exit 0;
95 do_postremove()
97 exit 0;
100 case "$1" in
101 scriptinfo) do_scriptinfo;;
102 register) do_register;;
103 resourceinfo) do_resourceinfo $2;;
104 queryremove) do_queryremove $2;;
105 preremove) do_preremove $2;;
106 undoremove) do_undoremove $2;;
107 postremove) do_postremove $2;;
108 *) echo Unknown option $1;;
109 esac