Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src DCE 1.1 RPC compatible UUID routines for libc, adapted from ...



details:   https://anonhg.NetBSD.org/src/rev/a1990431fb36
branches:  trunk
changeset: 569927:a1990431fb36
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Sep 13 21:44:54 2004 +0000

description:
DCE 1.1 RPC compatible UUID routines for libc, adapted from FreeBSD.
Encode/decode to big/little endian binary blob routines adapted from
kernel.

PR 23470.

diffstat:

 distrib/sets/lists/base/shl.mi   |    6 +-
 distrib/sets/lists/comp/mi       |   29 +++++-
 include/Makefile                 |    4 +-
 include/uuid.h                   |   60 ++++++++++
 lib/libc/Makefile                |    3 +-
 lib/libc/shlib_version           |    4 +-
 lib/libc/uuid/Makefile.inc       |   25 ++++
 lib/libc/uuid/uuid.3             |  214 +++++++++++++++++++++++++++++++++++++++
 lib/libc/uuid/uuid_compare.c     |   87 +++++++++++++++
 lib/libc/uuid/uuid_create.c      |   58 ++++++++++
 lib/libc/uuid/uuid_create_nil.c  |   55 ++++++++++
 lib/libc/uuid/uuid_equal.c       |   64 +++++++++++
 lib/libc/uuid/uuid_from_string.c |  101 ++++++++++++++++++
 lib/libc/uuid/uuid_hash.c        |   58 ++++++++++
 lib/libc/uuid/uuid_is_nil.c      |   59 ++++++++++
 lib/libc/uuid/uuid_stream.c      |  117 +++++++++++++++++++++
 lib/libc/uuid/uuid_to_string.c   |   76 +++++++++++++
 17 files changed, 1011 insertions(+), 9 deletions(-)

diffs (truncated from 1150 to 300 lines):

diff -r c721145bec2a -r a1990431fb36 distrib/sets/lists/base/shl.mi
--- a/distrib/sets/lists/base/shl.mi    Mon Sep 13 20:09:44 2004 +0000
+++ b/distrib/sets/lists/base/shl.mi    Mon Sep 13 21:44:54 2004 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: shl.mi,v 1.279 2004/08/08 07:39:34 provos Exp $
+# $NetBSD: shl.mi,v 1.280 2004/09/13 21:44:54 thorpej Exp $
 # Note: libtermcap and libtermlib are hardlinked and share the same version.
-./lib/libc.so.12.122                           base-sys-shlib
+./lib/libc.so.12.123                           base-sys-shlib
 ./lib/libcrypt.so.0.1                          base-sys-shlib
 ./lib/libcrypto.so.2.1                         base-crypto-shlib       crypto
 ./lib/libedit.so.2.9                           base-sys-shlib
@@ -32,7 +32,7 @@
 ./usr/lib/libasn1.so.6.1                       base-krb5-shlib         kerberos
 ./usr/lib/libbsdmalloc.so.0.0                  base-sys-shlib
 ./usr/lib/libbz2.so.1.0                                base-sys-shlib
-./usr/lib/libc.so.12.122                       base-sys-shlib
+./usr/lib/libc.so.12.123                       base-sys-shlib
 ./usr/lib/libcdk.so.1.0                                base-sys-shlib
 ./usr/lib/libcom_err.so.4.1                    base-krb5-shlib         kerberos
 ./usr/lib/libcrypt.so.0.1                      base-sys-shlib
diff -r c721145bec2a -r a1990431fb36 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi        Mon Sep 13 20:09:44 2004 +0000
+++ b/distrib/sets/lists/comp/mi        Mon Sep 13 21:44:54 2004 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: mi,v 1.729 2004/09/07 12:28:34 taca Exp $
+#      $NetBSD: mi,v 1.730 2004/09/13 21:44:54 thorpej Exp $
 ./etc/mtree/set.comp                           comp-sys-root
 ./usr/bin/addr2line                            comp-debug-bin          bfd
 ./usr/bin/ar                                   comp-util-bin           bfd
