summaryrefslogtreecommitdiff
path: root/fs/smb/client/compress/lz77.h
blob: 7d616f746990dc73c9212784ab3ff532a2c4828e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (C) 2024, SUSE LLC
 *
 * Authors: Enzo Matsumiya <ematsumiya@suse.de>
 *
 * Implementation of the LZ77 "plain" compression algorithm, as per MS-XCA spec.
 */
#ifndef _SMB_COMPRESS_LZ77_H
#define _SMB_COMPRESS_LZ77_H

#include <asm/page_types.h>
#include <linux/kernel.h>

static __always_inline size_t lz77_compress_mem_required(size_t len)
{
	return len + (len >> 3) + PAGE_SIZE;
}

int lz77_compress(const u8 *src, u32 slen, u8 *dst, u32 *dlen);
#endif /* _SMB_COMPRESS_LZ77_H */