#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__)
* enforce a particular memory layout
*/
uint64_t idx:18, /* allows indexing up to 8MB of 32byte objects */
- generation:46;
+ generation:46;
};
};
};
};
/* 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)
#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);
/**
*/
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
* 'type'.
*/
extern void ltable_realloc_elem(struct link_table *table,
- struct lt_elem *elem, int type);
+ struct lt_elem *elem, int type);
/**
* 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);
/**
* 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);
/**
* (which could be NULL)
*/
extern struct lt_elem *lt_elem_list_break(struct link_table *table,
- struct lt_elem *elem);
+ struct lt_elem *elem);
/**
* 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);
/**
* 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);
}