Source-Changes-HG archive

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

[src/trunk]: src/distrib/utils/sysinst we want the label name not the fstype ...



details:   https://anonhg.NetBSD.org/src/rev/6165c745aa3e
branches:  trunk
changeset: 772491:6165c745aa3e
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Jan 05 22:18:36 2012 +0000

description:
we want the label name not the fstype name.

diffstat:

 distrib/utils/sysinst/defs.h         |   4 +++-
 distrib/utils/sysinst/disks.c        |  13 +++++++++++--
 distrib/utils/sysinst/label.c        |   8 ++++----
 distrib/utils/sysinst/savenewlabel.c |   8 ++++----
 4 files changed, 22 insertions(+), 11 deletions(-)

diffs (126 lines):

diff -r c353c629d01e -r 6165c745aa3e distrib/utils/sysinst/defs.h
--- a/distrib/utils/sysinst/defs.h      Thu Jan 05 21:40:03 2012 +0000
+++ b/distrib/utils/sysinst/defs.h      Thu Jan 05 22:18:36 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.159 2012/01/05 21:29:24 christos Exp $      */
+/*     $NetBSD: defs.h,v 1.160 2012/01/05 22:18:36 christos Exp $      */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -41,6 +41,8 @@
 #include <sys/types.h>
 #include <sys/disklabel.h>
 
+const char *getfslabelname(uint8_t);
+
 static inline void *
 deconst(const void *p)
 {
diff -r c353c629d01e -r 6165c745aa3e distrib/utils/sysinst/disks.c
--- a/distrib/utils/sysinst/disks.c     Thu Jan 05 21:40:03 2012 +0000
+++ b/distrib/utils/sysinst/disks.c     Thu Jan 05 22:18:36 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disks.c,v 1.121 2012/01/05 21:29:24 christos Exp $ */
+/*     $NetBSD: disks.c,v 1.122 2012/01/05 22:18:36 christos Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -46,6 +46,7 @@
 #include <sys/swap.h>
 #include <ufs/ufs/dinode.h>
 #include <ufs/ffs/fs.h>
+#define FSTYPENAMES
 #include <sys/disklabel.h>
 
 #include <dev/scsipi/scsipi_all.h>
@@ -87,6 +88,14 @@
 
 static const char *disk_names[] = { DISK_NAMES, "vnd", NULL };
 
+const char *
+getfslabelname(uint8_t f)
+{
+       if (f >= __arraycount(fstypenames) || fstypenames[f] == NULL)
+               return "invalid";
+       return fstypenames[f];
+}
+
 /* from src/sbin/atactl/atactl.c
  * extract_string: copy a block of bytes out of ataparams and make
  * a proper string out of it, truncating trailing spaces and preserving
@@ -455,7 +464,7 @@
                else
                        desc = "FFSv1";
        else
-               desc = getfstypename(p->pi_fstype);
+               desc = getfslabelname(p->pi_fstype);
 
 #ifdef PART_BOOT
        if (ptn == PART_BOOT)
diff -r c353c629d01e -r 6165c745aa3e distrib/utils/sysinst/label.c
--- a/distrib/utils/sysinst/label.c     Thu Jan 05 21:40:03 2012 +0000
+++ b/distrib/utils/sysinst/label.c     Thu Jan 05 22:18:36 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: label.c,v 1.60 2012/01/05 20:22:33 christos Exp $      */
+/*     $NetBSD: label.c,v 1.61 2012/01/05 22:18:36 christos Exp $      */
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: label.c,v 1.60 2012/01/05 20:22:33 christos Exp $");
+__RCSID("$NetBSD: label.c,v 1.61 2012/01/05 22:18:36 christos Exp $");
 #endif
 
 #include <sys/types.h>
@@ -387,7 +387,7 @@
 
        if (all_fstype_menu == -1) {
                for (i = 0; i < nelem(all_fstypes); i++) {
-                       all_fstypes[i].opt_name = getfstypename(i);
+                       all_fstypes[i].opt_name = getfslabelname(i);
                        all_fstypes[i].opt_menu = OPT_NOMENU;
                        all_fstypes[i].opt_flags = 0;
                        all_fstypes[i].opt_action = set_fstype;
@@ -487,7 +487,7 @@
                        else
                                c = "FFSv1";
                else
-                       c = getfstypename(p->pi_fstype);
+                       c = getfslabelname(p->pi_fstype);
                wprintw(m->mw, msg_string(MSG_fstype_fmt), c);
                break;
        case PTN_MENU_START:
diff -r c353c629d01e -r 6165c745aa3e distrib/utils/sysinst/savenewlabel.c
--- a/distrib/utils/sysinst/savenewlabel.c      Thu Jan 05 21:40:03 2012 +0000
+++ b/distrib/utils/sysinst/savenewlabel.c      Thu Jan 05 22:18:36 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: savenewlabel.c,v 1.11 2012/01/05 21:29:25 christos Exp $       */
+/*     $NetBSD: savenewlabel.c,v 1.12 2012/01/05 22:18:36 christos Exp $       */
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: savenewlabel.c,v 1.11 2012/01/05 21:29:25 christos Exp $");
+__RCSID("$NetBSD: savenewlabel.c,v 1.12 2012/01/05 22:18:36 christos Exp $");
 #endif
 
 #include <sys/types.h>
@@ -94,10 +94,10 @@
                scripting_fprintf(f, "\t:p%c#%" PRIu32 ":o%c#%" PRIu32
                    ":t%c=%s:", 'a'+i, (uint32_t)bsdlabel[i].pi_size,
                    'a'+i, (uint32_t)bsdlabel[i].pi_offset, 'a'+i,
-                   getfstypename(bsdlabel[i].pi_fstype));
+                   getfslabelname(bsdlabel[i].pi_fstype));
                if (PI_ISBSDFS(&bsdlabel[i]))
                        scripting_fprintf (f, "b%c#%" PRIu32 ":f%c#%" PRIu32
-                           ":ta=4.2BSD:", 'a'+i,
+                           ":", 'a'+i,
                            (uint32_t)(bsdlabel[i].pi_fsize *
                            bsdlabel[i].pi_frag),
                            'a'+i, (uint32_t)bsdlabel[i].pi_fsize);



Home | Main Index | Thread Index | Old Index