ufs.subr (259054) | ufs.subr (264840) |
---|---|
1if [ ! "$_MEDIA_UFS_SUBR" ]; then _MEDIA_UFS_SUBR=1 2# 3# Copyright (c) 2012-2013 Devin Teske 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: --- 10 unchanged lines hidden (view full) --- 19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25# SUCH DAMAGE. 26# | 1if [ ! "$_MEDIA_UFS_SUBR" ]; then _MEDIA_UFS_SUBR=1 2# 3# Copyright (c) 2012-2013 Devin Teske 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: --- 10 unchanged lines hidden (view full) --- 19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25# SUCH DAMAGE. 26# |
27# $FreeBSD: head/usr.sbin/bsdconfig/share/media/ufs.subr 259054 2013-12-07 00:31:01Z dteske $ | 27# $FreeBSD: head/usr.sbin/bsdconfig/share/media/ufs.subr 264840 2014-04-23 22:04:04Z dteske $ |
28# 29############################################################ INCLUDES 30 31BSDCFG_SHARE="/usr/share/bsdconfig" 32. $BSDCFG_SHARE/common.subr || exit 1 33f_dprintf "%s: loading includes..." media/ufs.subr 34f_include $BSDCFG_SHARE/device.subr 35f_include $BSDCFG_SHARE/dialog.subr --- 48 unchanged lines hidden (view full) --- 84 device_ufs set devname "$ufs" 85 device_ufs set get f_media_get_ufs 86 device_ufs set init f_media_init_ufs 87 device_ufs set shutdown f_media_shutdown_ufs 88 device_ufs unset private 89 90 f_struct_copy device_ufs device_media 91 f_struct_free device_ufs | 28# 29############################################################ INCLUDES 30 31BSDCFG_SHARE="/usr/share/bsdconfig" 32. $BSDCFG_SHARE/common.subr || exit 1 33f_dprintf "%s: loading includes..." media/ufs.subr 34f_include $BSDCFG_SHARE/device.subr 35f_include $BSDCFG_SHARE/dialog.subr --- 48 unchanged lines hidden (view full) --- 84 device_ufs set devname "$ufs" 85 device_ufs set get f_media_get_ufs 86 device_ufs set init f_media_init_ufs 87 device_ufs set shutdown f_media_shutdown_ufs 88 device_ufs unset private 89 90 f_struct_copy device_ufs device_media 91 f_struct_free device_ufs |
92 elif [ $ndevs -gt 1 ]; then | 92 elif [ $ndevs -eq 1 ]; then 93 f_struct_copy $devs device_media 94 else 95 local dev |
93 local title="$msg_choose_a_ufs_partition" 94 local prompt="$msg_please_select_ufs_partition" 95 local hline="" 96 | 96 local title="$msg_choose_a_ufs_partition" 97 local prompt="$msg_please_select_ufs_partition" 98 local hline="" 99 |
97 local dev retval | |
98 dev=$( f_device_menu \ 99 "$title" "$prompt" "$hline" $DEVICE_TYPE_UFS \ | 100 dev=$( f_device_menu \ 101 "$title" "$prompt" "$hline" $DEVICE_TYPE_UFS \ |
100 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) 101 retval=$? 102 [ "$dev" ] || return $FAILURE | 102 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) || 103 return $FAILURE |
103 | 104 |
104 f_struct_copy device_$dev device_media 105 [ $retval -eq $SUCCESS ] || return $FAILURE 106 else 107 f_struct_copy device_$devs device_media | 105 f_struct_copy "$dev" device_media |
108 fi 109 110 f_struct device_media || return $FAILURE 111} 112 113# f_media_init_ufs $device 114# 115# Initializes the UFS media device. Returns success if able to mount the UFS 116# partition device using mount(1). 117# 118f_media_init_ufs() 119{ 120 local funcname=f_media_init_ufs 121 local dev="$1" devname err 122 | 106 fi 107 108 f_struct device_media || return $FAILURE 109} 110 111# f_media_init_ufs $device 112# 113# Initializes the UFS media device. Returns success if able to mount the UFS 114# partition device using mount(1). 115# 116f_media_init_ufs() 117{ 118 local funcname=f_media_init_ufs 119 local dev="$1" devname err 120 |
123 device_$dev get devname devname || return $FAILURE | 121 $dev get devname devname || return $FAILURE |
124 f_dprintf "Init routine called for UFS device. devname=[%s]" \ 125 "$devname" 126 127 if [ "$UFS_MOUNTED" ]; then 128 f_dprintf "UFS device already mounted." 129 return $SUCCESS 130 fi 131 --- 25 unchanged lines hidden (view full) --- 157# Returns data from $file on a mounted UFS partition device. Similar to cat(1). 158# If $probe_type is present and non-NULL, returns success if $file exists. If 159# $probe_type is equal to $PROBE_SIZE, prints the size of $file in bytes to 160# standard-out. 161# 162f_media_get_ufs() 163{ 164 local dev="$1" file="$2" probe_type="$3" | 122 f_dprintf "Init routine called for UFS device. devname=[%s]" \ 123 "$devname" 124 125 if [ "$UFS_MOUNTED" ]; then 126 f_dprintf "UFS device already mounted." 127 return $SUCCESS 128 fi 129 --- 25 unchanged lines hidden (view full) --- 155# Returns data from $file on a mounted UFS partition device. Similar to cat(1). 156# If $probe_type is present and non-NULL, returns success if $file exists. If 157# $probe_type is equal to $PROBE_SIZE, prints the size of $file in bytes to 158# standard-out. 159# 160f_media_get_ufs() 161{ 162 local dev="$1" file="$2" probe_type="$3" |
163 local name |
|
165 | 164 |
165 $dev get name name |
|
166 f_dprintf "f_media_get_ufs: dev=[%s] file=[%s] probe_type=%s" \ | 166 f_dprintf "f_media_get_ufs: dev=[%s] file=[%s] probe_type=%s" \ |
167 "$dev" "$file" "$probe_type" | 167 "$name" "$file" "$probe_type" |
168 169 f_media_generic_get "$MOUNTPOINT" "$file" "$probe_type" 170} 171 172# f_media_shutdown_ufs $device 173# 174# Shuts down the UFS device using umount(8). Return status should be ignored. 175# --- 23 unchanged lines hidden --- | 168 169 f_media_generic_get "$MOUNTPOINT" "$file" "$probe_type" 170} 171 172# f_media_shutdown_ufs $device 173# 174# Shuts down the UFS device using umount(8). Return status should be ignored. 175# --- 23 unchanged lines hidden --- |