drivers/firmware/efi/libstub/vsprintf.c
Source file repositories/reference/linux-study-clean/drivers/firmware/efi/libstub/vsprintf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/firmware/efi/libstub/vsprintf.c- Extension
.c- Size
- 12109 bytes
- Lines
- 565
- Domain
- Driver Families
- Bucket
- drivers/firmware
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
Dependency Surface
linux/stdarg.hlinux/compiler.hlinux/ctype.hlinux/kernel.hlinux/limits.hlinux/string.hlinux/types.h
Detected Declarations
function Copyrightfunction roundfunction put_dec_helper4function get_flagsfunction get_intfunction get_numberfunction get_signfunction utf16s_utf8nlenfunction utf16_to_utf32function vsnprintffunction snprintf
Annotated Snippet
switch (**fmt) {
case '-':
flags |= LEFT;
break;
case '+':
flags |= PLUS;
break;
case ' ':
flags |= SPACE;
break;
case '#':
flags |= SPECIAL;
break;
case '0':
flags |= ZEROPAD;
break;
default:
return flags;
}
++(*fmt);
} while (1);
}
static
int get_int(const char **fmt, va_list *ap)
{
if (isdigit(**fmt))
return skip_atoi(fmt);
if (**fmt == '*') {
++(*fmt);
/* it's the next argument */
return va_arg(*ap, int);
}
return 0;
}
static
unsigned long long get_number(int sign, int qualifier, va_list *ap)
{
if (sign) {
switch (qualifier) {
case 'L':
return va_arg(*ap, long long);
case 'l':
return va_arg(*ap, long);
case 'h':
return (short)va_arg(*ap, int);
case 'H':
return (signed char)va_arg(*ap, int);
default:
return va_arg(*ap, int);
};
} else {
switch (qualifier) {
case 'L':
return va_arg(*ap, unsigned long long);
case 'l':
return va_arg(*ap, unsigned long);
case 'h':
return (unsigned short)va_arg(*ap, int);
case 'H':
return (unsigned char)va_arg(*ap, int);
default:
return va_arg(*ap, unsigned int);
}
}
}
static
char get_sign(long long *num, int flags)
{
if (!(flags & SIGN))
return 0;
if (*num < 0) {
*num = -(*num);
return '-';
}
if (flags & PLUS)
return '+';
if (flags & SPACE)
return ' ';
return 0;
}
static
size_t utf16s_utf8nlen(const u16 *s16, size_t maxlen)
{
size_t len, clen;
for (len = 0; len < maxlen && *s16; len += clen) {
Annotation
- Immediate include surface: `linux/stdarg.h`, `linux/compiler.h`, `linux/ctype.h`, `linux/kernel.h`, `linux/limits.h`, `linux/string.h`, `linux/types.h`.
- Detected declarations: `function Copyright`, `function round`, `function put_dec_helper4`, `function get_flags`, `function get_int`, `function get_number`, `function get_sign`, `function utf16s_utf8nlen`, `function utf16_to_utf32`, `function vsnprintf`.
- Atlas domain: Driver Families / drivers/firmware.
- 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.