Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
vsprintf.c File Reference
#include <stdarg.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/ctype.h>
#include <linux/kernel.h>
#include <linux/kallsyms.h>
#include <linux/uaccess.h>
#include <linux/ioport.h>
#include <net/addrconf.h>
#include <asm/page.h>
#include <asm/div64.h>
#include <asm/sections.h>
#include "kstrtox.h"

Go to the source code of this file.

Data Structures

struct  printf_spec
 

Macros

#define ZEROPAD   1 /* pad with zero */
 
#define SIGN   2 /* unsigned/signed long */
 
#define PLUS   4 /* show plus */
 
#define SPACE   8 /* space if plus */
 
#define LEFT   16 /* left justified */
 
#define SMALL   32 /* use lowercase in hex (must be 32 == 0x20) */
 
#define SPECIAL   64 /* prefix hex with "0x", octal with "0" */
 
#define IO_RSRC_PRINTK_SIZE   6
 
#define MEM_RSRC_PRINTK_SIZE   10
 
#define RSRC_BUF_SIZE   ((2 * sizeof(resource_size_t)) + 4)
 
#define FLAG_BUF_SIZE   (2 * sizeof(res->flags))
 
#define DECODED_BUF_SIZE   sizeof("[mem - 64bit pref window disabled]")
 
#define RAW_BUF_SIZE   sizeof("[mem - flags 0x]")
 

Enumerations

enum  format_type {
  FORMAT_TYPE_NONE, FORMAT_TYPE_WIDTH, FORMAT_TYPE_PRECISION, FORMAT_TYPE_CHAR,
  FORMAT_TYPE_STR, FORMAT_TYPE_PTR, FORMAT_TYPE_PERCENT_CHAR, FORMAT_TYPE_INVALID,
  FORMAT_TYPE_LONG_LONG, FORMAT_TYPE_ULONG, FORMAT_TYPE_LONG, FORMAT_TYPE_UBYTE,
  FORMAT_TYPE_BYTE, FORMAT_TYPE_USHORT, FORMAT_TYPE_SHORT, FORMAT_TYPE_UINT,
  FORMAT_TYPE_INT, FORMAT_TYPE_NRCHARS, FORMAT_TYPE_SIZE_T, FORMAT_TYPE_PTRDIFF
}
 

Functions

unsigned long long simple_strtoull (const char *cp, char **endp, unsigned int base)
 
 EXPORT_SYMBOL (simple_strtoull)
 
unsigned long simple_strtoul (const char *cp, char **endp, unsigned int base)
 
 EXPORT_SYMBOL (simple_strtoul)
 
long simple_strtol (const char *cp, char **endp, unsigned int base)
 
 EXPORT_SYMBOL (simple_strtol)
 
long long simple_strtoll (const char *cp, char **endp, unsigned int base)
 
 EXPORT_SYMBOL (simple_strtoll)
 
int num_to_str (char *buf, int size, unsigned long long num)
 
int vsnprintf (char *buf, size_t size, const char *fmt, va_list args)
 
 EXPORT_SYMBOL (vsnprintf)
 
int vscnprintf (char *buf, size_t size, const char *fmt, va_list args)
 
 EXPORT_SYMBOL (vscnprintf)
 
int snprintf (char *buf, size_t size, const char *fmt,...)
 
 EXPORT_SYMBOL (snprintf)
 
int scnprintf (char *buf, size_t size, const char *fmt,...)
 
 EXPORT_SYMBOL (scnprintf)
 
int vsprintf (char *buf, const char *fmt, va_list args)
 
 EXPORT_SYMBOL (vsprintf)
 
int sprintf (char *buf, const char *fmt,...)
 
 EXPORT_SYMBOL (sprintf)
 
int vsscanf (const char *buf, const char *fmt, va_list args)
 
 EXPORT_SYMBOL (vsscanf)
 
int sscanf (const char *buf, const char *fmt,...)
 
 EXPORT_SYMBOL (sscanf)
 

Variables

int kptr_restrict __read_mostly
 

Macro Definition Documentation

#define DECODED_BUF_SIZE   sizeof("[mem - 64bit pref window disabled]")
#define FLAG_BUF_SIZE   (2 * sizeof(res->flags))
#define IO_RSRC_PRINTK_SIZE   6
#define LEFT   16 /* left justified */

