PERFORCE change 111063 for review

Todd Miller millert at FreeBSD.org
Mon Dec 4 10:50:49 PST 2006


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

Change 111063 by millert at millert_g5tower on 2006/12/04 18:46:46

	Enable the sidtab spinlock.

Affected files ...

.. //depot/projects/trustedbsd/sedarwin8/policies/sedarwin/sedarwin/ss/init.c#6 edit
.. //depot/projects/trustedbsd/sedarwin8/policies/sedarwin/sedarwin/ss/sidtab.c#4 edit
.. //depot/projects/trustedbsd/sedarwin8/policies/sedarwin/sedarwin/ss/sidtab.h#3 edit

Differences ...

==== //depot/projects/trustedbsd/sedarwin8/policies/sedarwin/sedarwin/ss/init.c#6 (text+ko) ====

@@ -26,11 +26,11 @@
 #include <sedarwin/ss/security.h>
 
 lck_grp_t *ss_lck_grp;
+lck_attr_t *ss_lck_attr;
 
 int security_init(void)
 {
 	lck_grp_attr_t *ss_lck_grp_attr;
-	lck_attr_t *ss_lck_attr;
 	void    *policy_data;
 	size_t   policy_len;
 	int rc;

==== //depot/projects/trustedbsd/sedarwin8/policies/sedarwin/sedarwin/ss/sidtab.c#4 (text+ko) ====

@@ -16,22 +16,15 @@
 #define SIDTAB_HASH(sid) \
 (sid & SIDTAB_HASH_MASK)
 
-#ifdef __FreeBSD__
-#define INIT_SIDTAB_LOCK(s) 					\
-  memset (&s->lock, 0, sizeof (struct mtx));			\
-  mtx_init (&s->lock, "SEBSD sidtab lock", NULL, MTX_DEF) 
+extern lck_grp_t *ss_lck_grp;
+extern lck_attr_t *ss_lck_attr;
 
-#define SIDTAB_LOCK(s) mtx_lock(&s->lock)
-#define SIDTAB_UNLOCK(s) mtx_unlock(&s->lock)
+#define INIT_SIDTAB_LOCK(s) do {					\
+	(s)->lock = lck_spin_alloc_init(ss_lck_grp, ss_lck_attr);	\
+} while (0)
 
-#else
-
-/* XXX - darwin locking */
-#define INIT_SIDTAB_LOCK(s) 
-#define SIDTAB_LOCK(s) 
-#define SIDTAB_UNLOCK(s) 
-
-#endif
+#define SIDTAB_LOCK(s) lck_spin_lock((s)->lock)
+#define SIDTAB_UNLOCK(s) lck_spin_unlock((s)->lock)
 
 int sidtab_init(struct sidtab *s)
 {

==== //depot/projects/trustedbsd/sedarwin8/policies/sedarwin/sedarwin/ss/sidtab.h#3 (text+ko) ====

@@ -29,9 +29,7 @@
 	unsigned int nel;	/* number of elements */
 	unsigned int next_sid;	/* next SID to allocate */
 	unsigned char shutdown;
-#ifdef __FreeBSD__
-	spinlock_t lock;
-#endif
+	lck_spin_t *lock;
 };
 
 int sidtab_init(struct sidtab *s);


More information about the trustedbsd-cvs mailing list