lib/test_bitmap.c
Source file repositories/reference/linux-study-clean/lib/test_bitmap.c
File Facts
- System
- Linux kernel
- Corpus path
lib/test_bitmap.c- Extension
.c- Size
- 47394 bytes
- Lines
- 1568
- Domain
- Kernel Services
- Bucket
- lib
- Inferred role
- Kernel Services: implementation source
- Status
- source implementation candidate
Why This File Exists
Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.
- Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitmap.hlinux/init.hlinux/kernel.hlinux/module.hlinux/printk.hlinux/slab.hlinux/string.hlinux/uaccess.h../tools/testing/selftests/kselftest_module.h
Detected Declarations
struct test_bitmap_parseliststruct test_bitmap_cutstruct test_bitmap_printfunction __check_eq_ulongfunction __check_eq_bitmapfunction __check_eq_pblfunction __check_eq_clump8function __check_eq_strfunction test_zero_clearfunction test_find_nth_bitfunction for_each_set_bitfunction test_fill_setfunction test_copyfunction test_bitmap_regionfunction test_replacefunction test_bitmap_sgfunction test_bitmap_parselistfunction test_bitmap_printlistfunction test_bitmap_parsefunction test_bitmap_arr32function test_bitmap_arr64function test_mem_optimisationsfunction test_for_each_set_clump8function test_for_each_set_bit_wrapfunction test_for_each_set_bitfunction test_for_each_set_bit_fromfunction test_bitmap_weightfunction test_for_each_clear_bitfunction test_for_each_clear_bit_fromfunction test_for_each_set_bitrangefunction test_for_each_clear_bitrangefunction test_for_each_set_bitrange_fromfunction test_for_each_clear_bitrange_fromfunction test_bitmap_cutfunction test_bitmap_print_buffunction test_bitmap_const_evalfunction bitmap_writefunction test_bitmap_read_writefunction test_bitmap_read_perffunction test_bitmap_write_perffunction test_zero_nbitsfunction selftest
Annotated Snippet
struct test_bitmap_parselist{
const int errno;
const char *in;
const unsigned long *expected;
const int nbits;
const int flags;
};
static const struct test_bitmap_parselist parselist_tests[] __initconst = {
#define step (sizeof(u64) / sizeof(unsigned long))
{0, "0", &exp1[0], 8, 0},
{0, "1", &exp1[1 * step], 8, 0},
{0, "0-15", &exp1[2 * step], 32, 0},
{0, "16-31", &exp1[3 * step], 32, 0},
{0, "0-31:1/2", &exp1[4 * step], 32, 0},
{0, "1-31:1/2", &exp1[5 * step], 32, 0},
{0, "0-31:1/4", &exp1[6 * step], 32, 0},
{0, "1-31:1/4", &exp1[7 * step], 32, 0},
{0, "0-31:4/4", &exp1[8 * step], 32, 0},
{0, "1-31:4/4", &exp1[9 * step], 32, 0},
{0, "0-31:1/4,32-63:2/4", &exp1[10 * step], 64, 0},
{0, "0-31:3/4,32-63:4/4", &exp1[11 * step], 64, 0},
{0, " ,, 0-31:3/4 ,, 32-63:4/4 ,, ", &exp1[11 * step], 64, 0},
{0, "0-31:1/4,32-63:2/4,64-95:3/4,96-127:4/4", exp2, 128, 0},
{0, "0-2047:128/256", NULL, 2048, PARSE_TIME},
{0, "", &exp1[12 * step], 8, 0},
{0, "\n", &exp1[12 * step], 8, 0},
{0, ",, ,, , , ,", &exp1[12 * step], 8, 0},
{0, " , ,, , , ", &exp1[12 * step], 8, 0},
{0, " , ,, , , \n", &exp1[12 * step], 8, 0},
{0, "0-0", &exp1[0], 32, 0},
{0, "1-1", &exp1[1 * step], 32, 0},
{0, "15-15", &exp1[13 * step], 32, 0},
{0, "31-31", &exp1[14 * step], 32, 0},
{0, "0-0:0/1", &exp1[12 * step], 32, 0},
{0, "0-0:1/1", &exp1[0], 32, 0},
{0, "0-0:1/31", &exp1[0], 32, 0},
{0, "0-0:31/31", &exp1[0], 32, 0},
{0, "1-1:1/1", &exp1[1 * step], 32, 0},
{0, "0-15:16/31", &exp1[2 * step], 32, 0},
{0, "15-15:1/2", &exp1[13 * step], 32, 0},
{0, "15-15:31/31", &exp1[13 * step], 32, 0},
{0, "15-31:1/31", &exp1[13 * step], 32, 0},
{0, "16-31:16/31", &exp1[3 * step], 32, 0},
{0, "31-31:31/31", &exp1[14 * step], 32, 0},
{0, "N-N", &exp1[14 * step], 32, 0},
{0, "0-0:1/N", &exp1[0], 32, 0},
{0, "0-0:N/N", &exp1[0], 32, 0},
{0, "0-15:16/N", &exp1[2 * step], 32, 0},
{0, "15-15:N/N", &exp1[13 * step], 32, 0},
{0, "15-N:1/N", &exp1[13 * step], 32, 0},
{0, "16-N:16/N", &exp1[3 * step], 32, 0},
{0, "N-N:N/N", &exp1[14 * step], 32, 0},
{0, "0-N:1/3,1-N:1/3,2-N:1/3", &exp1[8 * step], 32, 0},
{0, "0-31:1/3,1-31:1/3,2-31:1/3", &exp1[8 * step], 32, 0},
{0, "1-10:8/12,8-31:24/29,0-31:0/3", &exp1[9 * step], 32, 0},
{0, "all", &exp1[8 * step], 32, 0},
{0, "0, 1, all, ", &exp1[8 * step], 32, 0},
{0, "all:1/2", &exp1[4 * step], 32, 0},
{0, "ALL:1/2", &exp1[4 * step], 32, 0},
{-EINVAL, "al", NULL, 8, 0},
{-EINVAL, "alll", NULL, 8, 0},
{-EINVAL, "-1", NULL, 8, 0},
{-EINVAL, "-0", NULL, 8, 0},
{-EINVAL, "10-1", NULL, 8, 0},
{-ERANGE, "8-8", NULL, 8, 0},
{-ERANGE, "0-31", NULL, 8, 0},
{-EINVAL, "0-31:", NULL, 32, 0},
{-EINVAL, "0-31:0", NULL, 32, 0},
{-EINVAL, "0-31:0/", NULL, 32, 0},
{-EINVAL, "0-31:0/0", NULL, 32, 0},
{-EINVAL, "0-31:1/0", NULL, 32, 0},
{-EINVAL, "0-31:10/1", NULL, 32, 0},
{-EOVERFLOW, "0-98765432123456789:10/1", NULL, 8, 0},
{-EINVAL, "a-31", NULL, 8, 0},
{-EINVAL, "0-a1", NULL, 8, 0},
{-EINVAL, "a-31:10/1", NULL, 8, 0},
{-EINVAL, "0-31:a/1", NULL, 8, 0},
{-EINVAL, "0-\n", NULL, 8, 0},
Annotation
- Immediate include surface: `linux/bitmap.h`, `linux/init.h`, `linux/kernel.h`, `linux/module.h`, `linux/printk.h`, `linux/slab.h`, `linux/string.h`, `linux/uaccess.h`.
- Detected declarations: `struct test_bitmap_parselist`, `struct test_bitmap_cut`, `struct test_bitmap_print`, `function __check_eq_ulong`, `function __check_eq_bitmap`, `function __check_eq_pbl`, `function __check_eq_clump8`, `function __check_eq_str`, `function test_zero_clear`, `function test_find_nth_bit`.
- Atlas domain: Kernel Services / lib.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.