]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Use C99 stdint.h types instead of custom types in the uuid library.
authorTheodore Ts'o <tytso@mit.edu>
Sat, 3 Apr 2004 15:20:26 +0000 (10:20 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 3 Apr 2004 15:20:26 +0000 (10:20 -0500)
15 files changed:
ChangeLog
configure
configure.in
lib/blkid/ChangeLog
lib/blkid/blkid_types.h.in
lib/ext2fs/ChangeLog
lib/ext2fs/ext2_types.h.in
lib/uuid/ChangeLog
lib/uuid/Makefile.in
lib/uuid/gen_uuid.c
lib/uuid/pack.c
lib/uuid/unpack.c
lib/uuid/uuidP.h
lib/uuid/uuid_time.c
lib/uuid/uuid_types.h.in

index f4f22b60dca263f629d84dddafd24787e241c58c..26fe6b9634341daf4bf69875df500e87ce2d29c4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2004-04-03  Theodore Ts'o  <tytso@mit.edu>
+
+       * configure.in: Add test for stdint.h
+
 2004-03-19  Theodore Ts'o  <tytso@mit.edu>
 
        * configure.in: Add tests for sa_len in struct sockaddr and test
index 9ef118019561c8c7f86a4bc8f3b53ed5ff30f154..456760d9225679c365ba41515d848c8801acac94 100644 (file)
--- a/configure
+++ b/configure
@@ -5272,7 +5272,7 @@ test -n "$BUILD_CC" && break
 done
 
 fi
-for ac_hdr in stdlib.h unistd.h stdarg.h errno.h malloc.h mntent.h paths.h dirent.h getopt.h setjmp.h signal.h termios.h linux/fd.h linux/major.h sys/disk.h sys/disklabel.h sys/ioctl.h sys/mkdev.h sys/mount.h sys/sockio.h sys/socket.h sys/sysmacros.h sys/time.h sys/stat.h sys/types.h sys/wait.h sys/resource.h net/if.h net/if_dl.h netinet/in.h
+for ac_hdr in stdlib.h unistd.h stdarg.h stdint.h errno.h malloc.h mntent.h paths.h dirent.h getopt.h setjmp.h signal.h termios.h linux/fd.h linux/major.h sys/disk.h sys/disklabel.h sys/ioctl.h sys/mkdev.h sys/mount.h sys/sockio.h sys/socket.h sys/sysmacros.h sys/time.h sys/stat.h sys/types.h sys/wait.h sys/resource.h net/if.h net/if_dl.h netinet/in.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
index 4d05a1b707726460140a24bac6f1eb7f1eb3f359..04dbd16815d0de86fad87b01ffa63265e243c28e 100644 (file)
@@ -586,7 +586,7 @@ if test $cross_compiling = no; then
 else
   AC_CHECK_PROGS(BUILD_CC, gcc cc)
 fi
-AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h errno.h malloc.h mntent.h paths.h dirent.h getopt.h setjmp.h signal.h termios.h linux/fd.h linux/major.h sys/disk.h sys/disklabel.h sys/ioctl.h sys/mkdev.h sys/mount.h sys/sockio.h sys/socket.h sys/sysmacros.h sys/time.h sys/stat.h sys/types.h sys/wait.h sys/resource.h net/if.h net/if_dl.h netinet/in.h)
+AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h stdint.h errno.h malloc.h mntent.h paths.h dirent.h getopt.h setjmp.h signal.h termios.h linux/fd.h linux/major.h sys/disk.h sys/disklabel.h sys/ioctl.h sys/mkdev.h sys/mount.h sys/sockio.h sys/socket.h sys/sysmacros.h sys/time.h sys/stat.h sys/types.h sys/wait.h sys/resource.h net/if.h net/if_dl.h netinet/in.h)
 AC_FUNC_VPRINTF
 dnl Check to see if dirent has member d_reclen. On cygwin those d_reclen
 dnl is not decleared.
index 544c0dfe67ba3973aef9a79beeb24d227ed9384e..cd26bbfd64cef9c6718022a0d678eb0c0ed89ed3 100644 (file)
@@ -1,3 +1,8 @@
+2004-04-03  Theodore Ts'o  <tytso@mit.edu>
+
+       * blkid_types.h.in: Remove check for _UUID_TYPES since uuid_types.h
+               is no longer used.
+
 2004-03-21  Theodore Ts'o  <tytso@mit.edu>
 
        * getsize.c (blkid_get_dev_size): Don't close the file descriptor
index 15284070ff7958ca3624ef472a285c0ec9f51a2c..0fde69fa6b4bb2d638dc6518821168f711fee391 100644 (file)
@@ -4,7 +4,7 @@
  * also defined the types that we need.
  */
 #if (!defined(_LINUX_TYPES_H) && !defined(_BLKID_TYPES_H) && \
