Source-Changes-HG archive

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

[src/trunk]: src/sbin/gpt allow 0 timestamp



details:   https://anonhg.NetBSD.org/src/rev/ec34b798e889
branches:  trunk
changeset: 821765:ec34b798e889
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Feb 16 22:40:19 2017 +0000

description:
allow 0 timestamp

diffstat:

 sbin/gpt/gpt.h      |   1 +
 sbin/gpt/gpt_uuid.c |  10 +++++-----
 sbin/gpt/main.c     |   5 +++--
 3 files changed, 9 insertions(+), 7 deletions(-)

diffs (69 lines):

diff -r efa46e7bad4b -r ec34b798e889 sbin/gpt/gpt.h
--- a/sbin/gpt/gpt.h    Thu Feb 16 22:10:50 2017 +0000
+++ b/sbin/gpt/gpt.h    Thu Feb 16 22:40:19 2017 +0000
@@ -80,6 +80,7 @@
 #define GPT_QUIET      0x04
 #define GPT_NOSYNC     0x08
 #define GPT_FILE       0x10
+#define GPT_TIMESTAMP  0x20
 
 void*  gpt_read(gpt_t, off_t, size_t);
 off_t  gpt_last(gpt_t);
diff -r efa46e7bad4b -r ec34b798e889 sbin/gpt/gpt_uuid.c
--- a/sbin/gpt/gpt_uuid.c       Thu Feb 16 22:10:50 2017 +0000
+++ b/sbin/gpt/gpt_uuid.c       Thu Feb 16 22:40:19 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gpt_uuid.c,v 1.14 2017/02/16 03:32:17 christos Exp $   */
+/*     $NetBSD: gpt_uuid.c,v 1.15 2017/02/16 22:40:19 christos Exp $   */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>
 #ifdef __RCSID
-__RCSID("$NetBSD: gpt_uuid.c,v 1.14 2017/02/16 03:32:17 christos Exp $");
+__RCSID("$NetBSD: gpt_uuid.c,v 1.15 2017/02/16 22:40:19 christos Exp $");
 #endif
 
 #include <err.h>
@@ -301,10 +301,10 @@
 {
        int rv;
        struct dce_uuid u;
-       if (gpt->timestamp == 0)
+       if (gpt->flags & GPT_TIMESTAMP)
+               rv = gpt_uuid_tstamp(gpt, &u, sizeof(u));
+       else
                rv = gpt_uuid_random(gpt, &u, sizeof(u));
-       else
-               rv = gpt_uuid_tstamp(gpt, &u, sizeof(u));
 
        if (rv == -1)
                return -1;
diff -r efa46e7bad4b -r ec34b798e889 sbin/gpt/main.c
--- a/sbin/gpt/main.c   Thu Feb 16 22:10:50 2017 +0000
+++ b/sbin/gpt/main.c   Thu Feb 16 22:40:19 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.9 2017/02/16 03:32:17 christos Exp $        */
+/*     $NetBSD: main.c,v 1.10 2017/02/16 22:40:19 christos Exp $       */
 
 /*-
  * Copyright (c) 2002 Marcel Moolenaar
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 #ifdef __RCSID
-__RCSID("$NetBSD: main.c,v 1.9 2017/02/16 03:32:17 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.10 2017/02/16 22:40:19 christos Exp $");
 #endif
 
 #include <stdio.h>
@@ -206,6 +206,7 @@
                                usage();
                        break;
                case 'T':
+                       flags |= GPT_TIMESTAMP;
                        timestamp = get_tstamp(optarg);
                        break;
                case 'v':



Home | Main Index | Thread Index | Old Index