Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
bsd_comp.c File Reference
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/string.h>
#include <linux/ppp_defs.h>
#include <linux/ppp-comp.h>
#include <asm/byteorder.h>

Go to the source code of this file.

Data Structures

struct  bsd_dict
 
struct  bsd_db
 

Macros

#define PACKETPTR   1
 
#define BSD_VERSION(x)   ((x) >> 5)
 
#define BSD_NBITS(x)   ((x) & 0x1F)
 
#define BSD_CURRENT_VERSION   1
 
#define BSD_OVHD   2 /* BSD compress overhead/packet */
 
#define MIN_BSD_BITS   9
 
#define BSD_INIT_BITS   MIN_BSD_BITS
 
#define MAX_BSD_BITS   15
 
#define CLEAR   256 /* table clear output code */
 
#define FIRST   257 /* first free entry */
 
#define LAST   255
 
#define MAXCODE(b)   ((1 << (b)) - 1)
 
#define BADCODEM1   MAXCODE(MAX_BSD_BITS)
 
#define BSD_HASH(prefix, suffix, hshift)
 
#define BSD_KEY(prefix, suffix)
 
#define CHECK_GAP   10000 /* Ratio check interval */
 
#define RATIO_SCALE_LOG   8
 
#define RATIO_SCALE   (1<<RATIO_SCALE_LOG)
 
#define RATIO_MAX   (0x7fffffff>>RATIO_SCALE_LOG)
 
#define dict_ptrx(p, idx)   &(p->dict[idx])
 
#define lens_ptrx(p, idx)   &(p->lens[idx])
 
#define lens_ptr(db, idx)   lens_ptrx(db,idx)
 
#define dict_ptr(db, idx)   dict_ptrx(db,idx)
 
#define PUTBYTE(v)
 
#define OUTPUT(ent)
 

Functions

int ppp_register_compressor (struct compressor *cp)
 
void ppp_unregister_compressor (struct compressor *cp)
 
 module_init (bsdcomp_init)
 
 module_exit (bsdcomp_cleanup)
 
 MODULE_LICENSE ("Dual BSD/GPL")
 
 MODULE_ALIAS ("ppp-compress-"__stringify(CI_BSD_COMPRESS))
 

Macro Definition Documentation

#define BADCODEM1   MAXCODE(MAX_BSD_BITS)

Definition at line 204 of file bsd_comp.c.

#define BSD_CURRENT_VERSION   1

Definition at line 109 of file bsd_comp.c.

#define BSD_HASH (   prefix,
  suffix,
  hshift 
)
Value:
((((unsigned long)(suffix))<<(hshift)) \
^ (unsigned long)(prefix))

Definition at line 206 of file bsd_comp.c.

#define BSD_INIT_BITS   MIN_BSD_BITS

Definition at line 165 of file bsd_comp.c.

#define BSD_KEY (   prefix,
  suffix 
)
Value:
((((unsigned long)(suffix)) << 16) \
+ (unsigned long)(prefix))

Definition at line 208 of file bsd_comp.c.

#define BSD_NBITS (   x)    ((x) & 0x1F)

Definition at line 107 of file bsd_comp.c.

#define BSD_OVHD   2 /* BSD compress overhead/packet */

Definition at line 163 of file bsd_comp.c.

#define BSD_VERSION (   x)    ((x) >> 5)

Definition at line 106 of file bsd_comp.c.

#define CHECK_GAP   10000 /* Ratio check interval */

Definition at line 211 of file bsd_comp.c.

#define CLEAR   256 /* table clear output code */

Definition at line 199 of file bsd_comp.c.

#define dict_ptr (   db,
  idx 
)    dict_ptrx(db,idx)

Definition at line 549 of file bsd_comp.c.

#define dict_ptrx (   p,
  idx 
)    &(p->dict[idx])

Definition at line 523 of file bsd_comp.c.

#define FIRST   257 /* first free entry */

Definition at line 200 of file bsd_comp.c.

#define LAST   255

Definition at line 201 of file bsd_comp.c.

#define lens_ptr (   db,
  idx 
)    lens_ptrx(db,idx)

Definition at line 548 of file bsd_comp.c.

#define lens_ptrx (   p,
  idx 
)    &(p->lens[idx])

Definition at line 524 of file bsd_comp.c.

#define MAX_BSD_BITS   15

Definition at line 166 of file bsd_comp.c.

#define MAXCODE (   b)    ((1 << (b)) - 1)

Definition at line 203 of file bsd_comp.c.

#define MIN_BSD_BITS   9

Definition at line 164 of file bsd_comp.c.

#define OUTPUT (   ent)
Value:
{ \
bitno -= n_bits; \
accm |= ((ent) << bitno); \
do \
{ \
PUTBYTE(accm >> 24); \
accm <<= 8; \
bitno += 8; \
} \
while (bitno <= 24); \
}
#define PACKETPTR   1

Definition at line 73 of file bsd_comp.c.

#define PUTBYTE (   v)
Value:
{ \
++olen; \
if (wptr) \
{ \
*wptr++ = (unsigned char) (v); \
if (olen >= osize) \
{ \
wptr = NULL; \
} \
} \
}
#define RATIO_MAX   (0x7fffffff>>RATIO_SCALE_LOG)

Definition at line 215 of file bsd_comp.c.

#define RATIO_SCALE   (1<<RATIO_SCALE_LOG)

Definition at line 214 of file bsd_comp.c.

#define RATIO_SCALE_LOG   8

Definition at line 213 of file bsd_comp.c.

Function Documentation

MODULE_ALIAS ( "ppp-compress-"  __stringifyCI_BSD_COMPRESS)
module_exit ( bsdcomp_cleanup  )
module_init ( bsdcomp_init  )
MODULE_LICENSE ( "Dual BSD/GPL"  )
int ppp_register_compressor ( struct compressor cp)

Definition at line 2548 of file ppp_generic.c.

void ppp_unregister_compressor ( struct compressor cp)

Definition at line 2570 of file ppp_generic.c.