diff options
author | Brian Behlendorf <[email protected]> | 2010-09-04 13:26:23 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2010-09-08 12:38:56 -0700 |
commit | 6283f55ea1b91e680386388c17d14b89e344fa8d (patch) | |
tree | 2d475646019ffc2cf23c62a64de77cd220c53ebd /lib/libefi | |
parent | 5e6121455c0b941f4612ceb2c1f312d527534b46 (diff) |
Support custom build directories and move includes
One of the neat tricks an autoconf style project is capable of
is allow configurion/building in a directory other than the
source directory. The major advantage to this is that you can
build the project various different ways while making changes
in a single source tree.
For example, this project is designed to work on various different
Linux distributions each of which work slightly differently. This
means that changes need to verified on each of those supported
distributions perferably before the change is committed to the
public git repo.
Using nfs and custom build directories makes this much easier.
I now have a single source tree in nfs mounted on several different
systems each running a supported distribution. When I make a
change to the source base I suspect may break things I can
concurrently build from the same source on all the systems each
in their own subdirectory.
wget -c http://github.com/downloads/behlendorf/zfs/zfs-x.y.z.tar.gz
tar -xzf zfs-x.y.z.tar.gz
cd zfs-x-y-z
------------------------- run concurrently ----------------------
<ubuntu system> <fedora system> <debian system> <rhel6 system>
mkdir ubuntu mkdir fedora mkdir debian mkdir rhel6
cd ubuntu cd fedora cd debian cd rhel6
../configure ../configure ../configure ../configure
make make make make
make check make check make check make check
This change also moves many of the include headers from individual
incude/sys directories under the modules directory in to a single
top level include directory. This has the advantage of making
the build rules cleaner and logically it makes a bit more sense.
Diffstat (limited to 'lib/libefi')
-rw-r--r-- | lib/libefi/Makefile.am | 8 | ||||
-rw-r--r-- | lib/libefi/Makefile.in | 23 | ||||
-rw-r--r-- | lib/libefi/include/sys/efi_partition.h | 242 | ||||
-rw-r--r-- | lib/libefi/include/sys/uuid.h | 94 |
4 files changed, 10 insertions, 357 deletions
diff --git a/lib/libefi/Makefile.am b/lib/libefi/Makefile.am index 431179340..57f1bd31e 100644 --- a/lib/libefi/Makefile.am +++ b/lib/libefi/Makefile.am @@ -3,12 +3,10 @@ include $(top_srcdir)/config/Rules.am AM_CFLAGS += $(DEBUG_STACKFLAGS) $(FRAME_LARGER_THAN) DEFAULT_INCLUDES += \ - -I${top_srcdir}/lib/libefi/include \ - -I${top_srcdir}/lib/libspl/include + -I$(top_srcdir)/include \ + -I$(top_srcdir)/lib/libspl/include lib_LTLIBRARIES = libefi.la libefi_la_SOURCES = \ - ${top_srcdir}/lib/libefi/rdwr_efi.c \ - ${top_srcdir}/lib/libefi/include/sys/efi_partition.h \ - ${top_srcdir}/lib/libefi/include/sys/uuid.h + $(top_srcdir)/lib/libefi/rdwr_efi.c diff --git a/lib/libefi/Makefile.in b/lib/libefi/Makefile.in index 6fa193c8c..debd06fd8 100644 --- a/lib/libefi/Makefile.in +++ b/lib/libefi/Makefile.in @@ -144,14 +144,12 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ -BUILDDIR = @BUILDDIR@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CMDDIR = @CMDDIR@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ @@ -189,7 +187,6 @@ KERNELMAKE_PARAMS = @KERNELMAKE_PARAMS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBLKID = @LIBBLKID@ -LIBDIR = @LIBDIR@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -204,7 +201,6 @@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -MODDIR = @MODDIR@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -223,7 +219,6 @@ RPM = @RPM@ RPMBUILD = @RPMBUILD@ RPMBUILD_VERSION = @RPMBUILD_VERSION@ RPM_VERSION = @RPM_VERSION@ -SCRIPTDIR = @SCRIPTDIR@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ @@ -233,7 +228,6 @@ SPL_SYMBOLS = @SPL_SYMBOLS@ SPL_VERSION = @SPL_VERSION@ STRIP = @STRIP@ TARGET_ASM_DIR = @TARGET_ASM_DIR@ -TOPDIR = @TOPDIR@ VENDOR = @VENDOR@ VERSION = @VERSION@ ZFS_CONFIG = @ZFS_CONFIG@ @@ -304,9 +298,8 @@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -DEFAULT_INCLUDES = -include ${top_srcdir}/zfs_config.h \ - -I${top_srcdir}/lib/libefi/include \ - -I${top_srcdir}/lib/libspl/include +DEFAULT_INCLUDES = -include ${top_builddir}/zfs_config.h \ + -I$(top_srcdir)/include -I$(top_srcdir)/lib/libspl/include AM_LIBTOOLFLAGS = --silent AM_CFLAGS = -Wall -Wstrict-prototypes -fno-strict-aliasing \ ${DEBUG_CFLAGS} -D_GNU_SOURCE -D__EXTENSIONS__ -D_REENTRANT \ @@ -315,9 +308,7 @@ AM_CFLAGS = -Wall -Wstrict-prototypes -fno-strict-aliasing \ $(DEBUG_STACKFLAGS) $(FRAME_LARGER_THAN) lib_LTLIBRARIES = libefi.la libefi_la_SOURCES = \ - ${top_srcdir}/lib/libefi/rdwr_efi.c \ - ${top_srcdir}/lib/libefi/include/sys/efi_partition.h \ - ${top_srcdir}/lib/libefi/include/sys/uuid.h + $(top_srcdir)/lib/libefi/rdwr_efi.c all: all-am @@ -419,13 +410,13 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< -rdwr_efi.lo: ${top_srcdir}/lib/libefi/rdwr_efi.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rdwr_efi.lo -MD -MP -MF $(DEPDIR)/rdwr_efi.Tpo -c -o rdwr_efi.lo `test -f '${top_srcdir}/lib/libefi/rdwr_efi.c' || echo '$(srcdir)/'`${top_srcdir}/lib/libefi/rdwr_efi.c +rdwr_efi.lo: $(top_srcdir)/lib/libefi/rdwr_efi.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rdwr_efi.lo -MD -MP -MF $(DEPDIR)/rdwr_efi.Tpo -c -o rdwr_efi.lo `test -f '$(top_srcdir)/lib/libefi/rdwr_efi.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libefi/rdwr_efi.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rdwr_efi.Tpo $(DEPDIR)/rdwr_efi.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='${top_srcdir}/lib/libefi/rdwr_efi.c' object='rdwr_efi.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/libefi/rdwr_efi.c' object='rdwr_efi.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rdwr_efi.lo `test -f '${top_srcdir}/lib/libefi/rdwr_efi.c' || echo '$(srcdir)/'`${top_srcdir}/lib/libefi/rdwr_efi.c +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rdwr_efi.lo `test -f '$(top_srcdir)/lib/libefi/rdwr_efi.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libefi/rdwr_efi.c mostlyclean-libtool: -rm -f *.lo diff --git a/lib/libefi/include/sys/efi_partition.h b/lib/libefi/include/sys/efi_partition.h deleted file mode 100644 index ff38df5e7..000000000 --- a/lib/libefi/include/sys/efi_partition.h +++ /dev/null @@ -1,242 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (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) 2002, 2010, Oracle and/or its affiliates. All rights reserved. - */ - -#ifndef _SYS_EFI_PARTITION_H -#define _SYS_EFI_PARTITION_H - -#include <sys/uuid.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * GUID Partition Table Header - */ - -#define EFI_LABEL_SIZE 512 -#define LEN_EFI_PAD (EFI_LABEL_SIZE - \ - ((5 * sizeof (diskaddr_t)) + \ - (7 * sizeof (uint_t)) + \ - (8 * sizeof (char)) + \ - (1 * (sizeof (struct uuid))))) - -#define EFI_SIGNATURE 0x5452415020494645ULL - -/* EFI Guid Partition Table Header -- little endian on-disk format */ -typedef struct efi_gpt { - uint64_t efi_gpt_Signature; - uint_t efi_gpt_Revision; - uint_t efi_gpt_HeaderSize; - uint_t efi_gpt_HeaderCRC32; - uint_t efi_gpt_Reserved1; - diskaddr_t efi_gpt_MyLBA; - diskaddr_t efi_gpt_AlternateLBA; - diskaddr_t efi_gpt_FirstUsableLBA; - diskaddr_t efi_gpt_LastUsableLBA; - struct uuid efi_gpt_DiskGUID; - diskaddr_t efi_gpt_PartitionEntryLBA; - uint_t efi_gpt_NumberOfPartitionEntries; - uint_t efi_gpt_SizeOfPartitionEntry; - uint_t efi_gpt_PartitionEntryArrayCRC32; - char efi_gpt_Reserved2[LEN_EFI_PAD]; -} efi_gpt_t; - -/* EFI Guid Partition Entry Attributes -- little endian format */ -typedef struct efi_gpe_Attrs { - uint32_t PartitionAttrs :16, - Reserved2 :16; - uint32_t Reserved1 :31, - RequiredPartition :1; -} efi_gpe_Attrs_t; - -/* - * 6a96237f-1dd2-11b2-99a6-080020736631 V_UNASSIGNED (not used as such) - * 6a82cb45-1dd2-11b2-99a6-080020736631 V_BOOT - * 6a85cf4d-1dd2-11b2-99a6-080020736631 V_ROOT - * 6a87c46f-1dd2-11b2-99a6-080020736631 V_SWAP - * 6a898cc3-1dd2-11b2-99a6-080020736631 V_USR - * 6a8b642b-1dd2-11b2-99a6-080020736631 V_BACKUP - * 6a8d2ac7-1dd2-11b2-99a6-080020736631 V_STAND (not used) - * 6a8ef2e9-1dd2-11b2-99a6-080020736631 V_VAR - * 6a90ba39-1dd2-11b2-99a6-080020736631 V_HOME - * 6a9283a5-1dd2-11b2-99a6-080020736631 V_ALTSCTR - * 6a945a3b-1dd2-11b2-99a6-080020736631 V_CACHE - */ - -#define EFI_UNUSED { 0x00000000, 0x0000, 0x0000, 0x00, 0x00, \ - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } -#define EFI_RESV1 { 0x6a96237f, 0x1dd2, 0x11b2, 0x99, 0xa6, \ - { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } } -#define EFI_BOOT { 0x6a82cb45, 0x1dd2, 0x11b2, 0x99, 0xa6, \ - { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } } -#define EFI_ROOT { 0x6a85cf4d, 0x1dd2, 0x11b2, 0x99, 0xa6, \ - { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } } -#define EFI_SWAP { 0x6a87c46f, 0x1dd2, 0x11b2, 0x99, 0xa6, \ - { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } } -#define EFI_USR { 0x6a898cc3, 0x1dd2, 0x11b2, 0x99, 0xa6, \ - { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } } -#define EFI_BACKUP { 0x6a8b642b, 0x1dd2, 0x11b2, 0x99, 0xa6, \ - { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } } -#define EFI_RESV2 { 0x6a8d2ac7, 0x1dd2, 0x11b2, 0x99, 0xa6, \ - { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } } -#define EFI_VAR { 0x6a8ef2e9, 0x1dd2, 0x11b2, 0x99, 0xa6, \ - { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } } -#define EFI_HOME { 0x6a90ba39, 0x1dd2, 0x11b2, 0x99, 0xa6, \ - { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } } -#define EFI_ALTSCTR { 0x6a9283a5, 0x1dd2, 0x11b2, 0x99, 0xa6, \ - { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } } -#define EFI_RESERVED { 0x6a945a3b, 0x1dd2, 0x11b2, 0x99, 0xa6, \ - { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } } -#define EFI_SYSTEM { 0xC12A7328, 0xF81F, 0x11d2, 0xBA, 0x4B, \ - { 0x00, 0xA0, 0xC9, 0x3E, 0xC9, 0x3B } } -#define EFI_LEGACY_MBR { 0x024DEE41, 0x33E7, 0x11d3, 0x9D, 0x69, \ - { 0x00, 0x08, 0xC7, 0x81, 0xF3, 0x9F } } -#define EFI_SYMC_PUB { 0x6a9630d1, 0x1dd2, 0x11b2, 0x99, 0xa6, \ - { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } } -#define EFI_SYMC_CDS { 0x6a980767, 0x1dd2, 0x11b2, 0x99, 0xa6, \ - { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } } -#define EFI_MSFT_RESV { 0xE3C9E316, 0x0B5C, 0x4DB8, 0x81, 0x7D, \ - { 0xF9, 0x2D, 0xF0, 0x02, 0x15, 0xAE } } -#define EFI_DELL_BASIC { 0xebd0a0a2, 0xb9e5, 0x4433, 0x87, 0xc0, \ - { 0x68, 0xb6, 0xb7, 0x26, 0x99, 0xc7 } } -#define EFI_DELL_RAID { 0xa19d880f, 0x05fc, 0x4d3b, 0xa0, 0x06, \ - { 0x74, 0x3f, 0x0f, 0x84, 0x91, 0x1e } } -#define EFI_DELL_SWAP { 0x0657fd6d, 0xa4ab, 0x43c4, 0x84, 0xe5, \ - { 0x09, 0x33, 0xc8, 0x4b, 0x4f, 0x4f } } -#define EFI_DELL_LVM { 0xe6d6d379, 0xf507, 0x44c2, 0xa2, 0x3c, \ - { 0x23, 0x8f, 0x2a, 0x3d, 0xf9, 0x28 } } -#define EFI_DELL_RESV { 0x8da63339, 0x0007, 0x60c0, 0xc4, 0x36, \ - { 0x08, 0x3a, 0xc8, 0x23, 0x09, 0x08 } } -#define EFI_AAPL_HFS { 0x48465300, 0x0000, 0x11aa, 0xaa, 0x11, \ - { 0x00, 0x30, 0x65, 0x43, 0xec, 0xac } } -#define EFI_AAPL_UFS { 0x55465300, 0x0000, 0x11aa, 0xaa, 0x11, \ - { 0x00, 0x30, 0x65, 0x43, 0xec, 0xac } } - -/* minimum # of bytes for partition table entires, per EFI spec */ -#define EFI_MIN_ARRAY_SIZE (16 * 1024) - -#define EFI_PART_NAME_LEN 36 - -/* size of the "reserved" partition, in blocks */ -#define EFI_MIN_RESV_SIZE (16 * 1024) - -/* EFI Guid Partition Entry */ -typedef struct efi_gpe { - struct uuid efi_gpe_PartitionTypeGUID; - struct uuid efi_gpe_UniquePartitionGUID; - diskaddr_t efi_gpe_StartingLBA; - diskaddr_t efi_gpe_EndingLBA; - efi_gpe_Attrs_t efi_gpe_Attributes; - ushort_t efi_gpe_PartitionName[EFI_PART_NAME_LEN]; -} efi_gpe_t; - -/* - * passed to the useful (we hope) routines (efi_alloc_and_read and - * efi_write) that take this VTOC-like struct. These routines handle - * converting this struct into the EFI struct, generate UUIDs and - * checksums, and perform any necessary byte-swapping to the on-disk - * format. - */ -/* Solaris library abstraction for EFI partitons */ -typedef struct dk_part { - diskaddr_t p_start; /* starting LBA */ - diskaddr_t p_size; /* size in blocks */ - struct uuid p_guid; /* partion type GUID */ - ushort_t p_tag; /* converted to part'n type GUID */ - ushort_t p_flag; /* attributes */ - char p_name[EFI_PART_NAME_LEN]; /* partition name */ - struct uuid p_uguid; /* unique partition GUID */ - uint_t p_resv[8]; /* future use - set to zero */ -} dk_part_t; - -/* Solaris library abstraction for an EFI GPT */ -#define EFI_VERSION102 0x00010002 -#define EFI_VERSION100 0x00010000 -#define EFI_VERSION_CURRENT EFI_VERSION100 -typedef struct dk_gpt { - uint_t efi_version; /* set to EFI_VERSION_CURRENT */ - uint_t efi_nparts; /* number of partitions below */ - uint_t efi_part_size; /* size of each partition entry */ - /* efi_part_size is unused */ - uint_t efi_lbasize; /* size of block in bytes */ - diskaddr_t efi_last_lba; /* last block on the disk */ - diskaddr_t efi_first_u_lba; /* first block after labels */ - diskaddr_t efi_last_u_lba; /* last block before backup labels */ - struct uuid efi_disk_uguid; /* unique disk GUID */ - uint_t efi_flags; - uint_t efi_reserved1; /* future use - set to zero */ - diskaddr_t efi_altern_lba; /* lba of alternate GPT header */ - uint_t efi_reserved[12]; /* future use - set to zero */ - struct dk_part efi_parts[1]; /* array of partitions */ -} dk_gpt_t; - -/* possible values for "efi_flags" */ -#define EFI_GPT_PRIMARY_CORRUPT 0x1 /* primary label corrupt */ - -/* the private ioctl between libefi and the driver */ -typedef struct dk_efi { - diskaddr_t dki_lba; /* starting block */ - len_t dki_length; /* length in bytes */ - union { - efi_gpt_t *_dki_data; - uint64_t _dki_data_64; - } dki_un; -#define dki_data dki_un._dki_data -#define dki_data_64 dki_un._dki_data_64 -} dk_efi_t; - -struct partition64 { - struct uuid p_type; - uint_t p_partno; - uint_t p_resv1; - diskaddr_t p_start; - diskaddr_t p_size; -}; - -/* - * Number of EFI partitions - */ -#if defined(__linux__) -#define EFI_NUMPAR 128 /* Expected by parted-1.8.1 */ -#else -#define EFI_NUMPAR 9 -#endif - -#ifndef _KERNEL -extern int efi_alloc_and_init(int, uint32_t, struct dk_gpt **); -extern int efi_alloc_and_read(int, struct dk_gpt **); -extern int efi_write(int, struct dk_gpt *); -extern void efi_free(struct dk_gpt *); -extern int efi_type(int); -extern void efi_err_check(struct dk_gpt *); -extern int efi_auto_sense(int fd, struct dk_gpt **); -extern int efi_use_whole_disk(int fd); -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _SYS_EFI_PARTITION_H */ diff --git a/lib/libefi/include/sys/uuid.h b/lib/libefi/include/sys/uuid.h deleted file mode 100644 index eab4622a6..000000000 --- a/lib/libefi/include/sys/uuid.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SYS_UUID_H -#define _SYS_UUID_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The copyright in this file is taken from the original Leach - * & Salz UUID specification, from which this implementation - * is derived. - */ - -/* - * Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. - * Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & - * Digital Equipment Corporation, Maynard, Mass. Copyright (c) 1998 - * Microsoft. To anyone who acknowledges that this file is provided - * "AS IS" without any express or implied warranty: permission to use, - * copy, modify, and distribute this file for any purpose is hereby - * granted without fee, provided that the above copyright notices and - * this notice appears in all source code copies, and that none of the - * names of Open Software Foundation, Inc., Hewlett-Packard Company, - * or Digital Equipment Corporation be used in advertising or - * publicity pertaining to distribution of the software without - * specific, written prior permission. Neither Open Software - * Foundation, Inc., Hewlett-Packard Company, Microsoft, nor Digital - * Equipment Corporation makes any representations about the - * suitability of this software for any purpose. - */ - -#include <sys/types.h> -#include <sys/byteorder.h> - -typedef struct { - uint8_t nodeID[6]; -} uuid_node_t; - -/* - * The uuid type used throughout when referencing uuids themselves - */ -struct uuid { - uint32_t time_low; - uint16_t time_mid; - uint16_t time_hi_and_version; - uint8_t clock_seq_hi_and_reserved; - uint8_t clock_seq_low; - uint8_t node_addr[6]; -}; - -#define UUID_PRINTABLE_STRING_LENGTH 37 - -/* - * Convert a uuid to/from little-endian format - */ -#define UUID_LE_CONVERT(dest, src) \ -{ \ - (dest) = (src); \ - (dest).time_low = LE_32((dest).time_low); \ - (dest).time_mid = LE_16((dest).time_mid); \ - (dest).time_hi_and_version = LE_16((dest).time_hi_and_version); \ -} - -#ifdef __cplusplus -} -#endif - -#endif /* _SYS_UUID_H */ |