Allow user to shoot themselves in the foot by specifing a non-standard

'average bytes per inode' for each partition.
Fixes PR install/8509
This commit is contained in:
dsl 2003-08-09 21:36:26 +00:00
parent 221f1dff47
commit fe536754c3
6 changed files with 70 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: defs.h,v 1.101 2003/08/05 13:35:26 dsl Exp $ */ /* $NetBSD: defs.h,v 1.102 2003/08/09 21:36:26 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -141,6 +141,7 @@ typedef struct _partinfo {
#define pi_frag pi_partition.p_frag #define pi_frag pi_partition.p_frag
#define pi_cpg pi_partition.p_cpg #define pi_cpg pi_partition.p_cpg
char pi_mount[20]; char pi_mount[20];
uint pi_isize; /* bytes per inode */
uint pi_flags; uint pi_flags;
#define PIF_NEWFS 0x001 /* need to 'newfs' partition */ #define PIF_NEWFS 0x001 /* need to 'newfs' partition */
#define PIF_MOUNT 0x002 /* need to mount partition */ #define PIF_MOUNT 0x002 /* need to mount partition */

View File

@ -1,4 +1,4 @@
/* $NetBSD: disks.c,v 1.69 2003/08/05 13:35:26 dsl Exp $ */ /* $NetBSD: disks.c,v 1.70 2003/08/09 21:36:27 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -319,6 +319,7 @@ static int
do_flfs_newfs(const char *partname, int partno, const char *mountpoint) do_flfs_newfs(const char *partname, int partno, const char *mountpoint)
{ {
char dev_name[STRSIZE]; char dev_name[STRSIZE];
char options[16];
int error; int error;
const char *newfs; const char *newfs;
@ -336,8 +337,13 @@ do_flfs_newfs(const char *partname, int partno, const char *mountpoint)
default: default:
return 0; return 0;
} }
error = run_prog(RUN_DISPLAY, MSG_cmdfail, "%s /dev/r%s", if (bsdlabel[partno].pi_isize > 0)
newfs, partname); snprintf(options, sizeof options, " -i%d",
bsdlabel[partno].pi_isize);
else
options[0] = 0;
error = run_prog(RUN_DISPLAY, MSG_cmdfail, "%s%s /dev/r%s",
newfs, options, partname);
} else } else
error = 0; error = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: label.c,v 1.38 2003/08/05 13:35:27 dsl Exp $ */ /* $NetBSD: label.c,v 1.39 2003/08/09 21:36:27 dsl Exp $ */
/* /*
* Copyright 1997 Jonathan Stone * Copyright 1997 Jonathan Stone
@ -36,7 +36,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: label.c,v 1.38 2003/08/05 13:35:27 dsl Exp $"); __RCSID("$NetBSD: label.c,v 1.39 2003/08/09 21:36:27 dsl Exp $");
#endif #endif
#include <sys/types.h> #include <sys/types.h>
@ -229,6 +229,20 @@ set_fsize(partinfo *p, int fsize)
return 0; return 0;
} }
static int
edit_fs_isize(menudesc *m, void *arg)
{
partinfo *p = arg;
char answer[12];
snprintf(answer, sizeof answer, "%u", p->pi_isize);
msg_prompt_win(MSG_fs_isize, -1, 18, 0, 0,
answer, answer, sizeof answer);
p->pi_isize = atol(answer);
return 0;
}
static int static int
edit_fs_preserve(menudesc *m, void *arg) edit_fs_preserve(menudesc *m, void *arg)
{ {
@ -344,13 +358,15 @@ edit_ptn(menudesc *menu, void *arg)
{NULL, MENU_selbsize, OPT_SUB, NULL}, {NULL, MENU_selbsize, OPT_SUB, NULL},
#define PTN_MENU_FSIZE 5 #define PTN_MENU_FSIZE 5
{NULL, MENU_selfsize, OPT_SUB, NULL}, {NULL, MENU_selfsize, OPT_SUB, NULL},
#define PTN_MENU_NEWFS 6 #define PTN_MENU_ISIZE 6
{NULL, OPT_NOMENU, 0, edit_fs_isize},
#define PTN_MENU_NEWFS 7
{NULL, OPT_NOMENU, 0, edit_fs_preserve}, {NULL, OPT_NOMENU, 0, edit_fs_preserve},
#define PTN_MENU_MOUNT 7 #define PTN_MENU_MOUNT 8
{NULL, OPT_NOMENU, 0, edit_fs_mount}, {NULL, OPT_NOMENU, 0, edit_fs_mount},
#define PTN_MENU_MOUNTOPT 8 #define PTN_MENU_MOUNTOPT 9
{NULL, MENU_mountoptions, OPT_SUB, NULL}, {NULL, MENU_mountoptions, OPT_SUB, NULL},
#define PTN_MENU_MOUNTPT 9 #define PTN_MENU_MOUNTPT 10
{NULL, OPT_NOMENU, 0, edit_fs_mountpt}, {NULL, OPT_NOMENU, 0, edit_fs_mountpt},
{MSG_askunits, MENU_sizechoice, OPT_SUB, NULL}, {MSG_askunits, MENU_sizechoice, OPT_SUB, NULL},
{MSG_restore, OPT_NOMENU, 0, edit_restore}, {MSG_restore, OPT_NOMENU, 0, edit_restore},
@ -423,15 +439,21 @@ set_ptn_label(menudesc *m, int opt, void *arg)
break; break;
case PTN_MENU_BSIZE: case PTN_MENU_BSIZE:
if (PI_ISBSDFS(p)) if (PI_ISBSDFS(p))
wprintw(m->mw, wprintw(m->mw, msg_string(MSG_bsize_fmt),
msg_string(MSG_bsize_fmt), p->pi_fsize * p->pi_frag); p->pi_fsize * p->pi_frag);
else else
wprintw(m->mw, " -"); wprintw(m->mw, " -");
break; break;
case PTN_MENU_FSIZE: case PTN_MENU_FSIZE:
if (PI_ISBSDFS(p)) if (PI_ISBSDFS(p))
wprintw(m->mw, wprintw(m->mw, msg_string(MSG_fsize_fmt), p->pi_fsize);
msg_string(MSG_fsize_fmt), p->pi_fsize); else
wprintw(m->mw, " -");
break;
case PTN_MENU_ISIZE:
if (PI_ISBSDFS(p))
wprintw(m->mw, msg_string(p->pi_isize > 0 ?
MSG_isize_fmt : MSG_isize_fmt_dflt), p->pi_isize);
else else
wprintw(m->mw, " -"); wprintw(m->mw, " -");
break; break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.mi.en,v 1.118 2003/08/05 13:35:28 dsl Exp $ */ /* $NetBSD: msg.mi.en,v 1.119 2003/08/09 21:36:27 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -151,6 +151,9 @@ message heads
message sectors message sectors
{sectors} {sectors}
message fs_isize
{average file size (bytes)}
message mountpoint message mountpoint
{mount point (or 'none')} {mount point (or 'none')}
@ -292,6 +295,11 @@ message bsize_fmt
message fsize_fmt message fsize_fmt
{ fragment size: %9d bytes} { fragment size: %9d bytes}
message isize_fmt
{ Avg file size: %9d bytes}
message isize_fmt_dflt
{ Avg file size: 4 fragments}
message newfs_fmt message newfs_fmt
{ newfs: %9s} { newfs: %9s}

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.mi.fr,v 1.67 2003/08/05 13:35:28 dsl Exp $ */ /* $NetBSD: msg.mi.fr,v 1.68 2003/08/09 21:36:27 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -158,6 +158,9 @@ message heads
message sectors message sectors
{secteurs} {secteurs}
message fs_isize /* XXX translate */
{average file size (octets)}
message mountpoint message mountpoint
{point de montage (ou 'none')} {point de montage (ou 'none')}
@ -303,6 +306,11 @@ message bsize_fmt /* XXX translate */
message fsize_fmt /* XXX translate */ message fsize_fmt /* XXX translate */
{ fragment size: %9d bytes} { fragment size: %9d bytes}
message isize_fmt /* XXX translate */
{ Avg file size: %9d bytes}
message isize_fmt_dflt /* XXX translate */
{ Avg file size: 4 fragments}
message newfs_fmt /* XXX translate */ message newfs_fmt /* XXX translate */
{ newfs: %9s} { newfs: %9s}

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.mi.pl,v 1.29 2003/08/05 13:35:29 dsl Exp $ */ /* $NetBSD: msg.mi.pl,v 1.30 2003/08/09 21:36:28 dsl Exp $ */
/* Based on english version: */ /* Based on english version: */
/* NetBSD: msg.mi.en,v 1.86 2002/04/04 14:26:44 ad Exp */ /* NetBSD: msg.mi.en,v 1.86 2002/04/04 14:26:44 ad Exp */
@ -153,6 +153,9 @@ message heads
message sectors message sectors
{sektory} {sektory}
message fs_isize /* XXX translate */
{average file size (bytes)}
message mountpoint message mountpoint
{mount point (or 'none')} {mount point (or 'none')}
@ -292,6 +295,11 @@ message bsize_fmt /* XXX translate */
message fsize_fmt /* XXX translate */ message fsize_fmt /* XXX translate */
{ fragment size: %9d bytes} { fragment size: %9d bytes}
message isize_fmt /* XXX translate */
{ Avg file size: %9d bytes}
message isize_fmt_dflt /* XXX translate */
{ Avg file size: 4 fragments}
message newfs_fmt /* XXX translate */ message newfs_fmt /* XXX translate */
{ newfs: %9s} { newfs: %9s}