Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/fstat print the tag symbolically if we don't support...



details:   https://anonhg.NetBSD.org/src/rev/25cfe5dd478f
branches:  trunk
changeset: 342459:25cfe5dd478f
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Dec 22 23:35:21 2015 +0000

description:
print the tag symbolically if we don't support it.

diffstat:

 usr.bin/fstat/fstat.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (40 lines):

diff -r 7cabc61e61b1 -r 25cfe5dd478f usr.bin/fstat/fstat.c
--- a/usr.bin/fstat/fstat.c     Tue Dec 22 22:34:42 2015 +0000
+++ b/usr.bin/fstat/fstat.c     Tue Dec 22 23:35:21 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fstat.c,v 1.109 2015/03/08 06:46:51 mlelstv Exp $      */
+/*     $NetBSD: fstat.c,v 1.110 2015/12/22 23:35:21 christos Exp $     */
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)fstat.c    8.3 (Berkeley) 5/2/95";
 #else
-__RCSID("$NetBSD: fstat.c,v 1.109 2015/03/08 06:46:51 mlelstv Exp $");
+__RCSID("$NetBSD: fstat.c,v 1.110 2015/12/22 23:35:21 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -532,6 +532,9 @@
 }
 
 static const char dead[] = "dead";
+static const char *vnode_tag[] = {
+       VNODE_TAGS
+};
 
 static const char *
 vfilestat(struct vnode *vp, struct filestat *fsp)
@@ -588,8 +591,9 @@
                        break;
                default: {
                        static char unknown[10];
-                       (void)snprintf(unknown, sizeof unknown,
-                           "?(%x)", vp->v_tag);
+                       (void)snprintf(unknown, sizeof unknown, "%s(%#x)",
+                           (size_t)vp->v_tag < __arraycount(vnode_tag) ?
+                           vnode_tag[vp->v_tag] : "?", vp->v_tag);
                        badtype = unknown;
                        break;
                }



Home | Main Index | Thread Index | Old Index