head	1.6;
access;
symbols
	netbsd-10-2-RELEASE:1.6
	netbsd-9-5-RELEASE:1.1.2.4
	netbsd-11-0-RELEASE:1.6
	netbsd-11-0-RC7:1.6
	netbsd-11-0-RC6:1.6
	netbsd-11-0-RC5:1.6
	netbsd-11-0-RC4:1.6
	netbsd-11-0-RC3:1.6
	netbsd-11-0-RC2:1.6
	netbsd-11-0-RC1:1.6
	perseant-exfatfs-base-20250801:1.6
	netbsd-11:1.6.0.6
	netbsd-11-base:1.6
	netbsd-10-1-RELEASE:1.6
	perseant-exfatfs-base-20240630:1.6
	perseant-exfatfs:1.6.0.4
	perseant-exfatfs-base:1.6
	netbsd-9-4-RELEASE:1.1.2.4
	netbsd-10-0-RELEASE:1.6
	netbsd-10-0-RC6:1.6
	netbsd-10-0-RC5:1.6
	netbsd-10-0-RC4:1.6
	netbsd-10-0-RC3:1.6
	netbsd-10-0-RC2:1.6
	netbsd-10-0-RC1:1.6
	netbsd-10:1.6.0.2
	netbsd-10-base:1.6
	netbsd-9-3-RELEASE:1.1.2.4
	cjep_sun2x-base1:1.5
	cjep_sun2x:1.5.0.8
	cjep_sun2x-base:1.5
	cjep_staticlib_x-base1:1.5
	netbsd-9-2-RELEASE:1.1.2.4
	cjep_staticlib_x:1.5.0.6
	cjep_staticlib_x-base:1.5
	netbsd-9-1-RELEASE:1.1.2.4
	phil-wifi-20200421:1.5
	phil-wifi:1.5.0.4
	phil-wifi-20200411:1.5
	is-mlppp:1.5.0.2
	is-mlppp-base:1.5
	phil-wifi-20200406:1.5
	netbsd-9-0-RELEASE:1.1.2.4
	netbsd-9-0-RC2:1.1.2.4
	netbsd-9-0-RC1:1.1.2.2
	phil-wifi-20191119:1.1
	netbsd-9:1.1.0.2;
locks; strict;
comment	@# @;


1.6
date	2021.08.03.05.15.20;	author mlelstv;	state Exp;
branches;
next	1.5;
commitid	pSecJrkajnyj5u3D;

1.5
date	2019.12.09.00.11.32;	author sevan;	state Exp;
branches
	1.5.4.1;
next	1.4;
commitid	IEsj5qfn1JOOKXNB;

1.4
date	2019.12.08.00.58.16;	author sevan;	state Exp;
branches;
next	1.3;
commitid	XUoMahSpUW3d5QNB;

1.3
date	2019.12.04.16.46.50;	author jmcneill;	state Exp;
branches;
next	1.2;
commitid	JGAY8VLz7ucSspNB;

1.2
date	2019.12.01.21.00.43;	author jmcneill;	state Exp;
branches;
next	1.1;
commitid	TtNOQTmxNLxsX2NB;

1.1
date	2019.09.15.19.38.09;	author brad;	state Exp;
branches
	1.1.2.1;
next	;
commitid	bByVmrilu0dLW8DB;

1.5.4.1
date	2019.12.09.00.11.32;	author martin;	state dead;
branches;
next	1.5.4.2;
commitid	X01YhRUPVUDaec4C;

1.5.4.2
date	2020.04.13.07.45.46;	author martin;	state Exp;
branches;
next	;
commitid	X01YhRUPVUDaec4C;

1.1.2.1
date	2019.09.15.19.38.09;	author martin;	state dead;
branches;
next	1.1.2.2;
commitid	DpUTyCfKkivBaDEB;

1.1.2.2
date	2019.09.27.09.18.37;	author martin;	state Exp;
branches;
next	1.1.2.3;
commitid	DpUTyCfKkivBaDEB;

1.1.2.3
date	2019.12.08.14.42.01;	author martin;	state Exp;
branches;
next	1.1.2.4;
commitid	oA8LwI5gmY15EUNB;

1.1.2.4
date	2019.12.11.14.13.40;	author martin;	state Exp;
branches;
next	;
commitid	EPrSCRHFs3YmoiOB;


desc
@@


1.6
log
@Reverse devpubd dependeny to avoid dangling reference to zfs which is
an optional part of the build.
@
text
@#!/bin/sh
#
# $NetBSD: zfs,v 1.5 2019/12/09 00:11:32 sevan Exp $
#

