FreeBSD kernel kern code
kern_gzio.c File Reference
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/malloc.h>
#include <sys/vnode.h>
#include <sys/syslog.h>
#include <sys/endian.h>
#include <net/zutil.h>
#include <sys/libkern.h>
#include <sys/mount.h>
Include dependency graph for kern_gzio.c:

Go to the source code of this file.

Data Structures

struct  gz_stream
 

Macros

#define GZ_HEADER_LEN   10
 
#define Z_BUFSIZE   16384
 
#define Z_PRINTF_BUFSIZE   4096
 
#define ALLOC(size)   malloc(size, M_TEMP, M_WAITOK | M_ZERO)
 
#define TRYFREE(p)   {if (p) free(p, M_TEMP);}
 
#define ASCII_FLAG   0x01 /* bit 0 set: file probably ascii text */
 
#define HEAD_CRC   0x02 /* bit 1 set: header CRC present */
 
#define EXTRA_FIELD   0x04 /* bit 2 set: extra field present */
 
#define ORIG_NAME   0x08 /* bit 3 set: original file name present */
 
#define COMMENT   0x10 /* bit 4 set: file comment present */
 
#define RESERVED   0xE0 /* bits 5..7: reserved */
 

Typedefs

typedef struct gz_stream gz_stream
 

Functions

local int do_flush OF ((gzFile file, int flush))
 
local int destroy OF ((gz_stream *s))
 
local void putU32 OF ((gz_stream *file, uint32_t x))
 
local void *gz_alloc OF ((void *notused, u_int items, u_int size))
 
local void gz_free OF ((void *notused, void *ptr))
 
gzFile gz_open (char *path, const char *mode, struct vnode *vp) const
 
local int destroy (gz_stream *s)
 
int ZEXPORT gzwrite (gzFile file, const voidp buf, unsigned len)
 
local int do_flush (gzFile file, int flush)
 
int ZEXPORT gzflush (gzFile file, int flush)
 
local void putU32 (gz_stream *s, uint32_t x)
 
int ZEXPORT gzclose (gzFile file)
 
static void * gz_alloc (void *notused __unused, u_int items, u_int size)
 
static void gz_free (void *opaque __unused, void *ptr)
 

Variables

static int gz_magic [2] = {0x1f, 0x8b}
 

Macro Definition Documentation

#define ALLOC (   size)    malloc(size, M_TEMP, M_WAITOK | M_ZERO)

Definition at line 42 of file kern_gzio.c.

Referenced by gz_open().

#define ASCII_FLAG   0x01 /* bit 0 set: file probably ascii text */

Definition at line 48 of file kern_gzio.c.

#define COMMENT   0x10 /* bit 4 set: file comment present */

Definition at line 52 of file kern_gzio.c.

#define EXTRA_FIELD   0x04 /* bit 2 set: extra field present */

Definition at line 50 of file kern_gzio.c.

#define GZ_HEADER_LEN   10

Definition at line 29 of file kern_gzio.c.

Referenced by gz_open().

#define HEAD_CRC   0x02 /* bit 1 set: header CRC present */

Definition at line 49 of file kern_gzio.c.

#define ORIG_NAME   0x08 /* bit 3 set: original file name present */

Definition at line 51 of file kern_gzio.c.

#define RESERVED   0xE0 /* bits 5..7: reserved */

Definition at line 53 of file kern_gzio.c.

#define TRYFREE (   p)    {if (p) free(p, M_TEMP);}

Definition at line 43 of file kern_gzio.c.

Referenced by destroy().

#define Z_BUFSIZE   16384

Definition at line 35 of file kern_gzio.c.

Referenced by do_flush(), gz_open(), and gzwrite().

#define Z_PRINTF_BUFSIZE   4096

Definition at line 39 of file kern_gzio.c.

Typedef Documentation

typedef struct gz_stream gz_stream

Function Documentation

local int destroy ( gz_stream s)

Definition at line 185 of file kern_gzio.c.

References TRYFREE.

Referenced by gz_open(), and gzclose().

Here is the caller graph for this function:

local int do_flush ( gzFile  file,
int  flush 
)

Definition at line 268 of file kern_gzio.c.

References gz_stream::file, log(), gz_stream::mode, gz_stream::outbuf, gz_stream::outoff, gz_stream::stream, vn_rdwr_inchunks(), Z_BUFSIZE, and gz_stream::z_err.

Referenced by gzclose(), and gzflush().

Here is the call graph for this function:

Here is the caller graph for this function:

static void* gz_alloc ( void *notused  __unused,
u_int  items,
u_int  size 
)
static

Definition at line 393 of file kern_gzio.c.

Referenced by gz_open().

Here is the caller graph for this function:

static void gz_free ( void *opaque  __unused,
void *  ptr 
)
static

Definition at line 402 of file kern_gzio.c.

Referenced by gz_open().

Here is the caller graph for this function:

gzFile gz_open ( char *  path,
const char *  mode,
struct vnode *  vp 
) const
int ZEXPORT gzclose ( gzFile  file)

Definition at line 363 of file kern_gzio.c.

References gz_stream::crc, destroy(), do_flush(), log(), gz_stream::mode, printf(), putU32(), and gz_stream::stream.

Referenced by coredump().

Here is the call graph for this function:

Here is the caller graph for this function:

int ZEXPORT gzflush ( gzFile  file,
int  flush 
)

Definition at line 324 of file kern_gzio.c.

References do_flush(), and gz_stream::z_err.

Here is the call graph for this function:

int ZEXPORT gzwrite ( gzFile  file,
const voidp  buf,
unsigned  len 
)

Definition at line 213 of file kern_gzio.c.

References gz_stream::crc, gz_stream::file, log(), gz_stream::mode, gz_stream::outbuf, gz_stream::outoff, gz_stream::stream, vn_rdwr_inchunks(), Z_BUFSIZE, and gz_stream::z_err.

Here is the call graph for this function:

local int do_flush OF ( (gzFile file, int flush)  )
local int destroy OF ( (gz_stream *s)  )
local void putU32 OF ( (gz_stream *file, uint32_t x)  )
local void* gz_alloc OF ( (void *notused, u_int items, u_int size)  )
local void gz_free OF ( (void *notused, void *ptr)  )
local void putU32 ( gz_stream s,
uint32_t  x 
)

Definition at line 339 of file kern_gzio.c.

References gz_stream::outoff, and vn_rdwr().

Referenced by gzclose().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

int gz_magic[2] = {0x1f, 0x8b}
static

Definition at line 45 of file kern_gzio.c.

Referenced by gz_open().