@@ -1461,6 +1461,7 @@
 ./usr/include/utime.h                          comp-c-include
 ./usr/include/utmp.h                           comp-c-include
 ./usr/include/utmpx.h                          comp-c-include
+./usr/include/uuid.h                           comp-c-include
 ./usr/include/uvm/uvm.h                                comp-c-include
 ./usr/include/uvm/uvm_amap.h                   comp-c-include
 ./usr/include/uvm/uvm_amap_i.h                 comp-c-include
@@ -4427,6 +4428,19 @@
 ./usr/share/man/cat3/util.0                    comp-c-catman           .cat
 ./usr/share/man/cat3/utime.0                   comp-c-catman           .cat
 ./usr/share/man/cat3/utmpxname.0               comp-c-catman           .cat
+./usr/share/man/cat3/uuid.0                    comp-c-catman           .cat
+./usr/share/man/cat3/uuid_compare.0            comp-c-catman           .cat
+./usr/share/man/cat3/uuid_create.0             comp-c-catman           .cat
+./usr/share/man/cat3/uuid_create_nil.0         comp-c-catman           .cat
+./usr/share/man/cat3/uuid_dec_be.0             comp-c-catman           .cat
+./usr/share/man/cat3/uuid_dec_le.0             comp-c-catman           .cat
+./usr/share/man/cat3/uuid_enc_be.0             comp-c-catman           .cat
+./usr/share/man/cat3/uuid_enc_le.0             comp-c-catman           .cat
+./usr/share/man/cat3/uuid_equal.0              comp-c-catman           .cat
+./usr/share/man/cat3/uuid_from_string.0                comp-c-catman           .cat
+./usr/share/man/cat3/uuid_hash.0               comp-c-catman           .cat
+./usr/share/man/cat3/uuid_is_nil.0             comp-c-catman           .cat
+./usr/share/man/cat3/uuid_to_string.0          comp-c-catman           .cat
 ./usr/share/man/cat3/va_arg.0                  comp-c-catman           .cat
 ./usr/share/man/cat3/va_copy.0                 comp-c-catman           .cat
 ./usr/share/man/cat3/va_end.0                  comp-c-catman           .cat
@@ -8174,6 +8188,19 @@
 ./usr/share/man/man3/util.3                    comp-c-man              .man
 ./usr/share/man/man3/utime.3                   comp-c-man              .man
 ./usr/share/man/man3/utmpxname.3               comp-c-man              .man
+./usr/share/man/man3/uuid.0                    comp-c-man              .man
+./usr/share/man/man3/uuid_compare.0            comp-c-man              .man
+./usr/share/man/man3/uuid_create.0             comp-c-man              .man
+./usr/share/man/man3/uuid_create_nil.0         comp-c-man              .man
+./usr/share/man/man3/uuid_dec_be.0             comp-c-man              .man
+./usr/share/man/man3/uuid_dec_le.0             comp-c-man              .man
+./usr/share/man/man3/uuid_enc_be.0             comp-c-man              .man
+./usr/share/man/man3/uuid_enc_le.0             comp-c-man              .man
+./usr/share/man/man3/uuid_equal.0              comp-c-man              .man
+./usr/share/man/man3/uuid_from_string.0                comp-c-man              .man
+./usr/share/man/man3/uuid_hash.0               comp-c-man              .man
+./usr/share/man/man3/uuid_is_nil.0             comp-c-man              .man
+./usr/share/man/man3/uuid_to_string.0          comp-c-man              .man
 ./usr/share/man/man3/va_arg.3                  comp-c-man              .man
 ./usr/share/man/man3/va_copy.3                 comp-c-man              .man
 ./usr/share/man/man3/va_end.3                  comp-c-man              .man
