Module Name: src
Committed By: christos
Date: Thu Feb 16 22:40:19 UTC 2017
Modified Files:
src/sbin/gpt: gpt.h gpt_uuid.c main.c
Log Message:
allow 0 timestamp
To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sbin/gpt/gpt.h
cvs rdiff -u -r1.14 -r1.15 src/sbin/gpt/gpt_uuid.c
cvs rdiff -u -r1.9 -r1.10 src/sbin/gpt/main.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/gpt/gpt.h
diff -u src/sbin/gpt/gpt.h:1.34 src/sbin/gpt/gpt.h:1.35
--- src/sbin/gpt/gpt.h:1.34 Wed Feb 15 22:32:17 2017
+++ src/sbin/gpt/gpt.h Thu Feb 16 17:40:19 2017
@@ -80,6 +80,7 @@ gpt_t gpt_open(const char *, int, int, o
#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);
Index: src/sbin/gpt/gpt_uuid.c
diff -u src/sbin/gpt/gpt_uuid.c:1.14 src/sbin/gpt/gpt_uuid.c:1.15
--- src/sbin/gpt/gpt_uuid.c:1.14 Wed Feb 15 22:32:17 2017
+++ src/sbin/gpt/gpt_uuid.c Thu Feb 16 17:40:19 2017
@@ -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 @@ gpt_uuid_generate(gpt_t gpt, gpt_uuid_t
{
int rv;
struct dce_uuid u;
- if (gpt->timestamp == 0)
- rv = gpt_uuid_random(gpt, &u, sizeof(u));
- else
+ if (gpt->flags & GPT_TIMESTAMP)
rv = gpt_uuid_tstamp(gpt, &u, sizeof(u));
+ else
+ rv = gpt_uuid_random(gpt, &u, sizeof(u));
if (rv == -1)
return -1;
Index: src/sbin/gpt/main.c
diff -u src/sbin/gpt/main.c:1.9 src/sbin/gpt/main.c:1.10
--- src/sbin/gpt/main.c:1.9 Wed Feb 15 22:32:17 2017
+++ src/sbin/gpt/main.c Thu Feb 16 17:40:19 2017
@@ -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 @@ main(int argc, char *argv[])
usage();
break;
case 'T':
+ flags |= GPT_TIMESTAMP;
timestamp = get_tstamp(optarg);
break;
case 'v':