zvol revision 256281
1#!/bin/sh 2# 3# $FreeBSD: stable/10/etc/rc.d/zvol 219090 2011-02-27 19:44:10Z pjd $ 4# 5 6# PROVIDE: zvol 7# REQUIRE: hostid 8# KEYWORD: nojail 9 10. /etc/rc.subr 11 12name="zvol" 13rcvar="zfs_enable" 14start_cmd="zvol_start" 15stop_cmd="zvol_stop" 16required_modules="zfs" 17 18zvol_start() 19{ 20 # Enable swap on ZVOLs with property org.freebsd:swap=on. 21 zfs list -H -o org.freebsd:swap,name -t volume | \ 22 while read state name; do 23 case "${state}" in 24 [oO][nN]) 25 swapon /dev/zvol/${name} 26 ;; 27 esac 28 done 29} 30 31zvol_stop() 32{ 33 # Disable swap on ZVOLs with property org.freebsd:swap=on. 34 zfs list -H -o org.freebsd:swap,name -t volume | \ 35 while read state name; do 36 case "${state}" in 37 [oO][nN]) 38 swapoff /dev/zvol/${name} 39 ;; 40 esac 41 done 42} 43 44load_rc_config $name 45run_rc_command "$1" 46