1if [ ! "$_MEDIA_DIRECTORY_SUBR" ]; then _MEDIA_DIRECTORY_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/directory.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/directory.subr 34f_include $BSDCFG_SHARE/device.subr 35f_include $BSDCFG_SHARE/dialog.subr --- 49 unchanged lines hidden (view full) --- 85# 86# Initializes the Directory media device. Returns success if the directory path 87# both exists and is a directory. 88# 89f_media_init_directory() 90{ 91 local dev="$1" path 92 |
93 $dev get private path || return $FAILURE |
94 f_dprintf "Init routine called for Directory device. path=[%s]" \ 95 "$path" 96 97 # Track whether we've been through here before (for remote filesystems 98 # mounted in the directory path, not repeating these queries saves us 99 # valuable time for slow/uncooperative links). 100 if [ "$DIRECTORY_CHECKED" ]; then 101 f_dprintf "Directory device already checked." --- 18 unchanged lines hidden (view full) --- 120# Returns data from $file in the existing/current filesystem. Similar to 121# cat(1). If $probe_type is present and non-NULL, returns success if $file 122# exists. If $probe_type is equal to $PROBE_SIZE, prints the size of $file in 123# bytes to standard-out. 124# 125f_media_get_directory() 126{ 127 local dev="$1" file="$2" probe_type="$3" path |
128 local name |
129 |
130 $dev get name name |
131 f_dprintf "f_media_get_directory: dev=[%s] file=[%s] probe_type=%s" \ |
132 "$name" "$file" "$probe_type" |
133 |
134 $dev get private path |
135 f_media_generic_get "$path" "$file" "$probe_type" 136} 137 138# f_media_shutdown_directory $device 139# 140# Shuts down the Directory device. Return status should be ignored. 141# 142f_media_shutdown_directory() 143{ 144 DIRECTORY_CHECKED= 145} 146 147############################################################ MAIN 148 149f_dprintf "%s: Successfully loaded." media/directory.subr 150 151fi # ! $_MEDIA_DIRECTORY_SUBR |