kernel: add a flags argument to LOCK_SYSINIT
authorFrançois Tigeot <ftigeot@wolfpond.org>
Fri, 3 Aug 2012 09:23:11 +0000 (11:23 +0200)
committerFrançois Tigeot <ftigeot@wolfpond.org>
Fri, 3 Aug 2012 10:04:23 +0000 (12:04 +0200)
We may not want to use LK_CAN_RECURSE in all situations

sys/kern/kern_lock.c
sys/sys/lock.h

index 0b70003..9453c0c 100644 (file)
@@ -710,5 +710,5 @@ lockmgr_printinfo(struct lock *lkp)
 void
 lock_sysinit(struct lock_args *arg)
 {
-       lockinit(arg->la_lock, arg->la_desc, 0, LK_CANRECURSE);
+       lockinit(arg->la_lock, arg->la_desc, 0, arg->la_flags);
 }
index 8e4174e..9134411 100644 (file)
@@ -191,6 +191,7 @@ struct proc;
 struct lock_args {
        struct lock     *la_lock;
        const char      *la_desc;
+       int             la_flags;
 };
 
 void   lockinit (struct lock *, const char *wmesg, int timo, int flags);
@@ -216,10 +217,11 @@ int       lockowned (struct lock *);
 int    lockcount (struct lock *);
 int    lockcountnb (struct lock *);
 
-#define        LOCK_SYSINIT(name, lock, desc)                          \
+#define        LOCK_SYSINIT(name, lock, desc, flags)                           \
        static struct lock_args name##_args = {                         \
                (lock),                                                 \
-               (desc)                                                  \
+               (desc),                                                 \
+               (flags)                                                 \
        };                                                              \
        SYSINIT(name##_lock_sysinit, SI_SUB_DRIVERS, SI_ORDER_MIDDLE,   \
            lock_sysinit, &name##_args);                                        \