Source-Changes-HG archive

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

[src/trunk]: src/distrib/utils/sysinst use getfstypename from libutil.



details:   https://anonhg.NetBSD.org/src/rev/b8a8fc10acf7
branches:  trunk
changeset: 772485:b8a8fc10acf7
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Jan 05 20:21:35 2012 +0000

description:
use getfstypename from libutil.

diffstat:

 distrib/utils/sysinst/defs.h         |   3 +--
 distrib/utils/sysinst/disks.c        |  18 ++----------------
 distrib/utils/sysinst/label.c        |  10 ++++------
 distrib/utils/sysinst/savenewlabel.c |   9 +++------
 4 files changed, 10 insertions(+), 30 deletions(-)

diffs (148 lines):

diff -r 6dbe589cd66a -r b8a8fc10acf7 distrib/utils/sysinst/defs.h
--- a/distrib/utils/sysinst/defs.h      Thu Jan 05 19:43:59 2012 +0000
+++ b/distrib/utils/sysinst/defs.h      Thu Jan 05 20:21:35 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.156 2012/01/05 19:43:59 christos Exp $      */
+/*     $NetBSD: defs.h,v 1.157 2012/01/05 20:21:35 christos Exp $      */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -40,7 +40,6 @@
 /* System includes needed for this. */
 #include <sys/types.h>
 #include <sys/disklabel.h>
-const char *getfstypename(char *, size_t, uint8_t);
 
 static inline void *
 deconst(const void *p)
diff -r 6dbe589cd66a -r b8a8fc10acf7 distrib/utils/sysinst/disks.c
--- a/distrib/utils/sysinst/disks.c     Thu Jan 05 19:43:59 2012 +0000
+++ b/distrib/utils/sysinst/disks.c     Thu Jan 05 20:21:35 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disks.c,v 1.118 2012/01/05 19:43:59 christos Exp $ */
+/*     $NetBSD: disks.c,v 1.119 2012/01/05 20:21:35 christos Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -46,7 +46,6 @@
 #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>
@@ -88,18 +87,6 @@
 
 static const char *disk_names[] = { DISK_NAMES, "vnd", NULL };
 
-const char *
-getfstypename(char *buf, size_t len, uint8_t fstype)
-{
-       
-       if (fstype >= __arraycount(fstypenames) ||
-           fstypenames[fstype] == NULL)
-               snprintf(buf, len, "*unknown*%" PRIu8 "*", fstype);
-       else
-               strlcpy(buf, fstypenames[fstype], len);
-       return buf;
-}
-
 /* 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
@@ -447,7 +434,6 @@
 {
        unsigned int poffset, psize, pend;
        const char *desc;
-       char buf[128];
        static const char *Yes, *No;
        partinfo *p = bsdlabel + ptn;
 
@@ -469,7 +455,7 @@
                else
                        desc = "FFSv1";
        else
-               desc = getfstypename(buf, sizeof(buf), p->pi_fstype);
+               desc = getfstypename(p->pi_fstype);
 
 #ifdef PART_BOOT
        if (ptn == PART_BOOT)
diff -r 6dbe589cd66a -r b8a8fc10acf7 distrib/utils/sysinst/label.c
--- a/distrib/utils/sysinst/label.c     Thu Jan 05 19:43:59 2012 +0000
+++ b/distrib/utils/sysinst/label.c     Thu Jan 05 20:21:35 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: label.c,v 1.58 2012/01/05 19:43:59 christos Exp $      */
+/*     $NetBSD: label.c,v 1.59 2012/01/05 20:21:35 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.58 2012/01/05 19:43:59 christos Exp $");
+__RCSID("$NetBSD: label.c,v 1.59 2012/01/05 20:21:35 christos Exp $");
 #endif
 
 #include <sys/types.h>
@@ -388,8 +388,7 @@
        if (all_fstype_menu == -1) {
                for (i = 0; i < nelem(all_fstypes); i++) {
                        char buf[128];
-                       all_fstypes[i].opt_name = strdup(getfstypename(buf,
-                           sizeof(buf), i));
+                       all_fstypes[i].opt_name = getfstypename(i);
                        all_fstypes[i].opt_menu = OPT_NOMENU;
                        all_fstypes[i].opt_flags = 0;
                        all_fstypes[i].opt_action = set_fstype;
@@ -474,7 +473,6 @@
 {
        partinfo *p = arg;
        const char *c;
-       char buf[128];
 
        if (m->opts[opt].opt_flags & OPT_IGNORE
            && (opt != PTN_MENU_END || p->pi_fstype == FS_UNUSED)) {
@@ -490,7 +488,7 @@
                        else
                                c = "FFSv1";
                else
-                       c = getfstypename(buf, sizeof(buf), p->pi_fstype);
+                       c = getfstypename(p->pi_fstype);
                wprintw(m->mw, msg_string(MSG_fstype_fmt), c);
                break;
        case PTN_MENU_START:
diff -r 6dbe589cd66a -r b8a8fc10acf7 distrib/utils/sysinst/savenewlabel.c
--- a/distrib/utils/sysinst/savenewlabel.c      Thu Jan 05 19:43:59 2012 +0000
+++ b/distrib/utils/sysinst/savenewlabel.c      Thu Jan 05 20:21:35 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: savenewlabel.c,v 1.8 2012/01/05 19:43:59 christos Exp $        */
+/*     $NetBSD: savenewlabel.c,v 1.9 2012/01/05 20:21:35 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.8 2012/01/05 19:43:59 christos Exp $");
+__RCSID("$NetBSD: savenewlabel.c,v 1.9 2012/01/05 20:21:35 christos Exp $");
 #endif
 
 #include <sys/types.h>
@@ -86,13 +86,10 @@
            (uint32_t)dlsize);
        scripting_fprintf(f, "\t:se#%d:%s\\\n", sectorsize, doessf);
        for (i = 0; i < nparts; i++) {
-               char fstypename[128];
-
                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(fstypename, sizeof(fstypename),
-                   bsdlabel[i].pi_fstype));
+                   getfstypename(bsdlabel[i].pi_fstype));
                if (PI_ISBSDFS(&bsdlabel[i]))
                        scripting_fprintf (f, "b%c#%" PRIu32 ":f%c#%" PRIu32
                            ":ta=4.2BSD:", 'a'+i,



Home | Main Index | Thread Index | Old Index