diff -r c721145bec2a -r a1990431fb36 include/Makefile
--- a/include/Makefile  Mon Sep 13 20:09:44 2004 +0000
+++ b/include/Makefile  Mon Sep 13 21:44:54 2004 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.117 2004/07/13 15:42:03 seb Exp $
+#      $NetBSD: Makefile,v 1.118 2004/09/13 21:44:54 thorpej Exp $
 #      @(#)Makefile    8.2 (Berkeley) 1/4/94
 
 # Doing a make includes builds /usr/include
@@ -20,7 +20,7 @@
        sgtty.h signal.h stab.h stddef.h stdio.h stdlib.h string.h \
        strings.h stringlist.h struct.h sysexits.h tar.h threadlib.h time.h \
        ttyent.h tzfile.h ucontext.h ulimit.h unistd.h util.h utime.h utmp.h \
-       utmpx.h varargs.h vis.h wchar.h wctype.h wordexp.h
+       utmpx.h uuid.h varargs.h vis.h wchar.h wctype.h wordexp.h
 INCS+= arpa/ftp.h arpa/inet.h arpa/nameser.h arpa/nameser_compat.h \
        arpa/telnet.h arpa/tftp.h
 INCS+= protocols/dumprestore.h protocols/routed.h protocols/rwhod.h \
diff -r c721145bec2a -r a1990431fb36 include/uuid.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/include/uuid.h    Mon Sep 13 21:44:54 2004 +0000
@@ -0,0 +1,60 @@
+/*     $NetBSD: uuid.h,v 1.1 2004/09/13 21:44:54 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 2002 Marcel Moolenaar
+ * Copyright (c) 2002 Hiten Mahesh Pandya
+ * All rights reserved.
+ *
+ * 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, this list of conditions and the following disclaimer.
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS 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 ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: src/include/uuid.h,v 1.2 2002/11/05 10:55:16 jmallett Exp $
+ */
+
+#ifndef _UUID_H_
+#define        _UUID_H_
+
+#include <sys/types.h>
+#include <sys/uuid.h>
+
+/* Status codes returned by the functions. */
+#define        uuid_s_ok                       0
+#define        uuid_s_bad_version              1
+#define        uuid_s_invalid_string_uuid      2
+#define        uuid_s_no_memory                3
+
+__BEGIN_DECLS
+int32_t        uuid_compare(uuid_t *, uuid_t *, uint32_t *);
+void   uuid_create(uuid_t *, uint32_t *);
+void   uuid_create_nil(uuid_t *, uint32_t *);
+int32_t        uuid_equal(uuid_t *, uuid_t *, uint32_t *);
+void   uuid_from_string(const char *, uuid_t *, uint32_t *);
+uint16_t uuid_hash(uuid_t *, uint32_t *);
+int32_t        uuid_is_nil(uuid_t *, uint32_t *);
+void   uuid_to_string(uuid_t *, char **, uint32_t *);
+
+void   uuid_enc_le(void *, const uuid_t *);
+void   uuid_dec_le(const void *, uuid_t *);
+void   uuid_enc_be(void *, const uuid_t *);
+void   uuid_dec_be(const void *, uuid_t *);
+__END_DECLS
+
+#endif /* _UUID_H_ */
diff -r c721145bec2a -r a1990431fb36 lib/libc/Makefile
--- a/lib/libc/Makefile Mon Sep 13 20:09:44 2004 +0000
+++ b/lib/libc/Makefile Mon Sep 13 21:44:54 2004 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.118 2004/07/31 14:13:05 lukem Exp $
+#      $NetBSD: Makefile,v 1.119 2004/09/13 21:44:54 thorpej Exp $
 #      @(#)Makefile    8.2 (Berkeley) 2/3/94
 #
 # All library objects contain sccsid strings by default; they may be
@@ -110,6 +110,7 @@
 .include "${.CURDIR}/thread-stub/Makefile.inc"
 .include "${.CURDIR}/time/Makefile.inc"
 .include "${.CURDIR}/sys/Makefile.inc"
+.include "${.CURDIR}/uuid/Makefile.inc"
 .if (${MKYP} != "no")
 .include "${.CURDIR}/yp/Makefile.inc"
 .endif
