svn commit: r343027 - in head/sys: kern sys

Gleb Smirnoff glebius at FreeBSD.org
Tue Jan 15 00:35:21 UTC 2019


Author: glebius
Date: Tue Jan 15 00:35:19 2019
New Revision: 343027
URL: https://svnweb.freebsd.org/changeset/base/343027

Log:
  Add flag LK_NEW for lockinit() that is converted to LO_NEW and passed
  down to lock_init().  This allows for lockinit() on a not prezeroed
  memory.

Modified:
  head/sys/kern/kern_lock.c
  head/sys/sys/lockmgr.h

Modified: head/sys/kern/kern_lock.c
==============================================================================
--- head/sys/kern/kern_lock.c	Tue Jan 15 00:02:06 2019	(r343026)
+++ head/sys/kern/kern_lock.c	Tue Jan 15 00:35:19 2019	(r343027)
@@ -450,6 +450,8 @@ lockinit(struct lock *lk, int pri, const char *wmesg, 
 		iflags |= LO_QUIET;
 	if (flags & LK_IS_VNODE)
 		iflags |= LO_IS_VNODE;
+	if (flags & LK_NEW)
+		iflags |= LO_NEW;
 	iflags |= flags & (LK_ADAPTIVE | LK_NOSHARE);
 
 	lock_init(&lk->lock_object, &lock_class_lockmgr, wmesg, NULL, iflags);

Modified: head/sys/sys/lockmgr.h
==============================================================================
--- head/sys/sys/lockmgr.h	Tue Jan 15 00:02:06 2019	(r343026)
+++ head/sys/sys/lockmgr.h	Tue Jan 15 00:35:19 2019	(r343027)
@@ -143,7 +143,7 @@ _lockmgr_args_rw(struct lock *lk, u_int flags, struct 
 /*
  * Flags for lockinit().
  */
-#define	LK_INIT_MASK	0x0000FF
+#define	LK_INIT_MASK	0x0001FF
 #define	LK_CANRECURSE	0x000001
 #define	LK_NODUP	0x000002
 #define	LK_NOPROFILE	0x000004
@@ -152,6 +152,7 @@ _lockmgr_args_rw(struct lock *lk, u_int flags, struct 
 #define	LK_QUIET	0x000020
 #define	LK_ADAPTIVE	0x000040
 #define	LK_IS_VNODE	0x000080	/* Tell WITNESS about a VNODE lock */
+#define	LK_NEW		0x000100
 
 /*
  * Additional attributes to be used in lockmgr().


More information about the svn-src-all mailing list