# PROVIDE: zfs
# REQUIRE: root devpubd
# BEFORE:  DISKS

$_rc_subr_loaded . /etc/rc.subr

name="zfs"
rcvar=$name
start_cmd="zfs_start"
stop_cmd="zfs_stop"

zfs_start()
{
	if [ -x /sbin/zfs ]; then
		# Get ZFS module loaded (and thereby, zvols created).
		/sbin/zfs list > /dev/null 2>&1
		if [ $? -ne 0 ]; then
			warn "zfs module may not have loaded, may not be present in the kernel, or /dev/zfs may be missing"
			return 1;
		fi
	fi
}

zfs_stop()
{
	if [ -x /sbin/zfs ]; then
		modunload zfs
	fi
	return 0;
}

load_rc_config $name
run_rc_command "$1"
@


1.5
log
@This script just makes sure that the ZFS module loads and unloads, mountall
script takes care of mounting filesystems.
Don't try to unmount all file systems before unloading the ZFS module, leave
that to the operator in preperation or the mountall script to take care
of. Module will of course fail to unload then if file systems are still
mounted.
@
text
@d3 1
a3 1
# $NetBSD: zfs,v 1.4 2019/12/08 00:58:16 sevan Exp $
d7 1
a7 1
# REQUIRE: root
@


1.5.4.1
log
@file zfs was added on branch phil-wifi on 2020-04-13 07:45:46 +0000
@
text
@d1 38
@


1.5.4.2
log
@Mostly merge changes from HEAD upto 20200411
@
text
@a0 38
#!/bin/sh
#
# $NetBSD$
#

# PROVIDE: zfs
# REQUIRE: root
# BEFORE:  DISKS

$_rc_subr_loaded . /etc/rc.subr

name="zfs"
rcvar=$name
start_cmd="zfs_start"
stop_cmd="zfs_stop"

zfs_start()
{
	if [ -x /sbin/zfs ]; then
		# Get ZFS module loaded (and thereby, zvols created).
		/sbin/zfs list > /dev/null 2>&1
		if [ $? -ne 0 ]; then
			warn "zfs module may not have loaded, may not be present in the kernel, or /dev/zfs may be missing"
			return 1;
		fi
	fi
}

zfs_stop()
{
	if [ -x /sbin/zfs ]; then
		modunload zfs
	fi
	return 0;
}

load_rc_config $name
run_rc_command "$1"
@


1.4
log
@We don't need to require the presence of /etc/zfs/zpool.cache to unmount &
unload the module, just like for the start target.
@
text
@d3 1
a3 1
# $NetBSD: zfs,v 1.3 2019/12/04 16:46:50 jmcneill Exp $
a31 1
		zfs unmount -a
@


1.3
log
@Add missing rcvar=$name
@
text
@d3 1
a3 1
# $NetBSD: zfs,v 1.2 2019/12/01 21:00:43 jmcneill Exp $
d31 1
a31 1
	if [ -x /sbin/zfs -a -f /etc/zfs/zpool.cache ]; then
@


1.2
log
@Attempt to load the zfs module even if /etc/zfs/zpool.cache is absent. The
module needs to be loaded to create a pool in the first place, and
autoloading won't work after the fact won't work at securelevel=1.
@
text
@d3 1
a3 1
# $NetBSD: zfs,v 1.1 2019/09/15 19:38:09 brad Exp $
d13 1
@


1.1
log
@

Add support for legacy ZFS filesystems, specified by mountpoint=legacy
in the ZFS properties of the dataset and a simple man page for
mount_zfs.  With this, it is possible to put ZFS filesystems in
/etc/fstab as file system type zfs.

Add a rc.d script that kicks the module ZFS load mostly before
mountall runs simular to what LVM does.  This allows for any legacy
mounts to be specified in critical_local_filesystems and allows for
ZFS pools on top of cgd (probably among other things).  Introduce a
rc.conf variable called zfs which needs to be set to YES, in the usual
manor of things, to get zvols and ZFS dataset support rather then just
assume that 'zfs mount' does that in mountall.  Fix a problem in
mountall if ZFS is not compiled into the system.
@
text
@d3 1
a3 1
# $NetBSD$
d18 1
a18 1
	if [ -x /sbin/zfs -a -f /etc/zfs/zpool.cache ]; then
@


1.1.2.1
log
@file zfs was added on branch netbsd-9 on 2019-09-27 09:18:37 +0000
@
text
@d1 38
@


