Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst PR 55142: on popular demand bring back expe...



details:   https://anonhg.NetBSD.org/src/rev/e750f9555817
branches:  trunk
changeset: 1015095:e750f9555817
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Oct 13 17:26:28 2020 +0000

description:
PR 55142: on popular demand bring back expert options to adjust the
number of free inodes, block size and fragment size for FFS and LFS.

diffstat:

 usr.sbin/sysinst/bsddisklabel.c |   11 ++-
 usr.sbin/sysinst/defs.h         |    5 +-
 usr.sbin/sysinst/disklabel.c    |   27 ++++++-
 usr.sbin/sysinst/disks.c        |   33 +++++++-
 usr.sbin/sysinst/gpt.c          |   11 ++-
 usr.sbin/sysinst/label.c        |  144 +++++++++++++++++++++++++++++++++++++++-
 usr.sbin/sysinst/msg.mi.de      |   39 ++++++---
 usr.sbin/sysinst/msg.mi.en      |   31 +++++--
 usr.sbin/sysinst/msg.mi.es      |   31 +++++--
 usr.sbin/sysinst/msg.mi.fr      |   31 +++++--
 usr.sbin/sysinst/msg.mi.pl      |   31 +++++--
 usr.sbin/sysinst/partitions.h   |    8 +-
 usr.sbin/sysinst/util.c         |    5 +-
 13 files changed, 334 insertions(+), 73 deletions(-)

diffs (truncated from 844 to 300 lines):

diff -r 05b5fb06f472 -r e750f9555817 usr.sbin/sysinst/bsddisklabel.c
--- a/usr.sbin/sysinst/bsddisklabel.c   Tue Oct 13 13:56:34 2020 +0000
+++ b/usr.sbin/sysinst/bsddisklabel.c   Tue Oct 13 17:26:28 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bsddisklabel.c,v 1.55 2020/10/13 10:44:25 martin Exp $ */
+/*     $NetBSD: bsddisklabel.c,v 1.56 2020/10/13 17:26:28 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1494,6 +1494,9 @@
                        infos[i].last_mounted = want->mount;
                        infos[i].fs_type = want->fs_type;
                        infos[i].fs_sub_type = want->fs_version;
+                       infos[i].fs_opt1 = want->fs_opt1;
+                       infos[i].fs_opt2 = want->fs_opt2;
+                       infos[i].fs_opt3 = want->fs_opt3;
                        new_part_id = ps->pscheme->add_partition(ps,
                            &infos[i], NULL);
                        if (new_part_id == NO_PART)
@@ -1578,6 +1581,9 @@
                        infos[i].last_mounted = want->mount;
                        infos[i].fs_type = want->fs_type;
                        infos[i].fs_sub_type = want->fs_version;
+                       infos[i].fs_opt1 = want->fs_opt1;
+                       infos[i].fs_opt2 = want->fs_opt2;
+                       infos[i].fs_opt3 = want->fs_opt3;
                        if (want->fs_type != FS_UNUSED &&
                            want->type != PT_swap) {
                                want->instflags |= PUIINST_NEWFS;
@@ -1637,6 +1643,9 @@
                        infos[i].last_mounted = want->mount;
                        infos[i].fs_type = want->fs_type;
                        infos[i].fs_sub_type = want->fs_version;
+                       infos[i].fs_opt1 = want->fs_opt1;
+                       infos[i].fs_opt2 = want->fs_opt2;
+                       infos[i].fs_opt3 = want->fs_opt3;
 
                        if (wanted->parts->pscheme->add_outer_partition
                            != NULL)
diff -r 05b5fb06f472 -r e750f9555817 usr.sbin/sysinst/defs.h
--- a/usr.sbin/sysinst/defs.h   Tue Oct 13 13:56:34 2020 +0000
+++ b/usr.sbin/sysinst/defs.h   Tue Oct 13 17:26:28 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.66 2020/10/12 16:14:32 martin Exp $ */
+/*     $NetBSD: defs.h,v 1.67 2020/10/13 17:26:28 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -311,6 +311,7 @@
        unsigned int instflags;         /* installer handling flags */
        uint fs_type, fs_version;       /* e.g. FS_LFS, or FS_BSDFS,
                                         * version = 2 for FFSv2 */
