PERFORCE change 105779 for review

Todd Miller millert at FreeBSD.org
Thu Sep 7 13:48:23 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=105779

Change 105779 by millert at millert_g5tower on 2006/09/07 13:26:42

	Slightly less obfuscated label handle locking: Rename mutex
	in label handle from io_lock_data to lh_lock_data since it
	is part of the label handle and not an ipc_object struct.
	This means we need to define lh_lock, lh_unlock and
	lh_lock_init in terms of the mutex_* functions and not io_*.

Affected files ...

.. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/ipc/ipc_labelh.c#6 edit
.. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/ipc/ipc_labelh.h#3 edit
.. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/kern/task.h#2 edit

Differences ...

==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/ipc/ipc_labelh.c#6 (text+ko) ====

@@ -71,7 +71,7 @@
 
 	/* Allocate new label handle, insert port and label. */
 	lh = (ipc_labelh_t)zalloc(ipc_labelh_zone);
-	io_lock_init(lh);
+	lh_lock_init(lh);
 	lh->lh_port = port;
 	lh->lh_label = *inl;
 	lh->lh_type = LABELH_TYPE_USER;

==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/ipc/ipc_labelh.h#3 (text+ko) ====

@@ -37,7 +37,7 @@
 	int               lh_type;
 	struct label      lh_label;
 	ipc_port_t        lh_port;
-	decl_mutex_data(,	io_lock_data)
+	decl_mutex_data(,	lh_lock_data)
 } *ipc_labelh_t;
 
 #define	LABELH_TYPE_KERN	0
@@ -60,8 +60,9 @@
 
 extern zone_t ipc_labelh_zone;
 
-#define lh_lock io_lock
-#define lh_unlock io_unlock
+#define lh_lock_init(lh)	mutex_init(&(lh)->lh_lock_data, 0)
+#define lh_lock(lh)		mutex_lock(&(lh)->lh_lock_data)
+#define lh_unlock(lh)		mutex_unlock(&(lh)->lh_lock_data)
 
 /*
  * Check the number of references the label handle has left.

==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/kern/task.h#2 (text+ko) ====

@@ -215,8 +215,8 @@
 #ifdef MAC
 #define maclabel label->lh_label
 
-#define tasklabel_lock(task) io_lock((task)->label)
-#define tasklabel_unlock(task) io_unlock((task)->label)
+#define tasklabel_lock(task)	lh_lock((task)->label)
+#define tasklabel_unlock(task)	lh_unlock((task)->label)
 
 extern void tasklabel_lock2(task_t a, task_t b);
 extern void tasklabel_unlock2(task_t a, task_t b);


More information about the trustedbsd-cvs mailing list