Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/gpt correctly show partition type in the new world order
details: https://anonhg.NetBSD.org/src/rev/0a32bec83566
branches: trunk
changeset: 802756:0a32bec83566
user: jnemeth <jnemeth%NetBSD.org@localhost>
date: Tue Sep 30 22:56:36 2014 +0000
description:
correctly show partition type in the new world order
diffstat:
sbin/gpt/gpt_uuid.c | 20 ++++++++++++++++++--
sbin/gpt/show.c | 8 +++++---
2 files changed, 23 insertions(+), 5 deletions(-)
diffs (73 lines):
diff -r 101d3c23dfc4 -r 0a32bec83566 sbin/gpt/gpt_uuid.c
--- a/sbin/gpt/gpt_uuid.c Tue Sep 30 21:33:14 2014 +0000
+++ b/sbin/gpt/gpt_uuid.c Tue Sep 30 22:56:36 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gpt_uuid.c,v 1.1 2014/09/30 17:59:59 christos Exp $ */
+/* $NetBSD: gpt_uuid.c,v 1.2 2014/09/30 22:56:36 jnemeth 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.1 2014/09/30 17:59:59 christos Exp $");
+__RCSID("$NetBSD: gpt_uuid.c,v 1.2 2014/09/30 22:56:36 jnemeth Exp $");
#endif
#include <stdio.h>
@@ -133,6 +133,17 @@
return -1;
}
+static int
+gpt_uuid_descriptive(char *buf, size_t bufsiz, const struct dce_uuid *u)
+{
+ size_t i;
+
+ for (i = 0; i < __arraycount(gpt_nv); i++)
+ if (memcmp(&gpt_nv[i].u, u, sizeof(*u)) == 0)
+ return strlcpy(buf, gpt_nv[i].d, bufsiz);
+ return -1;
+}
+
int
gpt_uuid_snprintf(char *buf, size_t bufsiz, const char *fmt,
const gpt_uuid_t uu)
@@ -145,6 +156,11 @@
if ((r = gpt_uuid_symbolic(buf, bufsiz, &u)) != -1)
return r;
}
+ if (fmt[1] == 'l') {
+ int r;
+ if ((r = gpt_uuid_descriptive(buf, bufsiz, &u)) != -1)
+ return r;
+ }
return gpt_uuid_numeric(buf, bufsiz, &u);
}
diff -r 101d3c23dfc4 -r 0a32bec83566 sbin/gpt/show.c
--- a/sbin/gpt/show.c Tue Sep 30 21:33:14 2014 +0000
+++ b/sbin/gpt/show.c Tue Sep 30 22:56:36 2014 +0000
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/show.c,v 1.14 2006/06/22 22:22:32 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: show.c,v 1.20 2014/09/30 20:23:23 jnemeth Exp $");
+__RCSID("$NetBSD: show.c,v 1.21 2014/09/30 22:56:36 jnemeth Exp $");
#endif
#include <sys/types.h>
@@ -135,8 +135,10 @@
printf("- %s", buf);
} else {
char buf[128];
- gpt_uuid_snprintf(
- buf, sizeof(buf), "%s", ent->ent_type);
+ if (show_uuid || gpt_uuid_snprintf(buf,
+ sizeof(buf), "%ls", ent->ent_type) == -1)
+ gpt_uuid_snprintf(buf, sizeof(buf),
+ "%d", ent->ent_type);
printf("- %s", buf);
}
break;
Home |
Main Index |
Thread Index |
Old Index