Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

Scratch Buffer

Scratch Buffer Functions. More...

Defines

#define STP_BUF_LEN   8191
 Maximum size of buffer, not including terminating NULL.

Functions

void _stp_sprint (const char *fmt,...)
 Sprint into the scratch buffer.
void _stp_sprint_str (const char *str)
 Write a string into the scratch buffer.
char * _stp_scbuf_clear (void)
 Clear the scratch buffer.

Detailed Description

Scratch Buffer Functions.

The scratch buffer is for collecting output before storing in a map, printing, etc. This is a per-cpu static buffer. It is necessary because of the limited stack space available in the kernel.

Todo:
Need careful review of these to insure safety.

Function Documentation

char* _stp_scbuf_clear void   ) 
 

Clear the scratch buffer.

This function should be called before anything is written to the scratch buffer. Output will accumulate in the buffer until this function is called again.

Returns:
A pointer to the buffer.

Definition at line 74 of file scbuf.c.

References STP_BUF_LEN.

void _stp_sprint const char *  fmt,
  ...
 

Sprint into the scratch buffer.

Like printf, except output goes into a global scratch buffer which will contain the null-terminated output. Safe because overflowing the buffer is not allowed. Size is limited by length of scratch buffer, STP_BUF_LEN.

Parameters:
fmt A printf-style format string followed by a variable number of args.
See also:
_stp_scbuf_clear

Definition at line 34 of file scbuf.c.

References STP_BUF_LEN.

Referenced by _stp_symbol_sprint().

void _stp_sprint_str const char *  str  ) 
 

Write a string into the scratch buffer.

Copies a string into a global scratch buffer. Safe because overflowing the buffer is not allowed. Size is limited by length of scratch buffer, STP_BUF_LEN. This is more efficient than using _stp_sprint().

Parameters:
str A string.

Definition at line 56 of file scbuf.c.

References STP_BUF_LEN.