FreeBSD kernel CXGBE device code
fastlz_api.c File Reference
#include <sys/cdefs.h>
#include "osdep.h"
#include "cudbg.h"
#include "cudbg_lib_common.h"
#include "fastlz.h"
Include dependency graph for fastlz_api.c:

Go to the source code of this file.

Macros

#define CUDBG_BLOCK_SIZE   (63*1024)
 
#define CUDBG_CHUNK_BUF_LEN   16
 
#define CUDBG_MIN_COMPR_LEN   32 /*min data length for applying compression*/
 
#define ADLER32_BASE   65521
 

Functions

 __FBSDID ("$FreeBSD$")
 
static unsigned long update_adler32 (unsigned long checksum, const void *buf, int len)
 
int write_magic (struct cudbg_buffer *_out_buff)
 
int write_to_buf (void *out_buf, u32 out_buf_size, u32 *offset, void *in_buf, u32 in_buf_size)
 
int read_from_buf (void *in_buf, u32 in_buf_size, u32 *offset, void *out_buf, u32 out_buf_size)
 
int write_chunk_header (struct cudbg_buffer *_outbuf, int id, int options, unsigned long size, unsigned long checksum, unsigned long extra)
 
int write_compression_hdr (struct cudbg_buffer *pin_buff, struct cudbg_buffer *pout_buff)
 
int compress_buff (struct cudbg_buffer *pin_buff, struct cudbg_buffer *pout_buff)
 
int detect_magic (struct cudbg_buffer *_c_buff)
 
static unsigned long readU16 (const unsigned char *ptr)
 
static unsigned long readU32 (const unsigned char *ptr)
 
int read_chunk_header (struct cudbg_buffer *pc_buff, int *pid, int *poptions, unsigned long *psize, unsigned long *pchecksum, unsigned long *pextra)
 
int validate_buffer (struct cudbg_buffer *compressed_buffer)
 
int decompress_buffer (struct cudbg_buffer *pc_buff, struct cudbg_buffer *pd_buff)
 

Variables

static unsigned char sixpack_magic [8] = {137, '6', 'P', 'K', 13, 10, 26, 10}
 

Macro Definition Documentation

◆ ADLER32_BASE

#define ADLER32_BASE   65521

Definition at line 42 of file fastlz_api.c.

◆ CUDBG_BLOCK_SIZE

#define CUDBG_BLOCK_SIZE   (63*1024)

Definition at line 36 of file fastlz_api.c.

◆ CUDBG_CHUNK_BUF_LEN

#define CUDBG_CHUNK_BUF_LEN   16

Definition at line 37 of file fastlz_api.c.

◆ CUDBG_MIN_COMPR_LEN

#define CUDBG_MIN_COMPR_LEN   32 /*min data length for applying compression*/

Definition at line 38 of file fastlz_api.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ compress_buff()

◆ decompress_buffer()

◆ detect_magic()

int detect_magic ( struct cudbg_buffer _c_buff)

Definition at line 285 of file fastlz_api.c.

References cudbg_buffer::data, cudbg_buffer::offset, read_from_buf(), sixpack_magic, and cudbg_buffer::size.

Referenced by validate_buffer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_chunk_header()

int read_chunk_header ( struct cudbg_buffer pc_buff,
int *  pid,
int *  poptions,
unsigned long *  psize,
unsigned long *  pchecksum,
unsigned long *  pextra 
)

Definition at line 314 of file fastlz_api.c.

References CUDBG_CHUNK_BUF_LEN, cudbg_buffer::data, cudbg_buffer::offset, read_from_buf(), readU16(), readU32(), and cudbg_buffer::size.

Referenced by decompress_buffer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_from_buf()

int read_from_buf ( void *  in_buf,
u32  in_buf_size,
u32 offset,
void *  out_buf,
u32  out_buf_size 
)

Definition at line 103 of file fastlz_api.c.

Referenced by decompress_buffer(), detect_magic(), and read_chunk_header().

Here is the caller graph for this function:

◆ readU16()

static unsigned long readU16 ( const unsigned char *  ptr)
inlinestatic

Definition at line 304 of file fastlz_api.c.

Referenced by read_chunk_header().

Here is the caller graph for this function:

◆ readU32()

static unsigned long readU32 ( const unsigned char *  ptr)
inlinestatic

Definition at line 309 of file fastlz_api.c.

Referenced by decompress_buffer(), and read_chunk_header().

Here is the caller graph for this function:

◆ update_adler32()

static unsigned long update_adler32 ( unsigned long  checksum,
const void *  buf,
int  len 
)
inlinestatic

Definition at line 44 of file fastlz_api.c.

References ADLER32_BASE.

Referenced by compress_buff(), decompress_buffer(), and write_compression_hdr().

Here is the caller graph for this function:

◆ validate_buffer()

int validate_buffer ( struct cudbg_buffer compressed_buffer)

Definition at line 332 of file fastlz_api.c.

References CUDBG_STATUS_INVALID_BUFF, and detect_magic().

Here is the call graph for this function:

◆ write_chunk_header()

int write_chunk_header ( struct cudbg_buffer _outbuf,
int  id,
int  options,
unsigned long  size,
unsigned long  checksum,
unsigned long  extra 
)

Definition at line 114 of file fastlz_api.c.

References CUDBG_CHUNK_BUF_LEN, cudbg_buffer::data, cudbg_buffer::offset, cudbg_buffer::size, and write_to_buf().

Referenced by compress_buff(), and write_compression_hdr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_compression_hdr()

◆ write_magic()

int write_magic ( struct cudbg_buffer _out_buff)

Definition at line 76 of file fastlz_api.c.

References cudbg_buffer::data, cudbg_buffer::offset, sixpack_magic, cudbg_buffer::size, and write_to_buf().

Referenced by write_compression_hdr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_to_buf()

int write_to_buf ( void *  out_buf,
u32  out_buf_size,
u32 offset,
void *  in_buf,
u32  in_buf_size 
)

Definition at line 86 of file fastlz_api.c.

References CUDBG_STATUS_OUTBUFF_OVERFLOW.

Referenced by compress_buff(), decompress_buffer(), write_chunk_header(), write_compression_hdr(), and write_magic().

Here is the caller graph for this function:

Variable Documentation

◆ sixpack_magic

unsigned char sixpack_magic[8] = {137, '6', 'P', 'K', 13, 10, 26, 10}
static

Definition at line 34 of file fastlz_api.c.

Referenced by detect_magic(), and write_magic().