+       uint fs_opt1, fs_opt2, fs_opt3; /* FS specific, FFS: block/frag */
 #ifndef        NO_CLONES
        /*
         * Only != NULL when PUIFLG_CLONE_PARTS is set, describes the
@@ -352,7 +353,7 @@
  */
 struct single_part_fs_edit {
        struct partition_usage_set *pset;
-       size_t index, first_custom_attr;
+       size_t index, first_custom_attr, offset, mode;
        part_id id;
        struct disk_part_info info;     /* current partition data */
        struct part_usage_info *wanted; /* points at our edit data */
diff -r 05b5fb06f472 -r e750f9555817 usr.sbin/sysinst/disklabel.c
--- a/usr.sbin/sysinst/disklabel.c      Tue Oct 13 13:56:34 2020 +0000
+++ b/usr.sbin/sysinst/disklabel.c      Tue Oct 13 17:26:28 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disklabel.c,v 1.41 2020/10/12 16:14:32 martin Exp $    */
+/*     $NetBSD: disklabel.c,v 1.42 2020/10/13 17:26:28 martin Exp $    */
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
        struct disklabel l;
        daddr_t ptn_alignment, install_target;
        char last_mounted[MAXPARTITIONS][MOUNTLEN];
-       uint fs_sub_type[MAXPARTITIONS];
+       uint fs_sub_type[MAXPARTITIONS], fs_opt3[MAXPARTITIONS];
 };
 
 /*
@@ -772,6 +772,10 @@
                                info->last_mounted = parts->last_mounted[part];
                        info->fs_type = parts->l.d_partitions[part].p_fstype;
                        info->fs_sub_type = parts->fs_sub_type[part];
+                       info->fs_opt2 = parts->l.d_partitions[part].p_fsize;
+                       info->fs_opt1 = info->fs_opt2 *
+                           parts->l.d_partitions[part].p_frag;
+                       info->fs_opt3 = parts->fs_opt3[part];
                        if (part == RAW_PART &&
                            parts->l.d_partitions[part].p_fstype == FS_UNUSED)
                                info->flags |=
@@ -820,6 +824,13 @@
                        parts->l.d_partitions[part].p_size = info->size;
                        parts->l.d_partitions[part].p_fstype =
                            dl_part_type_from_generic(info->nat_type);
+                       parts->l.d_partitions[part].p_fsize = info->fs_opt2;
+                       if (info->fs_opt2 != 0)
+                               parts->l.d_partitions[part].p_frag =
+                                   info->fs_opt1 / info->fs_opt2;
+                       else
+                               parts->l.d_partitions[part].p_frag = 0;
+                       parts->fs_opt3[part] = info->fs_opt3;
                        if (info->last_mounted != NULL &&
                            info->last_mounted != parts->last_mounted[part])
                                strlcpy(parts->last_mounted[part],
@@ -1111,6 +1122,12 @@
        parts->l.d_partitions[part].p_size = data.size;
        parts->l.d_partitions[part].p_fstype =
             dl_part_type_from_generic(data.nat_type);
+       parts->l.d_partitions[part].p_fsize = info->fs_opt2;
+       if (info->fs_opt2 != 0)
+               parts->l.d_partitions[part].p_frag =
+                   info->fs_opt1 / info->fs_opt2;
+       else
+               parts->l.d_partitions[part].p_frag = 0;
        if (data.last_mounted && data.last_mounted[0])
                strlcpy(parts->last_mounted[part], data.last_mounted,
                    sizeof(parts->last_mounted[part]));
@@ -1174,6 +1191,12 @@
        parts->l.d_partitions[part].p_size = info->size;
        parts->l.d_partitions[part].p_fstype =
             dl_part_type_from_generic(info->nat_type);
+       parts->l.d_partitions[part].p_fsize = info->fs_opt2;
+       if (info->fs_opt2 != 0)
+               parts->l.d_partitions[part].p_frag =
+                   info->fs_opt1 / info->fs_opt2;
+       else
+               parts->l.d_partitions[part].p_frag = 0;
        if (info->last_mounted && info->last_mounted[0])
                strlcpy(parts->last_mounted[part], info->last_mounted,
                    sizeof(parts->last_mounted[part]));
diff -r 05b5fb06f472 -r e750f9555817 usr.sbin/sysinst/disks.c
--- a/usr.sbin/sysinst/disks.c  Tue Oct 13 13:56:34 2020 +0000
+++ b/usr.sbin/sysinst/disks.c  Tue Oct 13 17:26:28 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disks.c,v 1.70 2020/10/12 14:29:41 martin Exp $ */
+/*     $NetBSD: disks.c,v 1.71 2020/10/13 17:26:28 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1078,7 +1078,8 @@
 make_filesystems(struct install_partition_desc *install)
 {
        int error = 0, partno = -1;
-       char *newfs = NULL, devdev[PATH_MAX], rdev[PATH_MAX];
+       char *newfs = NULL, devdev[PATH_MAX], rdev[PATH_MAX],
+           opts[200], opt[30];
        size_t i;
        struct part_usage_info *ptn;
        struct disk_partitions *parts;
@@ -1142,16 +1143,33 @@
                parts->pscheme->get_part_device(parts, ptn->cur_part_id,
                    rdev, sizeof rdev, &partno, raw_dev_name, true, true);
 
+               opts[0] = 0;
                switch (ptn->fs_type) {
                case FS_APPLEUFS:
-                       asprintf(&newfs, "/sbin/newfs");
+                       if (ptn->fs_opt3 != 0)
+                               snprintf(opts, sizeof opts, "-i %u",
+                                   ptn->fs_opt3);
+                       asprintf(&newfs, "/sbin/newfs %s", opts);
                        mnt_opts = "-tffs -o async";
                        fsname = "ffs";
                        break;
                case FS_BSDFFS:
+                       if (ptn->fs_opt3 != 0)
+                               snprintf(opts, sizeof opts, "-i %u ",
+                                   ptn->fs_opt3);
+                       if (ptn->fs_opt1 != 0) {
+                               snprintf(opt, sizeof opt, "-b %u ",
+                                   ptn->fs_opt1);
+                               strcat(opts, opt);
+                       }
+                       if (ptn->fs_opt2 != 0) {
+                               snprintf(opt, sizeof opt, "-f %u ",
+                                   ptn->fs_opt2);
+                               strcat(opts, opt);
+                       }
                        asprintf(&newfs,
-                           "/sbin/newfs -V2 -O %d",
-                           ptn->fs_version == 2 ? 2 : 1);
+                           "/sbin/newfs -V2 -O %d %s",
+                           ptn->fs_version == 2 ? 2 : 1, opts);
                        if (ptn->mountflags & PUIMNT_LOG)
                                mnt_opts = "-tffs -o log";
                        else
@@ -1159,7 +1177,10 @@
                        fsname = "ffs";
                        break;
                case FS_BSDLFS:
-                       asprintf(&newfs, "/sbin/newfs_lfs");
+                       if (ptn->fs_opt1 != 0 && ptn->fs_opt2 != 0)
+                               snprintf(opts, sizeof opts, "-b %u",
+                                    ptn->fs_opt1 * ptn->fs_opt2);
+                       asprintf(&newfs, "/sbin/newfs_lfs %s", opts);
                        mnt_opts = "-tlfs";
                        fsname = "lfs";
                        break;
diff -r 05b5fb06f472 -r e750f9555817 usr.sbin/sysinst/gpt.c
--- a/usr.sbin/sysinst/gpt.c    Tue Oct 13 13:56:34 2020 +0000
+++ b/usr.sbin/sysinst/gpt.c    Tue Oct 13 17:26:28 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gpt.c,v 1.20 2020/10/12 16:14:32 martin Exp $  */
+/*     $NetBSD: gpt.c,v 1.21 2020/10/13 17:26:28 martin Exp $  */
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -131,7 +131,8 @@
        char gp_label[GPT_LABEL_LEN];   /* user defined label */
        char gp_dev_name[GPT_DEV_LEN];  /* name of wedge */
        const char *last_mounted;       /* last mounted if known */
