Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ocs_ramlog.c File Reference
#include "ocs.h"

Go to the source code of this file.

Detailed Description

RAM buffer logging code

Definition in file ocs_ramlog.c.

Data Structures

struct  ocs_ramlog_t
 

Functions

static uint32_t ocs_ramlog_next_idx (ocs_ramlog_t *ramlog, uint32_t idx)
 Return next ramlog buffer index. More...
 
ocs_ramlog_t * ocs_ramlog_init (ocs_t *ocs, uint32_t buffer_len, uint32_t buffer_count)
 Allocate a ramlog buffer. More...
 
void ocs_ramlog_free (ocs_t *ocs, ocs_ramlog_t *ramlog)
 Free a ramlog buffer. More...
 
void ocs_ramlog_clear (ocs_t *ocs, ocs_ramlog_t *ramlog, int clear_start_of_day, int clear_recent)
 Clear a ramlog buffer. More...
 
int32_t ocs_ramlog_printf (void *os, const char *fmt,...)
 Append formatted printf data to a ramlog buffer. More...
 
int32_t ocs_ramlog_vprintf (ocs_ramlog_t *ramlog, const char *fmt, va_list ap)
 Append formatted text to a ramlog using variable arguments. More...
 
int32_t ocs_ddump_ramlog (ocs_textbuf_t *textbuf, ocs_ramlog_t *ramlog)
 Perform ramlog buffer driver dump. More...
 

Function Details

int32_t ocs_ddump_ramlog ( ocs_textbuf_t *  textbuf,
ocs_ramlog_t *  ramlog 
)

Perform ramlog buffer driver dump.

The RAM logging buffer is appended to the driver dump data.

Parameters
textbufPointer to the driver dump text buffer.
ramlogPointer to the RAM logging buffer.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 266 of file ocs_ramlog.c.

void ocs_ramlog_clear ( ocs_t *  ocs,
ocs_ramlog_t *  ramlog,
int  clear_start_of_day,
int  clear_recent 
)

Clear a ramlog buffer.

The text in the start of day and/or recent ramlog text buffers is cleared.

Parameters
ocsPointer to driver structure.
ramlogPointer to RAM logging buffer structure.
clear_start_of_dayClear the start of day (driver init) portion of the ramlog.
clear_recentClear the recent messages portion of the ramlog.
Returns
None.

Definition at line 148 of file ocs_ramlog.c.

void ocs_ramlog_free ( ocs_t *  ocs,
ocs_ramlog_t *  ramlog 
)

Free a ramlog buffer.

A previously allocated RAM logging buffer is freed.

Parameters
ocsPointer to driver structure.
ramlogPointer to RAM logging buffer structure.
Returns
None.

Definition at line 116 of file ocs_ramlog.c.

ocs_ramlog_t* ocs_ramlog_init ( ocs_t *  ocs,
uint32_t  buffer_len,
uint32_t  buffer_count 
)

Allocate a ramlog buffer.

Initialize a RAM logging buffer with text buffers totalling buffer_len.

Parameters
ocsPointer to driver structure.
buffer_lenTotal length of RAM log buffers.
buffer_countNumber of text buffers to allocate (totalling buffer-len).
Returns
Returns pointer to ocs_ramlog_t instance, or NULL.

Definition at line 65 of file ocs_ramlog.c.

static uint32_t ocs_ramlog_next_idx ( ocs_ramlog_t *  ramlog,
uint32_t  idx 
)
static

Return next ramlog buffer index.

Given a RAM logging buffer index, return the next index.

Parameters
ramlogPointer to RAM logging buffer.
idxIndex value.
Returns
Returns next index value.

Definition at line 243 of file ocs_ramlog.c.

int32_t ocs_ramlog_printf ( void *  os,
const char *  fmt,
  ... 
)

Append formatted printf data to a ramlog buffer.

Formatted data is appended to a RAM logging buffer.

Parameters
osPointer to driver structure.
fmtPointer to printf style format specifier.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 179 of file ocs_ramlog.c.

int32_t ocs_ramlog_vprintf ( ocs_ramlog_t *  ramlog,
const char *  fmt,
va_list  ap 
)

Append formatted text to a ramlog using variable arguments.

Formatted data is appended to the RAM logging buffer, using variable arguments.

Parameters
ramlogPointer to RAM logging buffer.
fmtPointer to printf style formatting string.
apVariable argument pointer.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 209 of file ocs_ramlog.c.