Index: kern/subr_lock.c =================================================================== RCS file: /home/ncvs/src/sys/kern/subr_lock.c,v retrieving revision 1.14 diff -d -u -r1.14 subr_lock.c --- kern/subr_lock.c 3 Apr 2007 18:36:26 -0000 1.14 +++ kern/subr_lock.c 4 Apr 2007 06:42:34 -0000 @@ -43,6 +43,8 @@ #include #include #include +#include +#include #include #include #include @@ -197,6 +199,11 @@ { int i; + /* + * M_DEVBUF is wrong, find the right one + */ + lock->lo_ext = malloc(sizeof(struct lock_object_ext), M_DEVBUF, M_WAITOK); + /* Check for double-init and zero object. */ KASSERT(!lock_initalized(lock), ("lock \"%s\" %p already initialized", name, lock)); Index: sys/_lock.h =================================================================== RCS file: /home/ncvs/src/sys/sys/_lock.h,v retrieving revision 1.14 diff -d -u -r1.14 _lock.h --- sys/_lock.h 13 Nov 2006 05:41:26 -0000 1.14 +++ sys/_lock.h 4 Apr 2007 06:42:34 -0000 @@ -53,17 +53,27 @@ u_int lpo_contest_locking; }; -struct lock_object { - const char *lo_name; /* Individual lock name. */ - const char *lo_type; /* General lock type. */ - u_int lo_flags; -#ifdef LOCK_PROFILING - struct lock_profile_object lo_profile_obj; -#endif + +struct lock_object_ext { + const char *lox_name; /* Individual lock name. */ + const char *lox_type; /* General lock type. */ + union { /* Data for witness. */ STAILQ_ENTRY(lock_object) lod_list; struct witness *lod_witness; - } lo_witness_data; + } lox_witness_data; + + struct lock_profile_object lox_profile_obj; }; +struct lock_object { + u_int lo_flags; + struct lock_object_ext *lo_ext; +}; + +#define lo_profile_obj lo_ext->lox_profile_obj +#define lo_witness_data lo_ext->lox_witness_data +#define lo_name lo_ext->lox_name +#define lo_type lo_ext->lox_type + #endif /* !_SYS__LOCK_H_ */