diff -r c721145bec2a -r a1990431fb36 lib/libc/shlib_version
--- a/lib/libc/shlib_version    Mon Sep 13 20:09:44 2004 +0000
+++ b/lib/libc/shlib_version    Mon Sep 13 21:44:54 2004 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: shlib_version,v 1.157 2004/07/13 15:45:18 seb Exp $
+#      $NetBSD: shlib_version,v 1.158 2004/09/13 21:44:54 thorpej Exp $
 #      Remember to update distrib/sets/lists/base/shl.* when changing
 #
 # things we wish to do on next major version bump:
@@ -17,4 +17,4 @@
 # - libc/net/getnet{ent,namadr}.c, netdb.h: remove __n_pad0
 #
 major=12
-minor=122
+minor=123
diff -r c721145bec2a -r a1990431fb36 lib/libc/uuid/Makefile.inc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/uuid/Makefile.inc        Mon Sep 13 21:44:54 2004 +0000
@@ -0,0 +1,25 @@
+#      $NetBSD: Makefile.inc,v 1.1 2004/09/13 21:44:54 thorpej Exp $
+
+# DCE 1.1 compatible UUID implementation sources
+
+.PATH: ${.CURDIR}/uuid
+
+SRCS+= uuid_compare.c uuid_create.c uuid_create_nil.c uuid_equal.c \
+       uuid_from_string.c uuid_hash.c uuid_is_nil.c uuid_stream.c \
+       uuid_to_string.c
+
+MAN+=  uuid.3
+
+MLINKS+=uuid.3 uuid_compare.3
+MLINKS+=uuid.3 uuid_create.3
+MLINKS+=uuid.3 uuid_create_nil.3
+MLINKS+=uuid.3 uuid_equal.3
+MLINKS+=uuid.3 uuid_from_string.3
+MLINKS+=uuid.3 uuid_hash.3
+MLINKS+=uuid.3 uuid_is_nil.3
+MLINKS+=uuid.3 uuid_to_string.3
+
+MLINKS+=uuid.3 uuid_enc_le.3
+MLINKS+=uuid.3 uuid_dec_le.3
+MLINKS+=uuid.3 uuid_enc_be.3
+MLINKS+=uuid.3 uuid_dec_be.3
diff -r c721145bec2a -r a1990431fb36 lib/libc/uuid/uuid.3
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/uuid/uuid.3      Mon Sep 13 21:44:54 2004 +0000
@@ -0,0 +1,214 @@
+.\"    $NetBSD: uuid.3,v 1.1 2004/09/13 21:44:54 thorpej Exp $
+.\"
+.\" Copyright (c) 2004 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Jason R. Thorpe.
+.\"
+.\" 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, this list of conditions and the following disclaimer.
+.\" 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. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"        This product includes software developed by the NetBSD
+.\"        Foundation, Inc. and its contributors.
+.\" 4. Neither the name of The NetBSD Foundation nor the names of its
+.\"    contributors may be used to endorse or promote products derived
+.\"    from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" 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 ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" Copyright (c) 2002 Marcel Moolenaar
+.\" Copyright (c) 2002 Hiten Mahesh Pandya
+.\" All rights reserved.
+.\"
+.\" 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, this list of conditions and the following disclaimer.
+.\" 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.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 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 ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD: src/lib/libc/uuid/uuid.3,v 1.4 2003/08/08 19:12:28 marcel Exp $
+.\"
+.Dd September 12, 2004
+.Dt UUID 3
+.Os
+.Sh NAME
+.Nm uuid_compare , uuid_create , uuid_create_nil , uuid_equal ,
+.Nm uuid_from_string , uuid_hash , uuid_is_nil , uuid_to_string ,
+.Nm uuid_enc_le , uuid_dec_le , uuid_enc_be , uuid_dec_be
+.Nd Universally Unique Identifier routines
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In uuid.h



Home | Main Index | Thread Index | Old Index