17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*cc1a9a89SRafael Vanoni Polanczyk * Common Development and Distribution License (the "License"). 6*cc1a9a89SRafael Vanoni Polanczyk * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*cc1a9a89SRafael Vanoni Polanczyk * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _UUID_MISC_H 277c478bd9Sstevel@tonic-gate #define _UUID_MISC_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate /* 307c478bd9Sstevel@tonic-gate * The copyright in this file is taken from the original Leach 317c478bd9Sstevel@tonic-gate * & Salz UUID specification, from which this implementation 327c478bd9Sstevel@tonic-gate * is derived. 337c478bd9Sstevel@tonic-gate */ 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate /* 367c478bd9Sstevel@tonic-gate * Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. 377c478bd9Sstevel@tonic-gate * Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & 387c478bd9Sstevel@tonic-gate * Digital Equipment Corporation, Maynard, Mass. Copyright (c) 1998 397c478bd9Sstevel@tonic-gate * Microsoft. To anyone who acknowledges that this file is provided 407c478bd9Sstevel@tonic-gate * "AS IS" without any express or implied warranty: permission to use, 417c478bd9Sstevel@tonic-gate * copy, modify, and distribute this file for any purpose is hereby 427c478bd9Sstevel@tonic-gate * granted without fee, provided that the above copyright notices and 437c478bd9Sstevel@tonic-gate * this notice appears in all source code copies, and that none of the 447c478bd9Sstevel@tonic-gate * names of Open Software Foundation, Inc., Hewlett-Packard Company, 457c478bd9Sstevel@tonic-gate * or Digital Equipment Corporation be used in advertising or 467c478bd9Sstevel@tonic-gate * publicity pertaining to distribution of the software without 477c478bd9Sstevel@tonic-gate * specific, written prior permission. Neither Open Software 487c478bd9Sstevel@tonic-gate * Foundation, Inc., Hewlett-Packard Company, Microsoft, nor Digital 497c478bd9Sstevel@tonic-gate * Equipment Corporation makes any representations about the 507c478bd9Sstevel@tonic-gate * suitability of this software for any purpose. 517c478bd9Sstevel@tonic-gate */ 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate #ifdef __cplusplus 547c478bd9Sstevel@tonic-gate extern "C" { 557c478bd9Sstevel@tonic-gate #endif 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate #include <uuid/uuid.h> 587c478bd9Sstevel@tonic-gate #include <sys/types.h> 59*cc1a9a89SRafael Vanoni Polanczyk #include <thread.h> 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate typedef uint64_t uuid_time_t; 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate /* 647c478bd9Sstevel@tonic-gate * data type for UUID generator persistent state 657c478bd9Sstevel@tonic-gate */ 667c478bd9Sstevel@tonic-gate typedef struct { 677c478bd9Sstevel@tonic-gate uuid_time_t ts; /* saved timestamp */ 687c478bd9Sstevel@tonic-gate uuid_node_t node; /* saved node ID */ 69*cc1a9a89SRafael Vanoni Polanczyk uint16_t clock; /* saved clock sequence */ 707c478bd9Sstevel@tonic-gate } uuid_state_t; 717c478bd9Sstevel@tonic-gate 72*cc1a9a89SRafael Vanoni Polanczyk typedef struct { 73*cc1a9a89SRafael Vanoni Polanczyk mutex_t lock; 74*cc1a9a89SRafael Vanoni Polanczyk uuid_state_t state; 75*cc1a9a89SRafael Vanoni Polanczyk } shared_buffer_t; 76*cc1a9a89SRafael Vanoni Polanczyk 77*cc1a9a89SRafael Vanoni Polanczyk #define STATE_LOCATION "/var/sadm/system/uuid_state" 78*cc1a9a89SRafael Vanoni Polanczyk #define URANDOM_PATH "/dev/urandom" 79*cc1a9a89SRafael Vanoni Polanczyk #define MAX_RETRY 8 80*cc1a9a89SRafael Vanoni Polanczyk #define VER1_MASK 0xefff 81*cc1a9a89SRafael Vanoni Polanczyk 82*cc1a9a89SRafael Vanoni Polanczyk #define STATE_FILE 1 83*cc1a9a89SRafael Vanoni Polanczyk #define TEMP_FILE 2 84*cc1a9a89SRafael Vanoni Polanczyk 857c478bd9Sstevel@tonic-gate #ifdef __cplusplus 867c478bd9Sstevel@tonic-gate } 877c478bd9Sstevel@tonic-gate #endif 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gate #endif /* _UUID_MISC_H */ 90