1789Sahrens /* 2789Sahrens * CDDL HEADER START 3789Sahrens * 4789Sahrens * The contents of this file are subject to the terms of the 5*4787Sahrens * Common Development and Distribution License (the "License"). 6*4787Sahrens * You may not use this file except in compliance with the License. 7789Sahrens * 8789Sahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9789Sahrens * or http://www.opensolaris.org/os/licensing. 10789Sahrens * See the License for the specific language governing permissions 11789Sahrens * and limitations under the License. 12789Sahrens * 13789Sahrens * When distributing Covered Code, include this CDDL HEADER in each 14789Sahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15789Sahrens * If applicable, add the following below this CDDL HEADER, with the 16789Sahrens * fields enclosed by brackets "[]" replaced with your own identifying 17789Sahrens * information: Portions Copyright [yyyy] [name of copyright owner] 18789Sahrens * 19789Sahrens * CDDL HEADER END 20789Sahrens */ 21789Sahrens /* 22*4787Sahrens * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23789Sahrens * Use is subject to license terms. 24789Sahrens */ 25789Sahrens 26789Sahrens #ifndef _SYS_UNIQUE_H 27789Sahrens #define _SYS_UNIQUE_H 28789Sahrens 29789Sahrens #pragma ident "%Z%%M% %I% %E% SMI" 30789Sahrens 31789Sahrens #include <sys/zfs_context.h> 32789Sahrens 33789Sahrens #ifdef __cplusplus 34789Sahrens extern "C" { 35789Sahrens #endif 36789Sahrens 37789Sahrens /* The number of significant bits in each unique value. */ 38789Sahrens #define UNIQUE_BITS 56 39789Sahrens 40789Sahrens void unique_init(void); 41*4787Sahrens void unique_fini(void); 42789Sahrens 43*4787Sahrens /* 44*4787Sahrens * Return a new unique value (which will not be uniquified against until 45*4787Sahrens * it is unique_insert()-ed. 46*4787Sahrens */ 47789Sahrens uint64_t unique_create(void); 48789Sahrens 49789Sahrens /* Return a unique value, which equals the one passed in if possible. */ 50789Sahrens uint64_t unique_insert(uint64_t value); 51789Sahrens 52789Sahrens /* Indicate that this value no longer needs to be uniquified against. */ 53789Sahrens void unique_remove(uint64_t value); 54789Sahrens 55789Sahrens #ifdef __cplusplus 56789Sahrens } 57789Sahrens #endif 58789Sahrens 59789Sahrens #endif /* _SYS_UNIQUE_H */ 60