Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jan 2016 08:49:44 +0000 (UTC)
From:      =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= <des@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r294782 - stable/10/sys/conf
Message-ID:  <201601260849.u0Q8nikx044349@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: des
Date: Tue Jan 26 08:49:44 2016
New Revision: 294782
URL: https://svnweb.freebsd.org/changeset/base/294782

Log:
  MFH (r293033): ignore unload unless loaded + add a reload target

Modified:
  stable/10/sys/conf/kmod.mk
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/conf/kmod.mk
==============================================================================
--- stable/10/sys/conf/kmod.mk	Tue Jan 26 08:46:02 2016	(r294781)
+++ stable/10/sys/conf/kmod.mk	Tue Jan 26 08:49:44 2016	(r294782)
@@ -31,6 +31,9 @@
 # MFILES	Optionally a list of interfaces used by the module.
 #		This file contains a default list of interfaces.
 #
+# KMODISLOADED	Command to check whether a kernel module is
+#		loaded [/sbin/kldstat -q -n]
+#
 # PROG		The name of the kernel module to build.
 #		If not supplied, ${KMOD}.ko is used.
 #
@@ -59,6 +62,9 @@
 # 	unload:
 #		Unload a module.
 #
+#	reload:
+#		Unload if loaded, then load.
+#
 
 # backwards compat option for older systems.
 MACHINE_CPUARCH?=${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/}
@@ -66,6 +72,7 @@ MACHINE_CPUARCH?=${MACHINE_ARCH:C/mips(n
 AWK?=		awk
 KMODLOAD?=	/sbin/kldload
 KMODUNLOAD?=	/sbin/kldunload
+KMODISLOADED?=	/sbin/kldstat -q -n
 OBJCOPY?=	objcopy
 
 .if defined(KMODDEPS)
@@ -324,7 +331,11 @@ load: ${PROG}
 
 .if !target(unload)
 unload:
-	${KMODUNLOAD} -v ${PROG}
+	if ${KMODISLOADED} ${PROG} ; then ${KMODUNLOAD} -v ${PROG} ; fi
+.endif
+
+.if !target(reload)
+reload: unload load
 .endif
 
 .if defined(KERNBUILDDIR)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601260849.u0Q8nikx044349>