\input texinfo @c -*-texinfo-*-
@c %**start of header
@setfilename libext2fs.info
-@settitle The EXT2FS Library (version 1.12)
+@settitle The EXT2FS Library (version 1.13)
@synindex tp fn
@comment %**end of header
@title The EXT2FS Library
@subtitle The EXT2FS Library
-@subtitle Version 1.12
+@subtitle Version 1.13
@subtitle July 1998
@author by Theodore Ts'o
@top The EXT2FS Library
-This manual documents the EXT2FS Library, version 1.12.
+This manual documents the EXT2FS Library, version 1.13.
@end ifinfo
+1998-12-04 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * Makefile.in: Update version numbers of the UUID shared library,
+ since we've added a new function (uuid_time()).
+
+ * uuid_time.c: New file which returns the time field of a UUID.
+ (Good for debugging purposes)
+
1998-07-09 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Release of E2fsprogs 1.12
pack.o \
parse.o \
unpack.o \
- unparse.o
+ unparse.o \
+ uuid_time.o
SRCS= $(srcdir)/clear.c \
$(srcdir)/compare.c \
$(srcdir)/pack.c \
$(srcdir)/parse.c \
$(srcdir)/unpack.c \
- $(srcdir)/unparse.c
+ $(srcdir)/unparse.c \
+ $(srcdir)/uuid_time.c
LIBRARY= libuuid
LIBDIR= uuid
DLL_ADDRESS = 0x67900000
DLL_JUMPSIZE = 0x1000
DLL_GOTSIZE = 0x1000
-DLL_VERSION = 0.0
+DLL_VERSION = 0.1
DLL_IMAGE = libuuid
DLL_STUB = libuuid
DLL_MYDIR = uuid
DLL_INSTALL_DIR = $(root_libdir)
-ELF_VERSION = 1.1
+ELF_VERSION = 1.2
ELF_SO_VERSION = 1
ELF_IMAGE = libuuid
ELF_MYDIR = uuid
ELF_INSTALL_DIR = $(root_libdir)
ELF_OTHER_LIBS = -lc
-BSDLIB_VERSION = 1.0
+BSDLIB_VERSION = 1.1
BSDLIB_IMAGE = libuuid
BSDLIB_MYDIR = uuid
BSDLIB_INSTALL_DIR = $(root_libdir)
@ELF_CMT@ $(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $<
@BSDLIB_CMT@ $(CC) $(ALL_CFLAGS) -fpic -o pic/$*.o -c $<
-all:: tst_uuid
+all:: tst_uuid uuid_time
tst_uuid.o: $(srcdir)/tst_uuid.c
$(CC) $(ALL_CFLAGS) -c $(srcdir)/tst_uuid.c -o tst_uuid.o
tst_uuid: tst_uuid.o $(LIBUUID)
$(CC) $(ALL_LDFLAGS) -o tst_uuid tst_uuid.o $(LIBUUID)
+uuid_time: $(srcdir)/uuid_time.c
+ $(CC) $(ALL_CFLAGS) -DDEBUG $(srcdir)/uuid_time.c -o uuid_time $(LIBUUID)
+
installdirs::
$(top_srcdir)/mkinstalldirs $(DESTDIR)$(libdir) \
$(DESTDIR)$(includedir)/uuid
clean::
$(RM) -f \#* *.s *.o *.a *~ *.bak core profiled/* checker/*
- $(RM) -f ../libuuid.a ../libuuid_p.a tst_uuid
+ $(RM) -f ../libuuid.a ../libuuid_p.a tst_uuid uuid_time
mostlyclean:: clean
distclean:: clean
/*
* tst_uuid.c --- test program from the UUID library
*
- * Copyright (C) 1996, 1997 Theodore Ts'o.
+ * Copyright (C) 1996, 1997, 1998 Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
{
uuid_t buf, tst;
char str[100];
+ struct timeval tv;
+ time_t time_reg;
unsigned char *cp;
int i;
int failed = 0;
printf("%02x", *cp++);
}
printf("\n");
+ tv.tv_sec = 0;
+ tv.tv_usec = 0;
+ time_reg = uuid_time(buf, &tv);
+ printf("UUID time is: (%d, %d): %s\n", tv.tv_sec, tv.tv_usec,
+ ctime(&time_reg));
uuid_parse(str, tst);
if (uuid_compare(buf, tst))
printf("UUID parse and compare succeeded.\n");
/*
* Public include file for the UUID library
*
- * Copyright (C) 1996, 1997 Theodore Ts'o.
+ * Copyright (C) 1996, 1997, 1998 Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* %End-Header%
*/
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
typedef unsigned char uuid_t[16];
/* clear.c */
/* unparse.c */
void uuid_unparse(uuid_t uu, char *out);
+/* uuid_time.c */
+time_t uuid_time(uuid_t uu, struct timeval *ret_tv);
--- /dev/null
+/*
+ * uuid_time.c --- Interpret the time field from a uuid
+ *
+ * Copyright (C) 1998 Theodore Ts'o.
+ *
+ * %Begin-Header%
+ * This file may be redistributed under the terms of the GNU Public
+ * License.
+ * %End-Header%
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+#include <linux/ext2_fs.h>
+
+#include "uuidP.h"
+
+time_t uuid_time(uuid_t uu, struct timeval *ret_tv)
+{
+ struct uuid uuid;
+ __u32 high;
+ struct timeval tv;
+ unsigned long long clock_reg;
+
+ uuid_unpack(uu, &uuid);
+
+ high = uuid.time_mid | ((uuid.time_hi_and_version & 0xFFF) << 16);
+ clock_reg = uuid.time_low | ((unsigned long long) high << 32);
+
+ clock_reg -= (((unsigned long long) 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;
+}
+
+#ifdef DEBUG
+int
+main(int argc, char **argv)
+{
+ uuid_t buf;
+ time_t time_reg;
+ struct timeval tv;
+
+ 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);
+ }
+ time_reg = uuid_time(buf, &tv);
+
+ printf("UUID time is: (%d, %d): %s\n", tv.tv_sec, tv.tv_usec,
+ ctime(&time_reg));
+
+ return 0;
+}
+#endif