-       !defined(_UUID_TYPES) && !defined(_EXT2_TYPES_H))
+       !defined(_EXT2_TYPES_H))
 #define _BLKID_TYPES_H
 
 typedef unsigned char __u8;
index 68bd13ba8913b0131d0538dd28a779dac63b257d..d2176d6698744dda741e1d774f1e72359649844b 100644 (file)
@@ -1,3 +1,8 @@
+2004-04-03  Theodore Ts'o  <tytso@mit.edu>
+
+       * ext2_types.h.in: Remove check for _UUID_TYPES since uuid_types.h
+               is no longer used.
+
 2004-03-08  Theodore Ts'o  <tytso@mit.edu>
 
        * getsize.c (ext2fs_get_device_size): Only use the BLKGETSIZE64
index 56897dd5b76926d93d3432b70dc712dcded02895..a3e16d0a37baecc6416caaa154afd63a7fb1ac4a 100644 (file)
@@ -4,7 +4,7 @@
  * also defined the types that we need.
  */
 #if (!defined(_LINUX_TYPES_H) && !defined(_BLKID_TYPES_H) && \
-       !defined(_UUID_TYPES) && !defined(_EXT2_TYPES_H))
+       !defined(_EXT2_TYPES_H))
 #define _EXT2_TYPES_H
 
 typedef unsigned char __u8;
index 1529cc3c9033ed71ce076b9077fe2028594abe2e..c7a7c336e5912c31b630d177ed2b38c524bbbce5 100644 (file)
@@ -1,3 +1,8 @@
+2004-04-03  Theodore Ts'o  <tytso@mit.edu>
+
+       * gen_uuid.c, pack.c, unpack.c, uuid_time.c, uuidP.h,
+               uuid_types.h.in: Use ANSI C99 types if stdint.h exists.
+
 2004-03-30  Theodore Ts'o  <tytso@mit.edu>
 
        * gen_uuid.c (get_node_id): Clean up AF_LINK #ifdef's for Darwin.
index b36ce7e3065c63f695d6684d2a38fada2c988d44..ba9326a36bbe763d84a945b3956efa63fa258aed 100644 (file)
@@ -130,7 +130,6 @@ install:: all installdirs
        -$(RANLIB) $(DESTDIR)$(libdir)/libuuid.a
        $(CHMOD) $(LIBMODE) $(DESTDIR)$(libdir)/libuuid.a
        $(INSTALL_DATA) $(srcdir)/uuid.h $(DESTDIR)$(includedir)/uuid/uuid.h
-       $(INSTALL_DATA) uuid_types.h $(DESTDIR)$(includedir)/uuid/uuid_types.h
        for i in $(SMANPAGES); do \
                $(RM) -f $(DESTDIR)$(man3dir)/$$i.gz; \
                $(INSTALL_DATA) $$i $(DESTDIR)$(man3dir)/$$i; \
index b58485bab98cd04ac200d7c675bccc4b80653b0b..3493649648bfcc16dd23f458e8e67f71c72bfb7e 100644 (file)
@@ -219,11 +219,11 @@ static int get_node_id(unsigned char *node_id)
 /* Assume that the gettimeofday() has microsecond granularity */
 #define MAX_ADJUSTMENT 10
 
