cpukit: Remove uuid and add to build

Did the best I could handling the location of uuid.h
This commit is contained in:
Amar Takhar
2025-07-31 18:01:42 -05:00
committed by Kinsey Moore
parent 88b7cd7660
commit e9870fa74f
19 changed files with 19 additions and 1661 deletions
-103
View File
@@ -1,103 +0,0 @@
/*
* Public include file for the UUID library
*
* Copyright (C) 1996, 1997, 1998 Theodore Ts'o.
*
* %Begin-Header%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, and the entire permission notice in its entirety,
* including the disclaimer of warranties.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
* WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
* %End-Header%
*/
#ifndef _UUID_UUID_H
#define _UUID_UUID_H
#include <sys/types.h>
#ifndef _WIN32
#include <sys/time.h>
#endif
#include <time.h>
typedef unsigned char uuid_t[16];
/* UUID Variant definitions */
#define UUID_VARIANT_NCS 0
#define UUID_VARIANT_DCE 1
#define UUID_VARIANT_MICROSOFT 2
#define UUID_VARIANT_OTHER 3
/* UUID Type definitions */
#define UUID_TYPE_DCE_TIME 1
#define UUID_TYPE_DCE_RANDOM 4
/* Allow UUID constants to be defined */
#ifdef __GNUC__
#define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \
static const uuid_t name __attribute__ ((unused)) = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15}
#else
#define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \
static const uuid_t name = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* clear.c */
void uuid_clear(uuid_t uu);
/* compare.c */
int uuid_compare(const uuid_t uu1, const uuid_t uu2);
/* copy.c */
void uuid_copy(uuid_t dst, const uuid_t src);
/* gen_uuid.c */
void uuid_generate(uuid_t out);
void uuid_generate_random(uuid_t out);
void uuid_generate_time(uuid_t out);
/* isnull.c */
int uuid_is_null(const uuid_t uu);
/* parse.c */
int uuid_parse(const char *in, uuid_t uu);
/* unparse.c */
void uuid_unparse(const uuid_t uu, char *out);
void uuid_unparse_lower(const uuid_t uu, char *out);
void uuid_unparse_upper(const uuid_t uu, char *out);
/* uuid_time.c */
time_t uuid_time(const uuid_t uu, struct timeval *ret_tv);
int uuid_type(const uuid_t uu);
int uuid_variant(const uuid_t uu);
#ifdef __cplusplus
}
#endif
#endif /* _UUID_UUID_H */
-25
View File
@@ -1,25 +0,0 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, and the entire permission notice in its entirety,
including the disclaimer of warranties.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
-17
View File
@@ -1,17 +0,0 @@
uuid
====
uuid - DCE compatible Universally Unique Identifier library
The UUID library is used to generate unique identifiers for objects that may be
accessible beyond the local system. This library generates UUIDs compatible
with those created by the Open Software Foundation (OSF) Distributed Computing
Environment (DCE) utility uuidgen.
The UUIDs generated by this library can be reasonably expected to be unique
within a system, and unique across all systems. They could be used, for
instance, to generate unique HTTP cookies across multiple web servers without
communication between the servers, and without fear of a name clash.
This code is from the E2fsprogs project: http://e2fsprogs.sourceforge.net.
The package was e2fsprogs-libs-1.41.5.tar.gz.
-47
View File
@@ -1,47 +0,0 @@
/*
* clear.c -- Clear a UUID
*
* Copyright (C) 1996, 1997 Theodore Ts'o.
*
* %Begin-Header%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, and the entire permission notice in its entirety,
* including the disclaimer of warranties.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
* WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
* %End-Header%
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include "uuidP.h"
void uuid_clear(uuid_t uu)
{
memset(uu, 0, 16);
}
-59
View File
@@ -1,59 +0,0 @@
/*
* compare.c --- compare whether or not two UUID's are the same
*
* Returns 0 if the two UUID's are different, and 1 if they are the same.
*
* Copyright (C) 1996, 1997 Theodore Ts'o.
*
* %Begin-Header%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, and the entire permission notice in its entirety,
* including the disclaimer of warranties.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
* WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
* %End-Header%
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include "uuidP.h"
#define UUCMP(u1,u2) if (u1 != u2) return((u1 < u2) ? -1 : 1);
int uuid_compare(const uuid_t uu1, const uuid_t uu2)
{
struct uuid uuid1, uuid2;
uuid_unpack(uu1, &uuid1);
uuid_unpack(uu2, &uuid2);
UUCMP(uuid1.time_low, uuid2.time_low);
UUCMP(uuid1.time_mid, uuid2.time_mid);
UUCMP(uuid1.time_hi_and_version, uuid2.time_hi_and_version);
UUCMP(uuid1.clock_seq, uuid2.clock_seq);
return memcmp(uuid1.node, uuid2.node, 6);
}
-49
View File
@@ -1,49 +0,0 @@
/*
* copy.c --- copy UUIDs
*
* Copyright (C) 1996, 1997 Theodore Ts'o.
*
* %Begin-Header%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, and the entire permission notice in its entirety,
* including the disclaimer of warranties.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
* WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
* %End-Header%
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "uuidP.h"
void uuid_copy(uuid_t dst, const uuid_t src)
{
unsigned char *cp1;
const unsigned char *cp2;
int i;
for (i=0, cp1 = dst, cp2 = src; i < 16; i++)
*cp1++ = *cp2++;
}
File diff suppressed because it is too large Load Diff
-52
View File
@@ -1,52 +0,0 @@
/*
* isnull.c --- Check whether or not the UUID is null
*
* Copyright (C) 1996, 1997 Theodore Ts'o.
*
* %Begin-Header%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, and the entire permission notice in its entirety,
* including the disclaimer of warranties.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
* WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
* %End-Header%
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "uuidP.h"
/* Returns 1 if the uuid is the NULL uuid */
int uuid_is_null(const uuid_t uu)
{
const unsigned char *cp;
int i;
for (i=0, cp = uu; i < 16; i++)
if (*cp++)
return 0;
return 1;
}
-73
View File
@@ -1,73 +0,0 @@
/*
* Internal routine for packing UUID's
*
* Copyright (C) 1996, 1997 Theodore Ts'o.
*
* %Begin-Header%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, and the entire permission notice in its entirety,
* including the disclaimer of warranties.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
* WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
* %End-Header%
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include "uuidP.h"
void uuid_pack(const struct uuid *uu, uuid_t ptr)
{
uint32_t tmp;
unsigned char *out = ptr;
tmp = uu->time_low;
out[3] = (unsigned char) tmp;
tmp >>= 8;
out[2] = (unsigned char) tmp;
tmp >>= 8;
out[1] = (unsigned char) tmp;
tmp >>= 8;
out[0] = (unsigned char) tmp;
tmp = uu->time_mid;
out[5] = (unsigned char) tmp;
tmp >>= 8;
out[4] = (unsigned char) tmp;
tmp = uu->time_hi_and_version;
out[7] = (unsigned char) tmp;
tmp >>= 8;
out[6] = (unsigned char) tmp;
tmp = uu->clock_seq;
out[9] = (unsigned char) tmp;
tmp >>= 8;
out[8] = (unsigned char) tmp;
memcpy(out+10, uu->node, 6);
}
-83
View File
@@ -1,83 +0,0 @@
/*
* parse.c --- UUID parsing
*
* Copyright (C) 1996, 1997 Theodore Ts'o.
*
* %Begin-Header%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, and the entire permission notice in its entirety,
* including the disclaimer of warranties.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
* WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
* %End-Header%
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include "uuidP.h"
int uuid_parse(const char *in, uuid_t uu)
{
struct uuid uuid;
int i;
const char *cp;
char buf[3];
if (strlen(in) != 36)
return -1;
for (i=0, cp = in; i <= 36; i++,cp++) {
if ((i == 8) || (i == 13) || (i == 18) ||
(i == 23)) {
if (*cp == '-')
continue;
else
return -1;
}
if (i== 36)
if (*cp == 0)
continue;
if (!isxdigit((unsigned char)*cp))
return -1;
}
uuid.time_low = strtoul(in, NULL, 16);
uuid.time_mid = strtoul(in+9, NULL, 16);
uuid.time_hi_and_version = strtoul(in+14, NULL, 16);
uuid.clock_seq = strtoul(in+19, NULL, 16);
cp = in+24;
buf[2] = 0;
for (i=0; i < 6; i++) {
buf[0] = *cp++;
buf[1] = *cp++;
uuid.node[i] = strtoul(buf, NULL, 16);
}
uuid_pack(&uuid, uu);
return 0;
}
-67
View File
@@ -1,67 +0,0 @@
/*
* Internal routine for unpacking UUID
*
* Copyright (C) 1996, 1997 Theodore Ts'o.
*
* %Begin-Header%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, and the entire permission notice in its entirety,
* including the disclaimer of warranties.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
* WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
* %End-Header%
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include "uuidP.h"
void uuid_unpack(const uuid_t in, struct uuid *uu)
{
const uint8_t *ptr = in;
uint32_t tmp;
tmp = *ptr++;
tmp = (tmp << 8) | *ptr++;
tmp = (tmp << 8) | *ptr++;
tmp = (tmp << 8) | *ptr++;
uu->time_low = tmp;
tmp = *ptr++;
tmp = (tmp << 8) | *ptr++;
uu->time_mid = tmp;
tmp = *ptr++;
tmp = (tmp << 8) | *ptr++;
uu->time_hi_and_version = tmp;
tmp = *ptr++;
tmp = (tmp << 8) | *ptr++;
uu->clock_seq = tmp;
memcpy(uu->node, ptr, 6);
}
-80
View File
@@ -1,80 +0,0 @@
/*
* unparse.c -- convert a UUID to string
*
* Copyright (C) 1996, 1997 Theodore Ts'o.
*
* %Begin-Header%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, and the entire permission notice in its entirety,
* including the disclaimer of warranties.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
* WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
* %End-Header%
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include "uuidP.h"
static const char *fmt_lower =
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x";
static const char *fmt_upper =
"%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X";
#ifdef UUID_UNPARSE_DEFAULT_UPPER
#define FMT_DEFAULT fmt_upper
#else
#define FMT_DEFAULT fmt_lower
#endif
static void uuid_unparse_x(const uuid_t uu, char *out, const char *fmt)
{
struct uuid uuid;
uuid_unpack(uu, &uuid);
sprintf(out, fmt,
uuid.time_low, uuid.time_mid, uuid.time_hi_and_version,
uuid.clock_seq >> 8, uuid.clock_seq & 0xFF,
uuid.node[0], uuid.node[1], uuid.node[2],
uuid.node[3], uuid.node[4], uuid.node[5]);
}
void uuid_unparse_lower(const uuid_t uu, char *out)
{
uuid_unparse_x(uu, out, fmt_lower);
}
void uuid_unparse_upper(const uuid_t uu, char *out)
{
uuid_unparse_x(uu, out, fmt_upper);
}
void uuid_unparse(const uuid_t uu, char *out)
{
uuid_unparse_x(uu, out, FMT_DEFAULT);
}
-63
View File
@@ -1,63 +0,0 @@
/*
* uuid.h -- private header file for uuids
*
* Copyright (C) 1996, 1997 Theodore Ts'o.
*
* %Begin-Header%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, and the entire permission notice in its entirety,
* including the disclaimer of warranties.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
* WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
* %End-Header%
*/
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#else
#include <uuid/uuid_types.h>
#endif
#include <sys/types.h>
#include <uuid/uuid.h>
/*
* Offset between 15-Oct-1582 and 1-Jan-70
*/
#define TIME_OFFSET_HIGH 0x01B21DD2
#define TIME_OFFSET_LOW 0x13814000
struct uuid {
uint32_t time_low;
uint16_t time_mid;
uint16_t time_hi_and_version;
uint16_t clock_seq;
uint8_t node[6];
};
/*
* prototypes
*/
void uuid_pack(const struct uuid *uu, uuid_t ptr);
void uuid_unpack(const uuid_t in, struct uuid *uu);
-175
View File
@@ -1,175 +0,0 @@
/*
* uuid_time.c --- Interpret the time field from a uuid. This program
* violates the UUID abstraction barrier by reaching into the guts
* of a UUID and interpreting it.
*
* Copyright (C) 1998, 1999 Theodore Ts'o.
*
* %Begin-Header%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, and the entire permission notice in its entirety,
* including the disclaimer of warranties.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
* WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
* %End-Header%
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef _WIN32
#define _WIN32_WINNT 0x0500
#include <windows.h>
#define UUID MYUUID
#endif
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h>
#include <sys/types.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <time.h>
#include "uuidP.h"
time_t uuid_time(const uuid_t uu, struct timeval *ret_tv)
{
struct timeval tv;
struct uuid uuid;
uint32_t high;
uint64_t clock_reg;
uuid_unpack(uu, &uuid);
high = uuid.time_mid | ((uint32_t)(uuid.time_hi_and_version & 0xFFF) << 16);
clock_reg = uuid.time_low | ((uint64_t) high << 32);
clock_reg -= (((uint64_t) 0x01B21DD2) << 32) + 0x13814000;
tv.tv_sec = clock_reg / 10000000;
tv.tv_usec = (clock_reg % 10000000) / 10;
if (ret_tv)
*ret_tv = tv;
return tv.tv_sec;
}
int uuid_type(const uuid_t uu)
{
struct uuid uuid;
uuid_unpack(uu, &uuid);
return ((uuid.time_hi_and_version >> 12) & 0xF);
}
int uuid_variant(const uuid_t uu)
{
struct uuid uuid;
int var;
uuid_unpack(uu, &uuid);
var = uuid.clock_seq;
if ((var & 0x8000) == 0)
return UUID_VARIANT_NCS;
if ((var & 0x4000) == 0)
return UUID_VARIANT_DCE;
if ((var & 0x2000) == 0)
return UUID_VARIANT_MICROSOFT;
return UUID_VARIANT_OTHER;
}
#ifdef DEBUG
static const char *variant_string(int variant)
{
switch (variant) {
case UUID_VARIANT_NCS:
return "NCS";
case UUID_VARIANT_DCE:
return "DCE";
case UUID_VARIANT_MICROSOFT:
return "Microsoft";
default:
return "Other";
}
}
int
main(int argc, char **argv)
{
uuid_t buf;
time_t time_reg;
struct timeval tv;
int type, variant;
if (argc != 2) {
fprintf(stderr, "Usage: %s uuid\n", argv[0]);
exit(1);
}
if (uuid_parse(argv[1], buf)) {
fprintf(stderr, "Invalid UUID: %s\n", argv[1]);
exit(1);
}
variant = uuid_variant(buf);
type = uuid_type(buf);
time_reg = uuid_time(buf, &tv);
printf("UUID variant is %d (%s)\n", variant, variant_string(variant));
if (variant != UUID_VARIANT_DCE) {
printf("Warning: This program only knows how to interpret "
"DCE UUIDs.\n\tThe rest of the output is likely "
"to be incorrect!!\n");
}
printf("UUID type is %d", type);
switch (type) {
case 1:
printf(" (time based)\n");
break;
case 2:
printf(" (DCE)\n");
break;
case 3:
printf(" (name-based)\n");
break;
case 4:
printf(" (random)\n");
break;
default:
printf("\n");
}
if (type != 1) {
printf("Warning: not a time-based UUID, so UUID time "
"decoding will likely not work!\n");
}
printf("UUID time is: (%ld, %ld): %s\n", tv.tv_sec, tv.tv_usec,
ctime(&time_reg));
return 0;
}
#endif
-53
View File
@@ -1,53 +0,0 @@
/*
* Definitions used by the uuidd daemon
*
* Copyright (C) 2007 Theodore Ts'o.
*
* %Begin-Header%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, and the entire permission notice in its entirety,
* including the disclaimer of warranties.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
* WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
* %End-Header%
*/
#ifndef _UUID_UUIDD_H
#define _UUID_UUIDD_H
#define UUIDD_SOCKET_PATH "/var/lib/libuuid/request"
#define UUIDD_PIDFILE_PATH "/var/lib/libuuid/uuidd.pid"
#define UUIDD_PATH "/usr/sbin/uuidd"
#define UUIDD_OP_GETPID 0
#define UUIDD_OP_GET_MAXOP 1
#define UUIDD_OP_TIME_UUID 2
#define UUIDD_OP_RANDOM_UUID 3
#define UUIDD_OP_BULK_TIME_UUID 4
#define UUIDD_OP_BULK_RANDOM_UUID 5
#define UUIDD_MAX_OP UUIDD_OP_BULK_RANDOM_UUID
extern void uuid__generate_time(uuid_t out, int *num);
extern void uuid__generate_random(uuid_t out, int *num);
#endif /* _UUID_UUID_H */
+13 -12
View File
@@ -8,7 +8,8 @@ cppflags: []
cxxflags:
- ${COVERAGE_COMPILER_FLAGS}
enabled-by: true
includes: []
includes:
- contrib/cpukit/uuid/
install:
- destination: ${BSP_INCLUDEDIR}
source:
@@ -477,7 +478,7 @@ install:
- cpukit/include/sys/utsname.h
- destination: ${BSP_INCLUDEDIR}/uuid
source:
- cpukit/include/uuid/uuid.h
- contrib/cpukit/uuid/uuid/uuid.h
install-path: ${BSP_LIBDIR}
links:
- role: build-dependency
@@ -984,16 +985,16 @@ source:
- cpukit/libmisc/untar/untar.c
- cpukit/libmisc/untar/untar_tgz.c
- cpukit/libmisc/untar/untar_txz.c
- cpukit/libmisc/uuid/clear.c
- cpukit/libmisc/uuid/compare.c
- cpukit/libmisc/uuid/copy.c
- cpukit/libmisc/uuid/gen_uuid.c
- cpukit/libmisc/uuid/isnull.c
- cpukit/libmisc/uuid/pack.c
- cpukit/libmisc/uuid/parse.c
- cpukit/libmisc/uuid/unpack.c
- cpukit/libmisc/uuid/unparse.c
- cpukit/libmisc/uuid/uuid_time.c
- contrib/cpukit/uuid/clear.c
- contrib/cpukit/uuid/compare.c
- contrib/cpukit/uuid/copy.c
- contrib/cpukit/uuid/gen_uuid.c
- contrib/cpukit/uuid/isnull.c
- contrib/cpukit/uuid/pack.c
- contrib/cpukit/uuid/parse.c
- contrib/cpukit/uuid/unpack.c
- contrib/cpukit/uuid/unparse.c
- contrib/cpukit/uuid/uuid_time.c
- cpukit/libstdthreads/call_once.c
- cpukit/libstdthreads/cnd.c
- cpukit/libstdthreads/mtx.c
+2 -1
View File
@@ -6,7 +6,8 @@ copyrights:
cppflags: []
cxxflags: []
enabled-by: true
includes: []
includes:
- contrib/cpukit/uuid/
install: []
links: []
source:
+2 -1
View File
@@ -7,7 +7,8 @@ cppflags: []
cxxflags: []
enabled-by: true
features: c cprogram
includes: []
includes:
- contrib/cpukit/uuid/
ldflags: []
links: []
source:
+2 -1
View File
@@ -7,7 +7,8 @@ cppflags: []
cxxflags: []
enabled-by: true
features: c cprogram
includes: []
includes:
- contrib/cpukit/uuid/
ldflags: []
links: []
source: