FreeBSD kernel kern code
|
#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>
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} |
#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.
local int destroy | ( | gz_stream * | s | ) |
Definition at line 185 of file kern_gzio.c.
References TRYFREE.
Referenced by gz_open(), and gzclose().
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().
|
static |
Definition at line 393 of file kern_gzio.c.
Referenced by gz_open().
|
static |
Definition at line 402 of file kern_gzio.c.
Referenced by gz_open().
gzFile gz_open | ( | char * | path, |
const char * | mode, | ||
struct vnode * | vp | ||
) | const |
Definition at line 88 of file kern_gzio.c.
References ALLOC, buf, gz_stream::crc, destroy(), gz_stream::file, gz_stream::flags, gz_alloc(), gz_free(), GZ_HEADER_LEN, gz_magic, gz_stream::inbuf, level, log(), gz_stream::mode, mode, gz_stream::msg, gz_stream::outbuf, gz_stream::outoff, gz_stream::path, snprintf(), gz_stream::startpos, gz_stream::stream, gz_stream::transparent, vn_rdwr(), Z_BUFSIZE, gz_stream::z_eof, and gz_stream::z_err.
Referenced by coredump().
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().
int ZEXPORT gzflush | ( | gzFile | file, |
int | flush | ||
) |
Definition at line 324 of file kern_gzio.c.
References do_flush(), and gz_stream::z_err.
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.
local int do_flush OF | ( | (gzFile file, int flush) | ) |
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().
|
static |
Definition at line 45 of file kern_gzio.c.
Referenced by gz_open().