linux/include/linux/list_bl.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _LINUX_LIST_BL_H
#define _LINUX_LIST_BL_H

#include <linux/list.h>
#include <linux/bit_spinlock.h>

/*
 * Special version of lists, where head of the list has a lock in the lowest
 * bit. This is useful for scalable hash tables without increasing memory
 * footprint overhead.
 *
 * For modification operations, the 0 bit of hlist_bl_head->first
 * pointer must be set.
 *
 * With some small modifications, this can easily be adapted to store several
 * arbitrary bits (not just a single lock bit), if the need arises to store
 * some fast and compact auxiliary data.
 */

#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
#define LIST_BL_LOCKMASK
#else
#define LIST_BL_LOCKMASK
#endif

#ifdef CONFIG_DEBUG_LIST
#define LIST_BL_BUG_ON(x)
#else
#define LIST_BL_BUG_ON
#endif


struct hlist_bl_head {};

struct hlist_bl_node {};
#define INIT_HLIST_BL_HEAD(ptr)

static inline void INIT_HLIST_BL_NODE(struct hlist_bl_node *h)
{}

#define hlist_bl_entry(ptr, type, member)

static inline bool  hlist_bl_unhashed(const struct hlist_bl_node *h)
{}

static inline struct hlist_bl_node *hlist_bl_first(struct hlist_bl_head *h)
{}

static inline void hlist_bl_set_first(struct hlist_bl_head *h,
					struct hlist_bl_node *n)
{}

static inline bool hlist_bl_empty(const struct hlist_bl_head *h)
{}

static inline void hlist_bl_add_head(struct hlist_bl_node *n,
					struct hlist_bl_head *h)
{}

static inline void hlist_bl_add_before(struct hlist_bl_node *n,
				       struct hlist_bl_node *next)
{}

static inline void hlist_bl_add_behind(struct hlist_bl_node *n,
				       struct hlist_bl_node *prev)
{}

static inline void __hlist_bl_del(struct hlist_bl_node *n)
{}

static inline void hlist_bl_del(struct hlist_bl_node *n)
{}

static inline void hlist_bl_del_init(struct hlist_bl_node *n)
{}

static inline void hlist_bl_lock(struct hlist_bl_head *b)
{}

static inline void hlist_bl_unlock(struct hlist_bl_head *b)
{}

static inline bool hlist_bl_is_locked(struct hlist_bl_head *b)
{}

/**
 * hlist_bl_for_each_entry	- iterate over list of given type
 * @tpos:	the type * to use as a loop cursor.
 * @pos:	the &struct hlist_node to use as a loop cursor.
 * @head:	the head for your list.
 * @member:	the name of the hlist_node within the struct.
 *
 */
#define hlist_bl_for_each_entry(tpos, pos, head, member)

/**
 * hlist_bl_for_each_entry_safe - iterate over list of given type safe against removal of list entry
 * @tpos:	the type * to use as a loop cursor.
 * @pos:	the &struct hlist_node to use as a loop cursor.
 * @n:		another &struct hlist_node to use as temporary storage
 * @head:	the head for your list.
 * @member:	the name of the hlist_node within the struct.
 */
#define hlist_bl_for_each_entry_safe(tpos, pos, n, head, member)

#endif