Skip to content
Permalink
Browse files

Code style

Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
  • Loading branch information
c0d3z3r0 committed Dec 2, 2019
1 parent d99f652 commit a649e784a68e02fbbe8b9b71e9bad936c3417fbe
@@ -1,2 +1 @@
.*.cmd

@@ -157,12 +157,6 @@ extern zio_compress_info_t zio_compress_table[ZIO_COMPRESS_FUNCTIONS];
extern void lz4_init(void);
extern void lz4_fini(void);

/*
* specific to zstd user space implementation only
*/
extern void zstd_fini(void);
extern int zstd_init(void);

/*
* Compression routines.
*/
@@ -182,13 +176,6 @@ extern size_t lz4_compress_zfs(void *src, void *dst, size_t s_len, size_t d_len,
int level);
extern int lz4_decompress_zfs(void *src, void *dst, size_t s_len, size_t d_len,
int level);
extern size_t zstd_compress(void *src, void *dst, size_t s_len, size_t d_len,
int level);
extern int zstd_decompress(void *src, void *dst, size_t s_len, size_t d_len,
int level);
extern int zstd_decompress_level(void *src, void *dst, size_t s_len,
size_t d_len, uint8_t *level);
extern int zstd_get_level(void *src, size_t s_len, uint8_t *level);

/*
* Compress and decompress data if necessary.
@@ -0,0 +1,53 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/

/*
* Copyright (c) 2016-2018, Klara Systems Inc. All rights reserved.
* Copyright (c) 2016-2018, Allan Jude. All rights reserved.
* Copyright (c) 2018-2019, Sebastian Gottschall. All rights reserved.
* Copyright (c) 2019, Michael Niewöhner. All rights reserved.
*/

#ifndef _ZFS_ZSTD_H
#define _ZFS_ZSTD_H

#ifdef __cplusplus
extern "C" {
#endif

/* (de)init for user space / kernel emulation */
int zstd_init(void);
void zstd_fini(void);

size_t zstd_compress(void *s_start, void *d_start, size_t s_len, size_t d_len,
int n);
int zstd_get_level(void *s_start, size_t s_len, uint8_t *level);
int zstd_decompress_level(void *s_start, void *d_start, size_t s_len,
size_t d_len, uint8_t *level);
int zstd_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len,
int n);

#ifdef __cplusplus
}
#endif

#endif /* _ZFS_ZSTD_H */
@@ -42,6 +42,7 @@
#include <sys/systeminfo.h>
#include <zfs_fletcher.h>
#include <sys/crypto/icp.h>
#include <sys/zstd/zstd.h>

/*
* Emulation of kernel services in userland.
@@ -837,15 +838,16 @@ kernel_init(int mode)
icp_init();

spa_init((spa_mode_t)mode);

fletcher_4_init();
zstd_init();

tsd_create(&rrw_tsd_key, rrw_tsd_destroy);
}

void
kernel_fini(void)
{
zstd_fini();
fletcher_4_fini();
spa_fini();

@@ -18,7 +18,7 @@
*
* CDDL HEADER END
*/

/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, Joyent Inc. All rights reserved.
@@ -2324,9 +2324,6 @@ spa_init(spa_mode_t mode)
metaslab_stat_init();
ddt_init();
zio_init();
#ifndef _KERNEL
zstd_init();
#endif
dmu_init();
zil_init();
vdev_cache_stat_init();
@@ -2356,9 +2353,6 @@ spa_fini(void)
vdev_raidz_math_fini();
zil_fini();
dmu_fini();
#ifndef _KERNEL
zstd_fini();
#endif
zio_fini();
ddt_fini();
metaslab_stat_fini();
@@ -32,6 +32,7 @@
#include <sys/zfeature.h>
#include <sys/zio.h>
#include <sys/zio_compress.h>
#include <sys/zstd/zstd.h>

/*
* If nonzero, every 1/X decompression attempts will fail, simulating

0 comments on commit a649e78

Please sign in to comment.
You can’t perform that action at this time.