-       uint fs_type, fs_sub_type;      /* FS_* and maybe sub type */
+       uint fs_type, fs_sub_type,      /* FS_* and maybe sub type */
+           fs_opt1, fs_opt2, fs_opt3;  /* transient file system options */
        uint gp_flags;  
 #define        GPEF_ON_DISK    1               /* This entry exists on-disk */
 #define        GPEF_MODIFIED   2               /* this entry has been changed */
@@ -518,6 +519,9 @@
        info->last_mounted = p->last_mounted;
        info->fs_type = p->fs_type;
        info->fs_sub_type = p->fs_sub_type;
+       info->fs_opt1 = p->fs_opt1;
+       info->fs_opt2 = p->fs_opt2;
+       info->fs_opt3 = p->fs_opt3;
        if (p->gp_flags & GPEF_TARGET)
                info->flags |= PTI_INSTALL_TARGET;
 
@@ -1055,6 +1059,9 @@
        }
        p->fs_type = info->fs_type;
        p->fs_sub_type = info->fs_sub_type;
+       p->fs_opt1 = info->fs_opt1;
+       p->fs_opt2 = info->fs_opt2;
+       p->fs_opt3 = info->fs_opt3;
        
        return true;
 }
diff -r 05b5fb06f472 -r e750f9555817 usr.sbin/sysinst/label.c
--- a/usr.sbin/sysinst/label.c  Tue Oct 13 13:56:34 2020 +0000
+++ b/usr.sbin/sysinst/label.c  Tue Oct 13 17:26:28 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: label.c,v 1.29 2020/10/13 11:28:32 martin Exp $        */
+/*     $NetBSD: label.c,v 1.30 2020/10/13 17:26:28 martin 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.29 2020/10/13 11:28:32 martin Exp $");
+__RCSID("$NetBSD: label.c,v 1.30 2020/10/13 17:26:28 martin Exp $");
 #endif
 
 #include <sys/types.h>
@@ -50,6 +50,7 @@
 #include <sys/dkio.h>
 #include <sys/param.h>
 #include <sys/bootblock.h>
+#include <sys/bitops.h>
 #include <ufs/ffs/fs.h>
 
 #include "defs.h"
@@ -292,6 +293,97 @@
 }
 
 static int
+set_ffs_opt_pow2(menudesc *m, void *arg)
+{
+       struct single_part_fs_edit *edit = arg;
+       size_t val = 1 << (edit->offset+m->cursel);
+
+       if (edit->mode == 1) {
+               edit->info.fs_opt1 = val;
+               edit->wanted->fs_opt1 = val;
+       } else if (edit->mode == 2) {
+               edit->info.fs_opt2 = val;
+               edit->wanted->fs_opt2 = val;
+       }
+       return 0;
+}
+
+static int
+edit_fs_ffs_opt(menudesc *m, void *arg, msg head,
+    size_t min_val, size_t max_val)
+{
+       struct single_part_fs_edit *edit = arg;
+       menu_ent opts[min(MAXPHYS/4096, 8)];
+       char names[min(MAXPHYS/4096, 8)][20];
+       size_t i, val;
+       int menu;
+
+       edit->offset = ilog2(min_val);
+       memset(opts, 0, sizeof opts);
+       for (i = 0, val = min_val; val <= max_val; i++, val <<= 1) {
+               snprintf(names[i], sizeof names[i], "%zu", val);



Home | Main Index | Thread Index | Old Index