linux/lib/842/842_compress.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * 842 Software Compression
 *
 * Copyright (C) 2015 Dan Streetman, IBM Corp
 *
 * See 842.h for details of the 842 compressed format.
 */

#define pr_fmt(fmt)
#define MODULE_NAME

#include <linux/hashtable.h>

#include "842.h"
#include "842_debugfs.h"

#define SW842_HASHTABLE8_BITS
#define SW842_HASHTABLE4_BITS
#define SW842_HASHTABLE2_BITS

/* By default, we allow compressing input buffers of any length, but we must
 * use the non-standard "short data" template so the decompressor can correctly
 * reproduce the uncompressed data buffer at the right length.  However the
 * hardware 842 compressor will not recognize the "short data" template, and
 * will fail to decompress any compressed buffer containing it (I have no idea
 * why anyone would want to use software to compress and hardware to decompress
 * but that's beside the point).  This parameter forces the compression
 * function to simply reject any input buffer that isn't a multiple of 8 bytes
 * long, instead of using the "short data" template, so that all compressed
 * buffers produced by this function will be decompressable by the 842 hardware
 * decompressor.  Unless you have a specific need for that, leave this disabled
 * so that any length buffer can be compressed.
 */
static bool sw842_strict;
module_param_named(strict, sw842_strict, bool, 0644);

static u8 comp_ops[OPS_MAX][5] =;

struct sw842_hlist_node8 {};

struct sw842_hlist_node4 {};

struct sw842_hlist_node2 {};

#define INDEX_NOT_FOUND
#define INDEX_NOT_CHECKED

struct sw842_param {};

#define get_input_data(p, o, b)

#define init_hashtable_nodes(p, b)

#define find_index(p, b, n)

#define check_index(p, b, n)

#define replace_hash(p, b, i, d)

static u8 bmask[8] =;

static int add_bits(struct sw842_param *p, u64 d, u8 n);

static int __split_add_bits(struct sw842_param *p, u64 d, u8 n, u8 s)
{}

static int add_bits(struct sw842_param *p, u64 d, u8 n)
{}

static int add_template(struct sw842_param *p, u8 c)
{}

static int add_repeat_template(struct sw842_param *p, u8 r)
{}

static int add_short_data_template(struct sw842_param *p, u8 b)
{}

static int add_zeros_template(struct sw842_param *p)
{}

static int add_end_template(struct sw842_param *p)
{}

static bool check_template(struct sw842_param *p, u8 c)
{}

static void get_next_data(struct sw842_param *p)
{}

/* update the hashtable entries.
 * only call this after finding/adding the current template
 * the dataN fields for the current 8 byte block must be already updated
 */
static void update_hashtables(struct sw842_param *p)
{}

/* find the next template to use, and add it
 * the p->dataN fields must already be set for the current 8 byte block
 */
static int process_next(struct sw842_param *p)
{}

/**
 * sw842_compress
 *
 * Compress the uncompressed buffer of length @ilen at @in to the output buffer
 * @out, using no more than @olen bytes, using the 842 compression format.
 *
 * Returns: 0 on success, error on failure.  The @olen parameter
 * will contain the number of output bytes written on success, or
 * 0 on error.
 */
int sw842_compress(const u8 *in, unsigned int ilen,
		   u8 *out, unsigned int *olen, void *wmem)
{}
EXPORT_SYMBOL_GPL();

static int __init sw842_init(void)
{}
module_init();

static void __exit sw842_exit(void)
{}
module_exit(sw842_exit);

MODULE_LICENSE();
MODULE_DESCRIPTION();
MODULE_AUTHOR();