Deleted Added
full compact
zfs (168766) zfs (168956)
1#!/bin/sh
2#
1#!/bin/sh
2#
3# $FreeBSD: head/etc/rc.d/zfs 168766 2007-04-15 18:07:14Z pjd $
3# $FreeBSD: head/etc/rc.d/zfs 168956 2007-04-22 20:55:08Z pjd $
4#
5
6# PROVIDE: zfs
7# REQUIRE: mountcritlocal
4#
5
6# PROVIDE: zfs
7# REQUIRE: mountcritlocal
8# KEYWORD: nojail
9
10. /etc/rc.subr
11
12name="zfs"
13rcvar="zfs_enable"
14start_cmd="zfs_start"
15stop_cmd="zfs_stop"
16required_modules="zfs"
17
8
9. /etc/rc.subr
10
11name="zfs"
12rcvar="zfs_enable"
13start_cmd="zfs_start"
14stop_cmd="zfs_stop"
15required_modules="zfs"
16
18zfs_start()
17zfs_start_jail()
19{
18{
19 if [ `$SYSCTL_N security.jail.mount_allowed` -eq 1 ]; then
20 zfs mount -a
21 fi
22}
23
24zfs_start_main()
25{
20 zfs volinit
21 zfs mount -a
22 zfs share -a
23 if [ ! -r /etc/zfs/exports ]; then
24 touch /etc/zfs/exports
25 fi
26 # Enable swap on ZVOLs with property org.freebsd:swap=on.
27 zfs list -H -o org.freebsd:swap,name -t volume | \
28 while read state name; do
29 case "${state}" in
30 [oO][nN])
31 swapon /dev/zvol/${name}
32 ;;
33 esac
34 done
35}
36
26 zfs volinit
27 zfs mount -a
28 zfs share -a
29 if [ ! -r /etc/zfs/exports ]; then
30 touch /etc/zfs/exports
31 fi
32 # Enable swap on ZVOLs with property org.freebsd:swap=on.
33 zfs list -H -o org.freebsd:swap,name -t volume | \
34 while read state name; do
35 case "${state}" in
36 [oO][nN])
37 swapon /dev/zvol/${name}
38 ;;
39 esac
40 done
41}
42
37zfs_stop()
43zfs_start()
38{
44{
45 if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then
46 zfs_start_jail
47 else
48 zfs_start_main
49 fi
50}
51
52zfs_stop_jail()
53{
54 if [ `$SYSCTL_N security.jail.mount_allowed` -eq 1 ]; then
55 zfs unmount -a
56 fi
57}
58
59zfs_stop_main()
60{
39 # Disable swap on ZVOLs with property org.freebsd:swap=on.
40 zfs list -H -o org.freebsd:swap,name -t volume | \
41 while read state name; do
42 case "${state}" in
43 [oO][nN])
44 swapoff /dev/zvol/${name}
45 ;;
46 esac
47 done
48 zfs unshare -a
49 zfs unmount -a
50 zfs volfini
51}
52
61 # Disable swap on ZVOLs with property org.freebsd:swap=on.
62 zfs list -H -o org.freebsd:swap,name -t volume | \
63 while read state name; do
64 case "${state}" in
65 [oO][nN])
66 swapoff /dev/zvol/${name}
67 ;;
68 esac
69 done
70 zfs unshare -a
71 zfs unmount -a
72 zfs volfini
73}
74
75zfs_stop()
76{
77 if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then
78 zfs_stop_jail
79 else
80 zfs_stop_main
81 fi
82}
83
53load_rc_config $name
54run_rc_command "$1"
84load_rc_config $name
85run_rc_command "$1"