1if [ ! "$_MEDIA_COMMON_SUBR" ]; then _MEDIA_COMMON_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/common.subr 259054 2013-12-07 00:31:01Z dteske $
28#
29############################################################ INCLUDES
30
31BSDCFG_SHARE="/usr/share/bsdconfig"
32. $BSDCFG_SHARE/common.subr || exit 1
33f_dprintf "%s: loading includes..." media/common.subr
34f_include $BSDCFG_SHARE/device.subr
35f_include $BSDCFG_SHARE/media/any.subr
--- 20 unchanged lines hidden (view full) ---
56# Returms success if able to initialize the media device.
57#
58f_media_open()
59{
60 f_dprintf "f_media_open: Verifying and initiliazing media device"
61 { # Verify and initialize device media if-defined
62 f_struct device_media &&
63 f_media_verify &&
64 f_device_init media
65 } || return $FAILURE
66}
67
68# f_media_close
69#
70# Shuts down the media device, see f_device_shutdown() from device.subr for
71# more details.
72#
73f_media_close()
74{
75 f_dprintf "f_media_close: Shutting down media device"
76 f_struct device_media &&
77 f_device_shutdown media
78 f_struct_free device_media
79}
80
81# f_media_verify
82#
83# Returns success if the media device is available, and if not, prompts the
84# user to select a media type. See f_media_get_type() from media/any.subr for
85# more details.
--- 69 unchanged lines hidden ---
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/common.subr 259054 2013-12-07 00:31:01Z dteske $
28#
29############################################################ INCLUDES
30
31BSDCFG_SHARE="/usr/share/bsdconfig"
32. $BSDCFG_SHARE/common.subr || exit 1
33f_dprintf "%s: loading includes..." media/common.subr
34f_include $BSDCFG_SHARE/device.subr
35f_include $BSDCFG_SHARE/media/any.subr
--- 20 unchanged lines hidden (view full) ---
56# Returms success if able to initialize the media device.
57#
58f_media_open()
59{
60 f_dprintf "f_media_open: Verifying and initiliazing media device"
61 { # Verify and initialize device media if-defined
62 f_struct device_media &&
63 f_media_verify &&
64 f_device_init media
65 } || return $FAILURE
66}
67
68# f_media_close
69#
70# Shuts down the media device, see f_device_shutdown() from device.subr for
71# more details.
72#
73f_media_close()
74{
75 f_dprintf "f_media_close: Shutting down media device"
76 f_struct device_media &&
77 f_device_shutdown media
78 f_struct_free device_media
79}
80
81# f_media_verify
82#
83# Returns success if the media device is available, and if not, prompts the
84# user to select a media type. See f_media_get_type() from media/any.subr for
85# more details.
--- 69 unchanged lines hidden ---