]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/kern/ltable.h
xnu-7195.50.7.100.1.tar.gz
[apple/xnu.git] / osfmk / kern / ltable.h
index c95743f10c95dd8ab7b97ce1bfc6f76718648cd0..a5b8a1b678afa75bf819364ee5a5fa2620368a81 100644 (file)
 #include <machine/locks.h>
 
 #if CONFIG_LTABLE_DEBUG
-#define ltdbg(fmt,...) \
+#define ltdbg(fmt, ...) \
        printf("LT[%s]:  " fmt "\n", __func__, ## __VA_ARGS__)
 #else
-#define ltdbg(fmt,...) do { } while (0)
+#define ltdbg(fmt, ...) do { } while (0)
 #endif
 
 #ifdef LTABLE_VERBOSE_DEBUG
-#define ltdbg_v(fmt,...) \
+#define ltdbg_v(fmt, ...) \
        printf("LT[v:%s]:  " fmt "\n", __func__, ## __VA_ARGS__)
 #else
-#define ltdbg_v(fmt,...) do { } while (0)
+#define ltdbg_v(fmt, ...) do { } while (0)
 #endif
 
-#define ltinfo(fmt,...) \
+#define ltinfo(fmt, ...) \
        printf("LT[%s]: " fmt "\n", __func__,  ## __VA_ARGS__)
 
-#define lterr(fmt,...) \
+#define lterr(fmt, ...) \
        printf("LT[%s] ERROR: " fmt "\n", __func__, ## __VA_ARGS__)
 
 
@@ -67,7 +67,7 @@ struct ltable_id {
                         * enforce a particular memory layout
                         */
                        uint64_t idx:18, /* allows indexing up to 8MB of 32byte objects */
-                                generation:46;
+                           generation:46;
                };
        };
 };
@@ -85,15 +85,15 @@ struct lt_elem {
 };
 
 /* reference count bits should _always_ be the low-order bits */
-#define LT_BITS_REFCNT_MASK  (0x1FFFFFFF)
+#define LT_BITS_REFCNT_MASK  (0x1FFFFFFFU)
 #define LT_BITS_REFCNT_SHIFT (0)
 #define LT_BITS_REFCNT       (LT_BITS_REFCNT_MASK << LT_BITS_REFCNT_SHIFT)
 
-#define LT_BITS_TYPE_MASK    (0x3)
+#define LT_BITS_TYPE_MASK    (0x3U)
 #define LT_BITS_TYPE_SHIFT   (29)
 #define LT_BITS_TYPE         (LT_BITS_TYPE_MASK << LT_BITS_TYPE_SHIFT)
 
-#define LT_BITS_VALID_MASK   (0x1)
+#define LT_BITS_VALID_MASK   (0x1U)
 #define LT_BITS_VALID_SHIFT  (31)
 #define LT_BITS_VALID        (LT_BITS_VALID_MASK << LT_BITS_VALID_SHIFT)
 
@@ -163,22 +163,13 @@ struct link_table {
 #endif
 } __attribute__((aligned(8)));
 
-
-/**
- * ltable_bootstrap: bootstrap a link table
- *
- * Called once at system boot
- */
-extern void ltable_bootstrap(void);
-
-
 /**
  * ltable_init: initialize a link table with given parameters
  *
  */
 extern void ltable_init(struct link_table *table, const char *name,
-                       uint32_t max_tbl_elem, uint32_t elem_sz,
-                       ltable_poison_func poison);
+    uint32_t max_tbl_elem, uint32_t elem_sz,
+    ltable_poison_func poison);
 
 
 /**
@@ -205,7 +196,7 @@ extern void ltable_grow(struct link_table *table, uint32_t min_free);
  */
 extern __attribute__((noinline))
 struct lt_elem *ltable_alloc_elem(struct link_table *table, int type,
-                                 int nelem, int nattempts);
+    int nelem, int nattempts);
 
 
 #if DEVELOPMENT || DEBUG
@@ -226,7 +217,7 @@ int ltable_nelem(struct link_table *table);
  * 'type'.
  */
 extern void ltable_realloc_elem(struct link_table *table,
-                               struct lt_elem *elem, int type);
+    struct lt_elem *elem, int type);
 
 
 /**
@@ -288,7 +279,7 @@ extern void lt_elem_mkvalid(struct lt_elem *elem);
  * however this could also result in: parent->...->child
  */
 extern int lt_elem_list_link(struct link_table *table,
-                            struct lt_elem *parent, struct lt_elem *child);
+    struct lt_elem *parent, struct lt_elem *child);
 
 
 /**
@@ -309,7 +300,7 @@ extern struct lt_elem *lt_elem_list_first(struct link_table *table, uint64_t id)
  * Note that this will return NULL if 'elem' is actually the end of the list.
  */
 extern struct lt_elem *lt_elem_list_next(struct link_table *table,
-                                        struct lt_elem *elem);
+    struct lt_elem *elem);
 
 
 /**
@@ -320,7 +311,7 @@ extern struct lt_elem *lt_elem_list_next(struct link_table *table,
  * (which could be NULL)
  */
 extern struct lt_elem *lt_elem_list_break(struct link_table *table,
-                                         struct lt_elem *elem);
+    struct lt_elem *elem);
 
 
 /**
@@ -333,7 +324,7 @@ extern struct lt_elem *lt_elem_list_break(struct link_table *table,
  * is still left invalid.
  */
 extern struct lt_elem *lt_elem_list_pop(struct link_table *table,
-                                       uint64_t *id, int type);
+    uint64_t *id, int type);
 
 
 /**
@@ -344,11 +335,12 @@ extern struct lt_elem *lt_elem_list_pop(struct link_table *table,
  * kernels to assert that all elements on the list are of the given type.
  */
 extern int lt_elem_list_release(struct link_table *table,
-                               struct lt_elem *head,
-                               int __assert_only type);
+    struct lt_elem *head,
+    int __assert_only type);
 
-static inline int lt_elem_list_release_id(struct link_table *table,
-                                         uint64_t id, int type)
+static inline int
+lt_elem_list_release_id(struct link_table *table,
+    uint64_t id, int type)
 {
        return lt_elem_list_release(table, lt_elem_list_first(table, id), type);
 }