kernel - Add description to static token initializers
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 28 Aug 2010 01:28:38 +0000 (18:28 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sat, 28 Aug 2010 01:28:38 +0000 (18:28 -0700)
* Add a description argument for LWKT_TOKEN_xx_INITIALIZER()

sys/kern/kern_event.c
sys/kern/lwkt_token.c
sys/kern/sys_generic.c
sys/platform/pc32/i386/busdma_machdep.c
sys/platform/pc64/x86_64/busdma_machdep.c
sys/platform/vkernel/platform/busdma_machdep.c
sys/platform/vkernel64/platform/busdma_machdep.c
sys/sys/thread.h

index f859dae..40c42ab 100644 (file)
@@ -60,7 +60,7 @@
 /*
  * Global token for kqueue subsystem
  */
-struct lwkt_token kq_token = LWKT_TOKEN_UP_INITIALIZER;
+struct lwkt_token kq_token = LWKT_TOKEN_UP_INITIALIZER(kq_token);
 
 MALLOC_DEFINE(M_KQUEUE, "kqueue", "memory for kqueue system");
 
index 2597df5..e0f015f 100644 (file)
@@ -128,14 +128,14 @@ SYSCTL_INT(_lwkt, OID_AUTO, token_debug, CTLFLAG_RW, &token_debug, 0, "");
  * any time, the MP state is copied to the tokref when the token is acquired
  * and will not race against sysctl changes.
  */
-struct lwkt_token pmap_token = LWKT_TOKEN_UP_INITIALIZER;
-struct lwkt_token dev_token = LWKT_TOKEN_UP_INITIALIZER;
-struct lwkt_token vm_token = LWKT_TOKEN_UP_INITIALIZER;
-struct lwkt_token vmspace_token = LWKT_TOKEN_UP_INITIALIZER;
-struct lwkt_token kvm_token = LWKT_TOKEN_UP_INITIALIZER;
-struct lwkt_token proc_token = LWKT_TOKEN_UP_INITIALIZER;
-struct lwkt_token tty_token = LWKT_TOKEN_UP_INITIALIZER;
-struct lwkt_token vnode_token = LWKT_TOKEN_UP_INITIALIZER;
+struct lwkt_token pmap_token = LWKT_TOKEN_UP_INITIALIZER(pmap_token);
+struct lwkt_token dev_token = LWKT_TOKEN_UP_INITIALIZER(dev_token);
+struct lwkt_token vm_token = LWKT_TOKEN_UP_INITIALIZER(vm_token);
+struct lwkt_token vmspace_token = LWKT_TOKEN_UP_INITIALIZER(vmspace_token);
+struct lwkt_token kvm_token = LWKT_TOKEN_UP_INITIALIZER(kvm_token);
+struct lwkt_token proc_token = LWKT_TOKEN_UP_INITIALIZER(proc_token);
+struct lwkt_token tty_token = LWKT_TOKEN_UP_INITIALIZER(tty_token);
+struct lwkt_token vnode_token = LWKT_TOKEN_UP_INITIALIZER(vnode_token);
 
 SYSCTL_INT(_lwkt, OID_AUTO, pmap_mpsafe,
           CTLFLAG_RW, &pmap_token.t_flags, 0, "");
index f6672f6..18b6f6a 100644 (file)
@@ -108,7 +108,7 @@ struct poll_kevent_copyin_args {
        int             error;
 };
 
-static struct lwkt_token mapped_ioctl_token = LWKT_TOKEN_MP_INITIALIZER;
+static struct lwkt_token mioctl_token = LWKT_TOKEN_MP_INITIALIZER(mioctl_token);
 
 static int     doselect(int nd, fd_set *in, fd_set *ou, fd_set *ex,
                         struct timespec *ts, int *res);
@@ -603,7 +603,7 @@ mapped_ioctl(int fd, u_long com, caddr_t uspc_data, struct ioctl_map *map,
 
                maskcmd = com & map->mask;
 
-               lwkt_gettoken(&mapped_ioctl_token);
+               lwkt_gettoken(&mioctl_token);
                LIST_FOREACH(e, &map->mapping, entries) {
                        for (iomc = e->cmd_ranges; iomc->start != 0 ||
                             iomc->maptocmd != 0 || iomc->wrapfunc != NULL ||
@@ -619,7 +619,7 @@ mapped_ioctl(int fd, u_long com, caddr_t uspc_data, struct ioctl_map *map,
                            iomc->wrapfunc != NULL || iomc->mapfunc != NULL)
                                break;
                }
-               lwkt_reltoken(&mapped_ioctl_token);
+               lwkt_reltoken(&mioctl_token);
 
                if (iomc == NULL ||
                    (iomc->start == 0 && iomc->maptocmd == 0
@@ -767,9 +767,9 @@ mapped_ioctl_register_handler(struct ioctl_map_handler *he)
        ne->subsys = he->subsys;
        ne->cmd_ranges = he->cmd_ranges;
 
-       lwkt_gettoken(&mapped_ioctl_token);
+       lwkt_gettoken(&mioctl_token);
        LIST_INSERT_HEAD(&he->map->mapping, ne, entries);
-       lwkt_reltoken(&mapped_ioctl_token);
+       lwkt_reltoken(&mioctl_token);
 
        return(0);
 }
@@ -785,7 +785,7 @@ mapped_ioctl_unregister_handler(struct ioctl_map_handler *he)
 
        KKASSERT(he != NULL && he->map != NULL && he->cmd_ranges != NULL);
 
-       lwkt_gettoken(&mapped_ioctl_token);
+       lwkt_gettoken(&mioctl_token);
        LIST_FOREACH(ne, &he->map->mapping, entries) {
                if (ne->cmd_ranges == he->cmd_ranges) {
                        LIST_REMOVE(ne, entries);
@@ -794,7 +794,7 @@ mapped_ioctl_unregister_handler(struct ioctl_map_handler *he)
                        break;
                }
        }
-       lwkt_reltoken(&mapped_ioctl_token);
+       lwkt_reltoken(&mioctl_token);
        return(error);
 }
 
index 6f02811..2721b20 100644 (file)
@@ -138,7 +138,8 @@ struct bounce_zone {
 #define BZ_UNLOCK(bz)  crit_exit()
 #endif
 
-static struct lwkt_token bounce_zone_tok = LWKT_TOKEN_MP_INITIALIZER;
+static struct lwkt_token bounce_zone_tok =
+       LWKT_TOKEN_MP_INITIALIZER(bounce_zone_tok);
 static int busdma_zonecount;
 static STAILQ_HEAD(, bounce_zone) bounce_zone_list =
        STAILQ_HEAD_INITIALIZER(bounce_zone_list);
index 6f02811..eba440f 100644 (file)
@@ -138,7 +138,8 @@ struct bounce_zone {
 #define BZ_UNLOCK(bz)  crit_exit()
 #endif
 
-static struct lwkt_token bounce_zone_tok = LWKT_TOKEN_MP_INITIALIZER;
+static struct lwkt_token bounce_zone_tok =
+       LWKT_TOKEN_MP_INITIALIZER(bounce_zone_token);
 static int busdma_zonecount;
 static STAILQ_HEAD(, bounce_zone) bounce_zone_list =
        STAILQ_HEAD_INITIALIZER(bounce_zone_list);
index 4e1bcc5..d8326c8 100644 (file)
@@ -128,7 +128,8 @@ struct bounce_zone {
 #define BZ_UNLOCK(bz)  crit_exit()
 #endif
 
-static struct lwkt_token bounce_zone_tok = LWKT_TOKEN_MP_INITIALIZER;
+static struct lwkt_token bounce_zone_tok =
+       LWKT_TOKEN_MP_INITIALIZER(bounce_zone_token);
 static int busdma_zonecount;
 static STAILQ_HEAD(, bounce_zone) bounce_zone_list =
        STAILQ_HEAD_INITIALIZER(bounce_zone_list);
index 05c391b..e5ded77 100644 (file)
@@ -126,7 +126,8 @@ struct bounce_zone {
 #define BZ_UNLOCK(bz)  crit_exit()
 #endif
 
-static struct lwkt_token bounce_zone_tok = LWKT_TOKEN_MP_INITIALIZER;
+static struct lwkt_token bounce_zone_tok =
+       LWKT_TOKEN_MP_INITIALIZER(bounce_zone_token);
 static int busdma_zonecount;
 static STAILQ_HEAD(, bounce_zone) bounce_zone_list =
        STAILQ_HEAD_INITIALIZER(bounce_zone_list);
index ca8b2a0..2e37597 100644 (file)
@@ -114,18 +114,20 @@ typedef struct lwkt_token {
  *     UP - Not MPSAFE (full MP lock will also be acquired)
  *     MP - Is MPSAFE  (only the token will be acquired)
  */
-#define LWKT_TOKEN_UP_INITIALIZER      \
+#define LWKT_TOKEN_UP_INITIALIZER(name)        \
 {                                      \
        .t_ref = NULL,                  \
        .t_flags = 0,                   \
-       .t_collisions = 0               \
+       .t_collisions = 0,              \
+       .t_desc = #name                 \
 }
 
-#define LWKT_TOKEN_MP_INITIALIZER      \
+#define LWKT_TOKEN_MP_INITIALIZER(name)        \
 {                                      \
        .t_ref = NULL,                  \
        .t_flags = LWKT_TOKEN_MPSAFE,   \
-       .t_collisions = 0               \
+       .t_collisions = 0,              \
+       .t_desc = #name                 \
 }
 
 #define ASSERT_LWKT_TOKEN_HELD(tok) \