1 // SPDX-License-Identifier: CDDL-1.0 2 /* 3 * CDDL HEADER START 4 * 5 * The contents of this file are subject to the terms of the 6 * Common Development and Distribution License (the "License"). 7 * You may not use this file except in compliance with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or https://opensource.org/licenses/CDDL-1.0. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 23 /* 24 * Copyright (c) 2022 Tino Reichardt <milky-zfs@mcmilk.de> 25 */ 26 27 #ifndef _SYS_ZFS_IMPL_H 28 #define _SYS_ZFS_IMPL_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 /* generic implementation backends */ 35 typedef struct 36 { 37 /* algorithm name */ 38 const char *name; 39 40 /* get number of supported implementations */ 41 uint32_t (*getcnt)(void); 42 43 /* get id of selected implementation */ 44 uint32_t (*getid)(void); 45 46 /* get name of selected implementation */ 47 const char *(*getname)(void); 48 49 /* setup id as fastest implementation */ 50 void (*set_fastest)(uint32_t id); 51 52 /* set implementation by id */ 53 void (*setid)(uint32_t id); 54 55 /* set implementation by name */ 56 int (*setname)(const char *val); 57 } zfs_impl_t; 58 59 /* return some set of function pointer */ 60 extern const zfs_impl_t *zfs_impl_get_ops(const char *algo); 61 62 extern const zfs_impl_t zfs_blake3_ops; 63 extern const zfs_impl_t zfs_sha256_ops; 64 extern const zfs_impl_t zfs_sha512_ops; 65 66 #ifdef __cplusplus 67 } 68 #endif 69 70 #endif /* _SYS_ZFS_IMPL_H */ 71