Module Name:    src
Committed By:   pgoyette
Date:           Sun Jul  8 07:33:14 UTC 2018

Modified Files:
        src/sys/kern [pgoyette-compat]: kern_module.c kern_module_vfs.c
            sys_module.c

Log Message:
Use SET, CLR, ISSET macros from types.h

NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.10 -r1.130.2.11 src/sys/kern/kern_module.c
cvs rdiff -u -r1.16 -r1.16.8.1 src/sys/kern/kern_module_vfs.c
cvs rdiff -u -r1.23.2.6 -r1.23.2.7 src/sys/kern/sys_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.130.2.10 src/sys/kern/kern_module.c:1.130.2.11
--- src/sys/kern/kern_module.c:1.130.2.10	Mon Jun 25 08:50:10 2018
+++ src/sys/kern/kern_module.c	Sun Jul  8 07:33:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.130.2.10 2018/06/25 08:50:10 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.130.2.11 2018/07/08 07:33:14 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.10 2018/06/25 08:50:10 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.11 2018/07/08 07:33:14 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -256,7 +256,7 @@ module_free(module_t *mod)
 static void
 module_require_force(struct module *mod)
 {
-	mod->mod_flags |= MODFLG_MUST_FORCE;
+	SET(mod->mod_flags, MODFLG_MUST_FORCE);
 }
 
 /*
@@ -577,7 +577,7 @@ module_init_class(modclass_t modclass)
 			 * (If the module has previously been set to
 			 * MODFLG_MUST_FORCE, don't try to override that!)
 			 */
-			if ((mod->mod_flags & MODFLG_MUST_FORCE) ||
+			if (ISSET(mod->mod_flags, MODFLG_MUST_FORCE) ||
 			    module_do_builtin(mod, mi->mi_name, NULL,
 			    NULL) != 0) {
 				TAILQ_REMOVE(&module_builtins, mod, mod_chain);
@@ -1039,8 +1039,8 @@ module_do_load(const char *name, bool is
 		}
 	}
 	if (mod) {
-		if ((mod->mod_flags & MODFLG_MUST_FORCE) &&
-		    (flags & MODCTL_LOAD_FORCE) == 0) {
+		if (ISSET(mod->mod_flags, MODFLG_MUST_FORCE)) &&
+		    !ISSET(flags, MODCTL_LOAD_FORCE)) {
 			if (!autoload) {
 				module_error("use -f to reinstate "
 				    "builtin module `%s'", name);
@@ -1130,7 +1130,7 @@ module_do_load(const char *name, bool is
 	if (!module_compatible(mi->mi_version, __NetBSD_Version__)) {
 		module_error("module `%s' built for `%d', system `%d'",
 		    mi->mi_name, mi->mi_version, __NetBSD_Version__);
-		if ((flags & MODCTL_LOAD_FORCE) != 0) {
+		if (ISSET(flags, MODCTL_LOAD_FORCE)) {
 			module_error("forced load, system may be unstable");
 		} else {
 			error = EPROGMISMATCH;
@@ -1311,7 +1311,7 @@ module_do_load(const char *name, bool is
 		 * a short delay unless auto-unload is disabled.
 		 */
 		mod->mod_autotime = time_second + module_autotime;
-		mod->mod_flags |= MODFLG_AUTO_LOADED;
+		SET(mod->mod_flags, MODFLG_AUTO_LOADED);
 		module_thread_kick();
 	}
 	SLIST_REMOVE_HEAD(&pend_stack, pe_entry);
@@ -1544,7 +1544,7 @@ module_thread(void *cookie)
 			if (mod->mod_source == MODULE_SOURCE_KERNEL)
 				continue;
 			/* skip modules that weren't auto-loaded */
-			if ((mod->mod_flags & MODFLG_AUTO_LOADED) == 0)
+			if (!ISSET(mod->mod_flags, MODFLG_AUTO_LOADED))
 				continue;
 
 			if (uvmexp.free < uvmexp.freemin) {

Index: src/sys/kern/kern_module_vfs.c
diff -u src/sys/kern/kern_module_vfs.c:1.16 src/sys/kern/kern_module_vfs.c:1.16.8.1
--- src/sys/kern/kern_module_vfs.c:1.16	Thu Jun  1 02:45:13 2017
+++ src/sys/kern/kern_module_vfs.c	Sun Jul  8 07:33:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module_vfs.c,v 1.16 2017/06/01 02:45:13 chs Exp $	*/
+/*	$NetBSD: kern_module_vfs.c,v 1.16.8.1 2018/07/08 07:33:14 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_module_vfs.c,v 1.16 2017/06/01 02:45:13 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module_vfs.c,v 1.16.8.1 2018/07/08 07:33:14 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 #include <sys/param.h>
@@ -106,7 +106,7 @@ module_load_vfs(const char *name, int fl
 	/*
 	 * Load and process <module>.plist if it exists.
 	 */
-	if (((flags & MODCTL_NO_PROP) == 0 && filedictp) || autoload) {
+	if ((!ISSET(flags, MODCTL_NO_PROP) && filedictp) || autoload) {
 		error = module_load_plist_vfs(path, nochroot, &moduledict);
 		if (error != 0) {
 			module_print("plist load returned error %d for `%s'",
@@ -124,7 +124,7 @@ module_load_vfs(const char *name, int fl
 			}
 		}
 		if (error == 0) {	/* can get here if error == ENOENT */
-			if ((flags & MODCTL_NO_PROP) == 0 && filedictp)
+			if (!ISSET(flags, MODCTL_NO_PROP) && filedictp)
 				*filedictp = moduledict;
 			else 
 				prop_object_release(moduledict);

Index: src/sys/kern/sys_module.c
diff -u src/sys/kern/sys_module.c:1.23.2.6 src/sys/kern/sys_module.c:1.23.2.7
--- src/sys/kern/sys_module.c:1.23.2.6	Tue Apr  3 08:29:44 2018
+++ src/sys/kern/sys_module.c	Sun Jul  8 07:33:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_module.c,v 1.23.2.6 2018/04/03 08:29:44 pgoyette Exp $	*/
+/*	$NetBSD: sys_module.c,v 1.23.2.7 2018/07/08 07:33:14 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_module.c,v 1.23.2.6 2018/04/03 08:29:44 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_module.c,v 1.23.2.7 2018/07/08 07:33:14 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_modular.h"
@@ -119,7 +119,8 @@ copy_alias(modstat_t *ms, const char * c
 	strlcpy(ms->ms_name, *aliasp, sizeof(ms->ms_name));
 	ms->ms_class = mi->mi_class;
 	ms->ms_source = mod->mod_source;
-	ms->ms_flags = mod->mod_flags | MODFLG_IS_ALIAS;
+	ms->ms_flags = mod->mod_flags;
+	SET(ms->ms_flags, MODFLG_IS_ALIAS);
 	ms->ms_reqoffset = 0;
 }
 

Reply via email to