-static int get_clock(__u32 *clock_high, __u32 *clock_low, __u16 *ret_clock_seq)
+static int get_clock(uint32_t *clock_high, uint32_t *clock_low, uint16_t *ret_clock_seq)
 {
        static int                      adjustment = 0;
        static struct timeval           last = {0, 0};
-       static __u16                    clock_seq;
+       static uint16_t                 clock_seq;
        struct timeval                  tv;
        unsigned long long              clock_reg;
        
@@ -266,7 +266,7 @@ void uuid_generate_time(uuid_t out)
        static unsigned char node_id[6];
        static int has_init = 0;
        struct uuid uu;
-       __u32   clock_mid;
+       uint32_t        clock_mid;
 
        if (!has_init) {
                if (get_node_id(node_id) <= 0) {
@@ -282,7 +282,7 @@ void uuid_generate_time(uuid_t out)
        }
        get_clock(&clock_mid, &uu.time_low, &uu.clock_seq);
        uu.clock_seq |= 0x8000;
-       uu.time_mid = (__u16) clock_mid;
+       uu.time_mid = (uint16_t) clock_mid;
        uu.time_hi_and_version = (clock_mid >> 16) | 0x1000;
        memcpy(uu.node, node_id, 6);
        uuid_pack(&uu, out);
index 65f72da08f493c7eb3a9d593badb75d6f1da31ec..348d432135d5d120bb6b0d58b8d7a3a5f8c55de9 100644 (file)
@@ -37,7 +37,7 @@
 
 void uuid_pack(const struct uuid *uu, uuid_t ptr)
 {
-       __u32   tmp;
+       uint32_t        tmp;
        unsigned char   *out = ptr;
 
        tmp = uu->time_low;
index b65cd28b139777e0255ffa3ad510b8f3fd2622d3..9502fc2a6413260d19a36a311ce4a177b284569b 100644 (file)
@@ -37,8 +37,8 @@
 
 void uuid_unpack(const uuid_t in, struct uuid *uu)
 {
-       const __u8      *ptr = in;
-       __u32           tmp;
+       const uint8_t   *ptr = in;
+       uint32_t                tmp;
 
        tmp = *ptr++;
        tmp = (tmp << 8) | *ptr++;
index 3da1df281e2a4b0d89e173cd56c115ccfb61ff92..d207d3a5f95bf93bb93c1d6475180088edf3517d 100644 (file)
  * %End-Header%
  */
 
-#include <sys/types.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#else
 #include <uuid/uuid_types.h>
+#endif
+#include <sys/types.h>
 
 #include "uuid.h"
 
 #define TIME_OFFSET_LOW  0x13814000
 
 struct uuid {
-       __u32   time_low;
-       __u16   time_mid;
-       __u16   time_hi_and_version;
-       __u16   clock_seq;
-       __u8    node[6];
+       uint32_t        time_low;
+       uint16_t        time_mid;
+       uint16_t        time_hi_and_version;
+       uint16_t        clock_seq;
+       uint8_t node[6];
 };
 
 
index 8cd833e56a1b44bec8de0a27f73d946028676ef7..d5f992b3935de4a67c9b7e186fd6f5a46734077e 100644 (file)
@@ -46,7 +46,7 @@
 time_t uuid_time(const uuid_t uu, struct timeval *ret_tv)
 {
        struct uuid             uuid;
-       __u32                   high;
+       uint32_t                        high;
        struct timeval          tv;
        unsigned long long      clock_reg;
 
index ba67feaf91b2fc3128bd0f96abba8980e71c02f8..f21ff4ee183e77e51b30457b1ae1d934b1c140c0 100644 (file)
@@ -3,49 +3,48 @@
  * everything we need.  (cross fingers)  Other header files may have 
  * also defined the types that we need.
  */
-#if (!defined(_LINUX_TYPES_H) && !defined(_BLKID_TYPES_H) && \
-       !defined(_UUID_TYPES) && !defined(_EXT2_TYPES_H))
-#define _UUID_TYPES_H
+#if (!defined(_STDINT_H) && !defined(_UUID_STDINT_H))
+#define _UUID_STDINT_H
 
-typedef unsigned char __u8;
-typedef signed char __s8;
+typedef unsigned char uint8_t;
+typedef signed char int8_t;
 
 #if (@SIZEOF_INT@ == 8)
-typedef int            __s64;
-typedef unsigned int   __u64;
+typedef int            int64_t;
+typedef unsigned int   uint64_t;
 #elif (@SIZEOF_LONG@ == 8)
-typedef long           __s64;
-typedef unsigned long  __u64;
+typedef long           int64_t;
+typedef unsigned long  uint64_t;
 #elif (@SIZEOF_LONG_LONG@ == 8)
 #if defined(__GNUC__)
-typedef __signed__ long long   __s64;
+typedef __signed__ long long   int64_t;
 #else
-typedef signed long long       __s64;
+typedef signed long long       int64_t;
 #endif
-typedef unsigned long long     __u64;
+typedef unsigned long long     uint64_t;
 #endif
 
 #if (@SIZEOF_INT@ == 2)
-typedef        int             __s16;
-typedef        unsigned int    __u16;
+typedef        int             int16_t;
+typedef        unsigned int    uint16_t;
 #elif (@SIZEOF_SHORT@ == 2)
-typedef        short           __s16;
-typedef        unsigned short  __u16;
+typedef        short           int16_t;
+typedef        unsigned short  uint16_t;
 #else
   ?==error: undefined 16 bit type
 #endif
 
 #if (@SIZEOF_INT@ == 4)
-typedef        int             __s32;
-typedef        unsigned int    __u32;
+typedef        int             int32_t;
+typedef        unsigned int    uint32_t;
 #elif (@SIZEOF_LONG@ == 4)
-typedef        long            __s32;
-typedef        unsigned long   __u32;
+typedef        long            int32_t;
+typedef        unsigned long   uint32_t;
 #elif (@SIZEOF_SHORT@ == 4)
-typedef        short           __s32;
-typedef        unsigned short  __u32;
+typedef        short           int32_t;
+typedef        unsigned short  uint32_t;
 #else
  ?== error: undefined 32 bit type
 #endif
 
-#endif /* _*_TYPES_H */
+#endif