diff options
author | dteske <dteske@FreeBSD.org> | 2014-04-23 22:04:04 +0000 |
---|---|---|
committer | dteske <dteske@FreeBSD.org> | 2014-04-23 22:04:04 +0000 |
commit | 70eef882b375ccbab79ba026423e85d58e9beefa (patch) | |
tree | 9ad2385061c262108b35673a6f484e11aacdd324 /usr.sbin/bsdconfig/share/media/dos.subr | |
parent | 17495be0b718b94d234d4b4ab299a63ba15f0adf (diff) | |
download | FreeBSD-src-70eef882b375ccbab79ba026423e85d58e9beefa.zip FreeBSD-src-70eef882b375ccbab79ba026423e85d58e9beefa.tar.gz |
Implement GEOM based media device classification. You'll notice a few
different things from this commit:
+ More devices. Devices that were previously ignored are now present.
+ Faster device scanning. "There is no try, only Do" -- f_device_try()
is no longer the basis of device scanning as GEOM provides [nearly]
all devices (doesn't provide network devices).
+ More information available as non-root. Usually you have to be root
to do things like taste filesystems, and that limits the amount of
information available to non-root users; with GEOM, we see all even
running unprivileged as the brunt of information (except for so-
called ``dangerously dedicated'' file systems) is represented by the
`kern.geom.confxml' sysctl(8) MIB.
NB: Only really useful for external scripts that use the API and run as
non-root; where this code is used in bsdconfig(8) and bsdinstall(8)
you are running as root so can detect even ``dangerously dedicated''
file systems that are not present in GEOM; e.g., no PART class for
a DOS filesystem written directly to disk without partition table).
+ No more use of legacy tools such as diskinfo(8) to get disk capacity
or fdisk(8) to see partitions.
MFC after: 1 week
Diffstat (limited to 'usr.sbin/bsdconfig/share/media/dos.subr')
-rw-r--r-- | usr.sbin/bsdconfig/share/media/dos.subr | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/usr.sbin/bsdconfig/share/media/dos.subr b/usr.sbin/bsdconfig/share/media/dos.subr index e8e6aa6..df91aeb 100644 --- a/usr.sbin/bsdconfig/share/media/dos.subr +++ b/usr.sbin/bsdconfig/share/media/dos.subr @@ -61,26 +61,20 @@ f_media_set_dos() if [ ${ndevs:=0} -eq 0 ]; then f_show_msg "$msg_no_dos_primary_partitions_found" return $FAILURE - elif [ $ndevs -gt 1 ]; then + elif [ $ndevs -eq 1 ]; then + f_struct_copy $devs device_media + else + local dev local title="$msg_choose_a_dos_partition" local prompt="$msg_please_select_dos_partition" - local hline="" + local hline= - local dev retval dev=$( f_device_menu \ "$title" "$prompt" "$hline" $DEVICE_TYPE_DOS \ - 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) - retval=$? - [ "$dev" ] || return $FAILURE - - f_device_find "$dev" $DEVICE_TYPE_DOS devs - [ "$devs" ] || return $FAILURE - dev="${devs%%[$IFS]*}" + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) || + return $FAILURE - f_struct_copy device_$dev device_media - [ $retval -eq $SUCCESS ] || return $FAILURE - else - f_struct_copy device_$devs device_media + f_struct_copy "$dev" device_media fi f_struct device_media || return $FAILURE @@ -96,7 +90,7 @@ f_media_init_dos() local funcname=f_media_init_dos local dev="$1" devname err - device_$dev get devname devname || return $FAILURE + $dev get devname devname || return $FAILURE f_dprintf "Init routine called for DOS device. devname=[%s]" \ "$devname" @@ -132,9 +126,11 @@ f_media_init_dos() f_media_get_dos() { local dev="$1" file="$2" probe_type="$3" + local name + $dev get name name f_dprintf "f_media_get_dos: dev=[%s] file=[%s] probe_type=%s" \ - "$dev" "$file" "$probe_type" + "$name" "$file" "$probe_type" f_media_generic_get "$MOUNTPOINT" "$file" "$probe_type" } |