Definition at line 335 of file vsprintf.c.

#define MEM_RSRC_PRINTK_SIZE   10
#define PLUS   4 /* show plus */

Definition at line 333 of file vsprintf.c.

#define RAW_BUF_SIZE   sizeof("[mem - flags 0x]")
#define RSRC_BUF_SIZE   ((2 * sizeof(resource_size_t)) + 4)
#define SIGN   2 /* unsigned/signed long */

Definition at line 332 of file vsprintf.c.

#define SMALL   32 /* use lowercase in hex (must be 32 == 0x20) */

Definition at line 336 of file vsprintf.c.

#define SPACE   8 /* space if plus */

Definition at line 334 of file vsprintf.c.

#define SPECIAL   64 /* prefix hex with "0x", octal with "0" */

Definition at line 337 of file vsprintf.c.

#define ZEROPAD   1 /* pad with zero */

Definition at line 331 of file vsprintf.c.

Enumeration Type Documentation

Enumerator:
FORMAT_TYPE_NONE 
FORMAT_TYPE_WIDTH 
FORMAT_TYPE_PRECISION 
FORMAT_TYPE_CHAR 
FORMAT_TYPE_STR 
FORMAT_TYPE_PTR 
FORMAT_TYPE_PERCENT_CHAR 
FORMAT_TYPE_INVALID 
FORMAT_TYPE_LONG_LONG 
FORMAT_TYPE_ULONG 
FORMAT_TYPE_LONG 
FORMAT_TYPE_UBYTE 
FORMAT_TYPE_BYTE 
FORMAT_TYPE_USHORT 
FORMAT_TYPE_SHORT 
FORMAT_TYPE_UINT 
FORMAT_TYPE_INT 
FORMAT_TYPE_NRCHARS 
FORMAT_TYPE_SIZE_T 
FORMAT_TYPE_PTRDIFF 

Definition at line 339 of file vsprintf.c.

Function Documentation

EXPORT_SYMBOL ( simple_strtoull  )
EXPORT_SYMBOL ( simple_strtoul  )
EXPORT_SYMBOL ( simple_strtol  )
EXPORT_SYMBOL ( simple_strtoll  )
EXPORT_SYMBOL ( vsnprintf  )
EXPORT_SYMBOL ( vscnprintf  )
EXPORT_SYMBOL ( snprintf  )
EXPORT_SYMBOL ( scnprintf  )
EXPORT_SYMBOL ( vsprintf  )
EXPORT_SYMBOL ( sprintf  )
EXPORT_SYMBOL ( vsscanf  )
EXPORT_SYMBOL ( sscanf  )
int num_to_str ( char buf,
int  size,
unsigned long long  num 
)

Definition at line 311 of file vsprintf.c.

int scnprintf ( char buf,
size_t  size,
const char fmt,
  ... 
)

scnprintf - Format a string and place it in a buffer : The buffer to place the result into : The size of the buffer, including the trailing null space : The format string to use ..: Arguments for the format string

The return value is the number of characters written into not including the trailing '\0'. If is == 0 the function returns 0.

Definition at line 1596 of file vsprintf.c.

long simple_strtol ( const char cp,
char **  endp,
unsigned int  base 
)

simple_strtol - convert a string to a signed long : The start of the string : A pointer to the end of the parsed string will be placed here : The number base to use

Definition at line 77 of file vsprintf.c.

long long simple_strtoll ( const char cp,
char **  endp,
unsigned int  base 
)

simple_strtoll - convert a string to a signed long long : The start of the string : A pointer to the end of the parsed string will be placed here : The number base to use

Definition at line 92 of file vsprintf.c.

unsigned long simple_strtoul ( const char cp,
char **  endp,
unsigned int  base 
)

simple_strtoul - convert a string to an unsigned long : The start of the string : A pointer to the end of the parsed string will be placed here : The number base to use

Definition at line 65 of file vsprintf.c.

unsigned long long simple_strtoull ( const char cp,
char **  endp,
unsigned int  base 
)

