From b5fd066153c40a70a29caa1ea7987723ab687763 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Tue, 16 Jan 2024 17:00:02 -0500 Subject: Move c_src dirs back to toplevel We just wanted c sourcefiles out of the top level, not c source directories. Signed-off-by: Kent Overstreet --- c_src/include/linux/idr.h | 208 ---------------------------------------------- 1 file changed, 208 deletions(-) delete mode 100644 c_src/include/linux/idr.h (limited to 'c_src/include/linux/idr.h') diff --git a/c_src/include/linux/idr.h b/c_src/include/linux/idr.h deleted file mode 100644 index 6f928254..00000000 --- a/c_src/include/linux/idr.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - * include/linux/idr.h - * - * 2002-10-18 written by Jim Houston jim.houston@ccur.com - * Copyright (C) 2002 by Concurrent Computer Corporation - * Distributed under the GNU GPL license version 2. - * - * Small id to pointer translation service avoiding fixed sized - * tables. - */ - -#ifndef __IDR_H__ -#define __IDR_H__ - -#include -#include -#include -#include -#include -#include - -/* - * We want shallower trees and thus more bits covered at each layer. 8 - * bits gives us large enough first layer for most use cases and maximum - * tree depth of 4. Each idr_layer is slightly larger than 2k on 64bit and - * 1k on 32bit. - */ -#define IDR_BITS 8 -#define IDR_SIZE (1 << IDR_BITS) -#define IDR_MASK ((1 << IDR_BITS)-1) - -struct idr_layer { - int prefix; /* the ID prefix of this idr_layer */ - int layer; /* distance from leaf */ - struct idr_layer __rcu *ary[1<hint); - - if (hint && (id & ~IDR_MASK) == hint->prefix) - return rcu_dereference_raw(hint->ary[id & IDR_MASK]); - - return idr_find_slowpath(idr, id); -} - -/** - * idr_for_each_entry - iterate over an idr's elements of a given type - * @idp: idr handle - * @entry: the type * to use as cursor - * @id: id entry's key - * - * @entry and @id do not need to be initialized before the loop, and - * after normal terminatinon @entry is left with the value NULL. This - * is convenient for a "not found" value. - */ -#define idr_for_each_entry(idp, entry, id) \ - for (id = 0; ((entry) = idr_get_next(idp, &(id))) != NULL; ++id) - -/** - * idr_for_each_entry - continue iteration over an idr's elements of a given type - * @idp: idr handle - * @entry: the type * to use as cursor - * @id: id entry's key - * - * Continue to iterate over list of given type, continuing after - * the current position. - */ -#define idr_for_each_entry_continue(idp, entry, id) \ - for ((entry) = idr_get_next((idp), &(id)); \ - entry; \ - ++id, (entry) = idr_get_next((idp), &(id))) - -/* - * IDA - IDR based id allocator, use when translation from id to - * pointer isn't necessary. - * - * IDA_BITMAP_LONGS is calculated to be one less to accommodate - * ida_bitmap->nr_busy so that the whole struct fits in 128 bytes. - */ -#define IDA_CHUNK_SIZE 128 /* 128 bytes per chunk */ -#define IDA_BITMAP_LONGS (IDA_CHUNK_SIZE / sizeof(long) - 1) -#define IDA_BITMAP_BITS (IDA_BITMAP_LONGS * sizeof(long) * 8) - -struct ida_bitmap { - long nr_busy; - unsigned long bitmap[IDA_BITMAP_LONGS]; -}; - -struct ida { - struct idr idr; - struct ida_bitmap *free_bitmap; -}; - -#define IDA_INIT(name) { .idr = IDR_INIT((name).idr), .free_bitmap = NULL, } -#define DEFINE_IDA(name) struct ida name = IDA_INIT(name) - -int ida_pre_get(struct ida *ida, gfp_t gfp_mask); -int ida_get_new_above(struct ida *ida, int starting_id, int *p_id); -void ida_remove(struct ida *ida, int id); -void ida_destroy(struct ida *ida); -void ida_init(struct ida *ida); - -int ida_simple_get(struct ida *ida, unsigned int start, unsigned int end, - gfp_t gfp_mask); -void ida_simple_remove(struct ida *ida, unsigned int id); - -/** - * ida_get_new - allocate new ID - * @ida: idr handle - * @p_id: pointer to the allocated handle - * - * Simple wrapper around ida_get_new_above() w/ @starting_id of zero. - */ -static inline int ida_get_new(struct ida *ida, int *p_id) -{ - return ida_get_new_above(ida, 0, p_id); -} - -void __init idr_init_cache(void); - -#endif /* __IDR_H__ */ -- cgit v1.2.3