lib/tests/scanf_kunit.c
Source file repositories/reference/linux-study-clean/lib/tests/scanf_kunit.c
File Facts
- System
- Linux kernel
- Corpus path
lib/tests/scanf_kunit.c- Extension
.c- Size
- 30947 bytes
- Lines
- 816
- 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
kunit/test.hlinux/bitops.hlinux/kernel.hlinux/module.hlinux/overflow.hlinux/prandom.hlinux/slab.hlinux/string.h
Detected Declarations
function __scanffunction check_ullfunction check_llfunction check_ulongfunction check_longfunction check_uintfunction check_intfunction check_ushortfunction check_shortfunction check_ucharfunction check_charfunction numbers_simplefunction next_test_randomfunction next_test_random_ullfunction snprintffunction append_delimfunction numbers_list_llfunction numbers_list_lfunction numbers_list_dfunction numbers_list_hfunction numbers_list_hhfunction numbers_listfunction numbers_list_field_width_llfunction numbers_list_field_width_lfunction numbers_list_field_width_dfunction numbers_list_field_width_hfunction numbers_list_field_width_hhfunction numbers_list_field_width_typemaxfunction numbers_list_field_width_val_llfunction numbers_list_field_width_val_lfunction numbers_list_field_width_val_dfunction numbers_list_field_width_val_hfunction numbers_list_field_width_val_hhfunction numbers_list_field_width_val_widthfunction numbers_slicefunction numbers_prefix_overflowfunction test_simple_strtoullfunction test_simple_strtollfunction test_simple_strtoulfunction test_simple_strtolfunction number_delimiter_param_descfunction scanf_suite_initfunction scanf_suite_exit
Annotated Snippet
if (got != *expect) { \
KUNIT_FAIL(test, \
"%s:%d: vsscanf(\"%s\", \"%s\", ...) expected " arg_fmt " got " arg_fmt, \
file, line, str, fmt, *expect, got); \
return; \
} \
} \
} while (0)
static void check_ull(struct kunit *test, const char *file, const int line, const void *check_data,
const char *string, const char *fmt, int n_args, va_list ap)
{
const unsigned long long *pval = check_data;
_check_numbers_template("%llu", pval, string, fmt, n_args, ap);
}
static void check_ll(struct kunit *test, const char *file, const int line, const void *check_data,
const char *string, const char *fmt, int n_args, va_list ap)
{
const long long *pval = check_data;
_check_numbers_template("%lld", pval, string, fmt, n_args, ap);
}
static void check_ulong(struct kunit *test, const char *file, const int line,
const void *check_data, const char *string, const char *fmt, int n_args,
va_list ap)
{
const unsigned long *pval = check_data;
_check_numbers_template("%lu", pval, string, fmt, n_args, ap);
}
static void check_long(struct kunit *test, const char *file, const int line, const void *check_data,
const char *string, const char *fmt, int n_args, va_list ap)
{
const long *pval = check_data;
_check_numbers_template("%ld", pval, string, fmt, n_args, ap);
}
static void check_uint(struct kunit *test, const char *file, const int line, const void *check_data,
const char *string, const char *fmt, int n_args, va_list ap)
{
const unsigned int *pval = check_data;
_check_numbers_template("%u", pval, string, fmt, n_args, ap);
}
static void check_int(struct kunit *test, const char *file, const int line, const void *check_data,
const char *string, const char *fmt, int n_args, va_list ap)
{
const int *pval = check_data;
_check_numbers_template("%d", pval, string, fmt, n_args, ap);
}
static void check_ushort(struct kunit *test, const char *file, const int line,
const void *check_data, const char *string, const char *fmt, int n_args,
va_list ap)
{
const unsigned short *pval = check_data;
_check_numbers_template("%hu", pval, string, fmt, n_args, ap);
}
static void check_short(struct kunit *test, const char *file, const int line,
const void *check_data, const char *string, const char *fmt, int n_args,
va_list ap)
{
const short *pval = check_data;
_check_numbers_template("%hd", pval, string, fmt, n_args, ap);
}
static void check_uchar(struct kunit *test, const char *file, const int line,
const void *check_data, const char *string, const char *fmt, int n_args,
va_list ap)
{
const unsigned char *pval = check_data;
_check_numbers_template("%hhu", pval, string, fmt, n_args, ap);
}
static void check_char(struct kunit *test, const char *file, const int line, const void *check_data,
const char *string, const char *fmt, int n_args, va_list ap)
{
const signed char *pval = check_data;
Annotation
- Immediate include surface: `kunit/test.h`, `linux/bitops.h`, `linux/kernel.h`, `linux/module.h`, `linux/overflow.h`, `linux/prandom.h`, `linux/slab.h`, `linux/string.h`.
- Detected declarations: `function __scanf`, `function check_ull`, `function check_ll`, `function check_ulong`, `function check_long`, `function check_uint`, `function check_int`, `function check_ushort`, `function check_short`, `function check_uchar`.
- 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.