simple_strtoull - convert a string to an unsigned long long : The start of the string : A pointer to the end of the parsed string will be placed here : The number base to use

Definition at line 42 of file vsprintf.c.

int snprintf ( char buf,
size_t  size,
const char fmt,
  ... 
)

snprintf - Format a string and place it in a buffer : The buffer to place the result into : The size of the buffer, including the trailing null space : The format string to use ..: Arguments for the format string

The return value is the number of characters which would be generated for the given input, excluding the trailing null, as per ISO C99. If the return is greater than or equal to , the resulting string is truncated.

See the vsnprintf() documentation for format string extensions over C99.

Definition at line 1572 of file vsprintf.c.

int sprintf ( char buf,
const char fmt,
  ... 
)

sprintf - Format a string and place it in a buffer : The buffer to place the result into : The format string to use ..: Arguments for the format string

The function returns the number of characters written into . Use snprintf() or scnprintf() in order to avoid buffer overflows.

See the vsnprintf() documentation for format string extensions over C99.

Definition at line 1641 of file vsprintf.c.

int sscanf ( const char buf,
const char fmt,
  ... 
)

sscanf - Unformat a buffer into a list of arguments : input buffer : formatting of buffer ..: resulting arguments

Definition at line 2228 of file vsprintf.c.

int vscnprintf ( char buf,
size_t  size,
const char fmt,
va_list  args 
)

vscnprintf - Format a string and place it in a buffer : The buffer to place the result into : The size of the buffer, including the trailing null space : The format string to use : Arguments for the format string

The return value is the number of characters which have been written into the not including the trailing '\0'. If is == 0 the function returns 0.

If you're not already dealing with a va_list consider using scnprintf().

See the vsnprintf() documentation for format string extensions over C99.

Definition at line 1544 of file vsprintf.c.

int vsnprintf ( char buf,
size_t  size,
const char fmt,
va_list  args 
)

vsnprintf - Format a string and place it in a buffer : The buffer to place the result into : The size of the buffer, including the trailing null space : The format string to use : Arguments for the format string

This function follows C99 vsnprintf, but has some extensions: pS output the name of a text symbol with offset ps output the name of a text symbol without offset pF output the name of a function pointer with its offset pf output the name of a function pointer without its offset pB output the name of a backtrace symbol with its offset pR output the address range in a struct resource with decoded flags pr output the address range in a struct resource with raw flags pM output a 6-byte MAC address with colons pMR output a 6-byte MAC address with colons in reversed order pMF output a 6-byte MAC address with dashes pm output a 6-byte MAC address without colons pmR output a 6-byte MAC address without colons in reversed order pI4 print an IPv4 address without leading zeros pi4 print an IPv4 address with leading zeros pI6 print an IPv6 address with colons pi6 print an IPv6 address without colons pI6c print an IPv6 address as specified by RFC 5952 pU[bBlL] print a UUID/GUID in big or little endian using lower or upper case. %*ph[CDN] a variable-length hex string with a separator (supports up to 64 bytes of the input) n is ignored

** Please update Documentation/printk-formats.txt when making changes **

The return value is the number of characters which would be generated for the given input, excluding the trailing '\0', as per ISO C99. If you want to have the exact number of characters written into as return value (not including the trailing '\0'), use vscnprintf(). If the return is greater than or equal to , the resulting string is truncated.

If you're not already dealing with a va_list consider using snprintf().

Definition at line 1368 of file vsprintf.c.

int vsprintf ( char buf,
const char fmt,
va_list  args 
)

vsprintf - Format a string and place it in a buffer : The buffer to place the result into : The format string to use : Arguments for the format string

The function returns the number of characters written into . Use vsnprintf() or vscnprintf() in order to avoid buffer overflows.

If you're not already dealing with a va_list consider using sprintf().

See the vsnprintf() documentation for format string extensions over C99.

Definition at line 1623 of file vsprintf.c.

int vsscanf ( const char buf,
const char fmt,
va_list  args 
)

vsscanf - Unformat a buffer into a list of arguments : input buffer : format of buffer : arguments

Definition at line 2009 of file vsprintf.c.

Variable Documentation

int kptr_restrict __read_mostly

Definition at line 969 of file vsprintf.c.