1.1.2.2
log
@Pull up following revision(s) (requested by brad in ticket #250):

	external/cddl/osnet/sbin/zfs/mount_zfs.8: revision 1.2
	external/cddl/osnet/sbin/zfs/mount_zfs.8: revision 1.3
	external/cddl/osnet/sbin/zfs/mount_zfs.8: revision 1.4
	external/cddl/osnet/sbin/zfs/mount_zfs.8: revision 1.5
	distrib/sets/lists/man/mi: revision 1.1652
	distrib/sets/lists/man/mi: revision 1.1653
	distrib/sets/lists/etc/mi: revision 1.259
	etc/rc.d/mountall: revision 1.11
	external/cddl/osnet/sbin/zfs/Makefile: revision 1.5
	external/cddl/osnet/dist/cmd/zfs/zfs_main.c: revision 1.7
	etc/rc.d/Makefile: revision 1.105
	distrib/sets/lists/base/mi: revision 1.1217
	etc/rc.d/Makefile: revision 1.106
	etc/rc.d/zfs: revision 1.1
	etc/defaults/rc.conf: revision 1.152
	external/cddl/osnet/sbin/zfs/mount_zfs.8: revision 1.1

Add support for legacy ZFS filesystems, specified by mountpoint=legacy
in the ZFS properties of the dataset and a simple man page for
mount_zfs.  With this, it is possible to put ZFS filesystems in
/etc/fstab as file system type zfs.

Add a rc.d script that kicks the module ZFS load mostly before
mountall runs simular to what LVM does.  This allows for any legacy
mounts to be specified in critical_local_filesystems and allows for
ZFS pools on top of cgd (probably among other things).  Introduce a
rc.conf variable called zfs which needs to be set to YES, in the usual
manor of things, to get zvols and ZFS dataset support rather then just
assume that 'zfs mount' does that in mountall.  Fix a problem in
mountall if ZFS is not compiled into the system.
mount_zfs.8: add xref to fstab(5)

Use more markup.

Include mount_zfs man pages only for MKZFS builds.

Moved zfs out of MKX11 block.

Fix build failure without X11.

Add a copyright to the man page and a bit of history.
Use Pa macro for path
new sentence, new line
@
text
@a0 38
#!/bin/sh
#
# $NetBSD: zfs,v 1.1 2019/09/15 19:38:09 brad Exp $
#

# PROVIDE: zfs
# REQUIRE: root
# BEFORE:  DISKS

$_rc_subr_loaded . /etc/rc.subr

name="zfs"
start_cmd="zfs_start"
stop_cmd="zfs_stop"

zfs_start()
{
	if [ -x /sbin/zfs -a -f /etc/zfs/zpool.cache ]; then
		# Get ZFS module loaded (and thereby, zvols created).
		/sbin/zfs list > /dev/null 2>&1
		if [ $? -ne 0 ]; then
			warn "zfs module may not have loaded, may not be present in the kernel, or /dev/zfs may be missing"
			return 1;
		fi
	fi
}

zfs_stop()
{
	if [ -x /sbin/zfs -a -f /etc/zfs/zpool.cache ]; then
		zfs unmount -a
		modunload zfs
	fi
	return 0;
}

load_rc_config $name
run_rc_command "$1"
@


1.1.2.3
log
@Pull up following revision(s) (requested by jmcneill in ticket #516):

	etc/rc.d/zfs: revision 1.2
	etc/rc.d/zfs: revision 1.3

Attempt to load the zfs module even if /etc/zfs/zpool.cache is absent. The
module needs to be loaded to create a pool in the first place, and
autoloading won't work after the fact won't work at securelevel=1.

Add missing rcvar=$name
@
text
@d3 1
a3 1
# $NetBSD: zfs,v 1.1.2.2 2019/09/27 09:18:37 martin Exp $
a12 1
rcvar=$name
d18 1
a18 1
	if [ -x /sbin/zfs ]; then
@


1.1.2.4
log
@Pull up following revision(s) (requested by sevan in ticket #539):

	etc/rc.d/zfs: revision 1.4
	etc/rc.d/zfs: revision 1.5

We don't need to require the presence of /etc/zfs/zpool.cache to unmount &
unload the module, just like for the start target.

This script just makes sure that the ZFS module loads and unloads, mountall
script takes care of mounting filesystems.

Don't try to unmount all file systems before unloading the ZFS module, leave
that to the operator in preperation or the mountall script to take care
of. Module will of course fail to unload then if file systems are still
mounted.
@
text
@d3 1
a3 1
# $NetBSD: zfs,v 1.1.2.3 2019/12/08 14:42:01 martin Exp $
d31 2
a32 1
	if [ -x /sbin/zfs ]; then
@


