Chapter 2. Basic C Library Functions

Table of Contents

String Conversions
String Manipulation
Bit Operations

When writing drivers, you cannot in general use routines which are from the C Library. Some of the functions have been found generally useful and they are listed below. The behaviour of these functions may vary slightly from those defined by ANSI, and these deviations are noted in the text.

String Conversions

simple_strtoull — convert a string to an unsigned long long
simple_strtoul — convert a string to an unsigned long
simple_strtol — convert a string to a signed long
simple_strtoll — convert a string to a signed long long
vsnprintf — Format a string and place it in a buffer
vscnprintf — Format a string and place it in a buffer
snprintf — Format a string and place it in a buffer
scnprintf — Format a string and place it in a buffer
vsprintf — Format a string and place it in a buffer
sprintf — Format a string and place it in a buffer
vbin_printf — Parse a format string and place args' binary value in a buffer
bstr_printf — Format a string from binary arguments and place it in a buffer
bprintf — Parse a format string and place args' binary value in a buffer
vsscanf — Unformat a buffer into a list of arguments
sscanf — Unformat a buffer into a list of arguments
kstrtol — convert a string to a long
kstrtoul — convert a string to an unsigned long
kstrtoull — convert a string to an unsigned long long
kstrtoll — convert a string to a long long
kstrtouint — convert a string to an unsigned int
kstrtoint — convert a string to an int