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 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SYS_UNIQUE_H 28 #define _SYS_UNIQUE_H 29 30 #include <sys/zfs_context.h> 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 /* The number of significant bits in each unique value. */ 37 #define UNIQUE_BITS 56 38 39 void unique_init(void); 40 void unique_fini(void); 41 42 /* 43 * Return a new unique value (which will not be uniquified against until 44 * it is unique_insert()-ed). 45 */ 46 uint64_t unique_create(void); 47 48 /* Return a unique value, which equals the one passed in if possible. */ 49 uint64_t unique_insert(uint64_t value); 50 51 /* Indicate that this value no longer needs to be uniquified against. */ 52 void unique_remove(uint64_t value); 53 54 #ifdef __cplusplus 55 } 56 #endif 57 58 #endif /* _SYS_UNIQUE_H */ 59