Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst Remove dead (#if 0) code.



details:   https://anonhg.NetBSD.org/src/rev/1e06beaf93ab
branches:  trunk
changeset: 965023:1e06beaf93ab
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Aug 28 15:19:05 2019 +0000

description:
Remove dead (#if 0) code.

diffstat:

 usr.sbin/sysinst/bsddisklabel.c |  241 +---------------------------------------
 1 files changed, 2 insertions(+), 239 deletions(-)

diffs (262 lines):

diff -r 1ac76870c360 -r 1e06beaf93ab usr.sbin/sysinst/bsddisklabel.c
--- a/usr.sbin/sysinst/bsddisklabel.c   Wed Aug 28 12:24:03 2019 +0000
+++ b/usr.sbin/sysinst/bsddisklabel.c   Wed Aug 28 15:19:05 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bsddisklabel.c,v 1.26 2019/08/01 17:50:16 martin Exp $ */
+/*     $NetBSD: bsddisklabel.c,v 1.27 2019/08/28 15:19:05 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -147,73 +147,6 @@
        { .def_size = DEFVARSIZE*(MEG/512), .mount = "/var", .type = PT_root },
 };
 
-#if 0 // XXX
-static int
-save_ptn(int ptn, daddr_t start, daddr_t size, int fstype, const char *mountpt)
-{
-       static int maxptn;
-       partinfo *p;
-       int pp;
-       char *buf;
-
-       if (maxptn == 0)
-               maxptn = getmaxpartitions();
-
-       if (ptn < 0 || PI_FSTYPE(&pm->bsdlabel[ptn]) != FS_UNUSED) {
-               ptn = getrawpartition() + 1;
-#ifdef PART_FIRST_FREE
-               if (ptn < PART_FIRST_FREE)
-                       ptn = PART_FIRST_FREE;
-#endif
-               for (;; ptn++) {
-                       if (ptn >= maxptn)
-                               return -1;
-// XXX                 if (ptn == PART_USR)
-//                             continue;
-                       if (PI_FSTYPE(&pm->bsdlabel[ptn]) == FS_UNUSED)
-                               break;
-               }
-       }
-
-       if (fstype == FS_UNUSED)
-               return ptn;
-
-       p = pm->bsdlabel + ptn;
-       PI_SET_OFFSET(p, start);
-       PI_SET_SIZE(p, size);
-       set_ptype(p, fstype, mountpt ? PIF_NEWFS : 0);
-
-       /* Hack because we does not have something like FS_LVMPV */
-       p->lvmpv = 0;
-       if (mountpt != NULL && strcmp(mountpt, "lvm") == 0)
-               p->lvmpv = 1;
-       else if (mountpt != NULL) {
-               for (pp = 0; pp < maxptn; pp++) {
-                       if (strcmp(pm->bsdlabel[pp].pi_mount, mountpt) == 0)
-                               pm->bsdlabel[pp].pi_flags &= ~PIF_MOUNT;
-               }
-               if (mountpt[0] != '/')
-                       asprintf(&buf, "/%s", mountpt);
-               else
-                       asprintf(&buf, "%s", mountpt);
-               strlcpy(p->pi_mount, buf, sizeof p->pi_mount);
-               p->pi_flags |= PIF_MOUNT;
-               /* Default to UFS2. */
-               if (PI_FSTYPE(p) == FS_BSDFFS) {
-#ifdef DEFAULT_UFS2
-#ifndef HAVE_UFS2_BOOT
-                       if (strcmp(mountpt, "/") != 0)
-#endif
-                               p->pi_flags |= PIF_FFSv2;
-#endif
-               }
-               free(buf);
-       }
-       return ptn;
-}
-#endif
-
-
 static const char size_separator[] =
     "----------------------------------- - --------------------";
 static char size_menu_title[STRSIZE];
@@ -644,177 +577,7 @@
        pset->menu = -1;
        pset->menu_opts = NULL;
 
-       if (!pset->ok)
-               return false;
-
-#if 0
-       if (cur_ptns.menu_no < 0) {
-               /* If there is a swap partition elsewhere, don't add one here.*/
-               if (no_swap || (swap_created && partman_go)) {
-                       cur_ptns.ptn_sizes[PI_SWAP].size = 0;
-               } else {
-#if DEFSWAPSIZE == -1
-                       /* Dynamic swap size. */
-                       cur_ptns.ptn_sizes[PI_SWAP].dflt_size = get_ramsize();
-                       cur_ptns.ptn_sizes[PI_SWAP].size =
-                           cur_ptns.ptn_sizes[PI_SWAP].dflt_size;
-#endif
-               }
-
-               /* If installing X increase default size of /usr */
-               if (set_X11_selected())
-                       cur_ptns.ptn_sizes[PI_USR].dflt_size += XNEEDMB;
-
-               /* Start of planning to give free space to / */
-               cur_ptns.pool_part = &cur_ptns.ptn_sizes[PI_ROOT];
-               /* Make size of root include default size of /usr */
-               cur_ptns.ptn_sizes[PI_ROOT].size += cur_ptns.ptn_sizes[PI_USR].dflt_size;
-
-               sm = MEG / pm->sectorsize;
-
-               if (root_limit != 0) {
-                       /* Bah - bios can not read all the disk, limit root */
-                       cur_ptns.ptn_sizes[PI_ROOT].limit = root_limit -
-                           part_start;
-                       /* Allocate a /usr partition if bios can't read
-                        * everything except swap.
-                        */
-                       if (cur_ptns.ptn_sizes[PI_ROOT].limit
-                           < sectors - cur_ptns.ptn_sizes[PI_SWAP].size * sm) {
-                               /* Root won't be able to access all the space */
-                               /* Claw back space for /usr */
-                               cur_ptns.ptn_sizes[PI_USR].size =
-                                               cur_ptns.ptn_sizes[PI_USR].dflt_size;
-                               cur_ptns.ptn_sizes[PI_ROOT].size -=
-                                               cur_ptns.ptn_sizes[PI_USR].dflt_size;
-                               cur_ptns.ptn_sizes[PI_ROOT].changed = 1;
-                               /* Give free space to /usr */
-                               cur_ptns.pool_part = &cur_ptns.ptn_sizes[PI_USR];
-                       }
-               }
-
-               /* Change preset sizes from MB to sectors */
-               cur_ptns.free_space = sectors;
-               for (p = cur_ptns.ptn_sizes; p->mount[0]; p++) {
-                       p->size = NUMSEC(p->size, sm, pm->dlcylsize);
-                       p->dflt_size = NUMSEC(p->dflt_size, sm, pm->dlcylsize);
-                       cur_ptns.free_space -= p->size;
-               }
-
-               /* Steal space from swap to make things fit.. */
-               if (cur_ptns.free_space < 0) {
-                       i = roundup(-cur_ptns.free_space, pm->dlcylsize);
-                       if (i > cur_ptns.ptn_sizes[PI_SWAP].size)
-                               i = cur_ptns.ptn_sizes[PI_SWAP].size;
-                       cur_ptns.ptn_sizes[PI_SWAP].size -= i;
-                       cur_ptns.free_space += i;
-               }
-
-               /* Add space for 2 system dumps to / (traditional) */
-               i = get_ramsize() * sm;
-               i = roundup(i, pm->dlcylsize);
-               if (cur_ptns.free_space > i * 2)
-                       i *= 2;
-               if (cur_ptns.free_space > i) {
-                       cur_ptns.ptn_sizes[PI_ROOT].size += i;
-                       cur_ptns.free_space -= i;
-               }
-
-               if (root_created && partman_go) {
-                       cur_ptns.ptn_sizes[PI_ROOT].size = 0;
-                       cur_ptns.pool_part = 0;
-               }
-
-               /* Ensure all of / is readable by the system boot code */
-               i = cur_ptns.ptn_sizes[PI_ROOT].limit;
-               if (i != 0 && (i -= cur_ptns.ptn_sizes[PI_ROOT].size) < 0) {
-                       cur_ptns.ptn_sizes[PI_ROOT].size += i;
-                       cur_ptns.free_space -= i;
-               }
-
-               /* Count free partition slots */
-               cur_ptns.free_parts = 0;
-#if 0 // XXX
-               for (i = 0; i < maxpart; i++) {
-                       if (pm->bsdlabel[i].pi_size == 0)
-                               cur_ptns.free_parts++;
-               }
-#endif
-               for (i = 0; i < MAXPARTITIONS; i++) {
-                       p = &cur_ptns.ptn_sizes[i];
-                       if (i != 0 && p->use == 0)
-                               p->use = PART_EXTRA;
-                       if (p->size != 0)
-                               cur_ptns.free_parts--;
-               }
-
-               cur_ptns.menu_no = new_menu(0, cur_ptns.ptn_menus,
-                       __arraycount(cur_ptns.ptn_menus),
-                       3, -1, 12, 70,
-                       MC_ALWAYS_SCROLL | MC_NOBOX | MC_NOCLEAR,
-                       NULL, set_ptn_titles, NULL,
-                       "help", cur_ptns.exit_msg);
-
-               if (cur_ptns.menu_no < 0)
-                       return;
-       }
-
-       do {
-               set_ptn_menu(&cur_ptns);
-               pm->current_cylsize = pm->dlcylsize;
-               process_menu(cur_ptns.menu_no, &cur_ptns);
-       } while (cur_ptns.free_space < 0 || cur_ptns.free_parts < 0);
-
-       /* Give any cylinder fragment to last partition */
-       if (cur_ptns.pool_part != NULL || cur_ptns.free_space < pm->dlcylsize) {
-               for (p = cur_ptns.ptn_sizes + __arraycount(cur_ptns.ptn_sizes) - 1; ;p--) {
-                       if (p->size == 0) {
-                               if (p == cur_ptns.ptn_sizes)
-                                       break;
-                               continue;
-                       }
-                       if (p->use == PART_TMP_RAMDISK)
-                               continue;
-                       p->size += cur_ptns.free_space % pm->dlcylsize;
-                       cur_ptns.free_space -= cur_ptns.free_space % pm->dlcylsize;
-                       break;
-               }
-       }
-
-       for (p = cur_ptns.ptn_sizes; p->mount[0]; p++, part_start += size) {
-               size = p->size;
-               if (p == cur_ptns.pool_part) {
-                       size += rounddown(cur_ptns.free_space, pm->dlcylsize);
-                       if (p->limit != 0 && size > p->limit)
-                               size = p->limit;
-               }
-               i = p->use;
-               if (i == PART_TMP_RAMDISK) {
-                       tmp_ramdisk_size = size;
-                       size = 0;
-                       continue;
-               }
-               if (size == 0)
-                       continue;
-               if (i == PART_ROOT && size > 0)
-                       root_created = 1;
-               if (i == PART_SWAP) {
-                       if (size > 0)
-                               swap_created = 1;
-                       save_ptn(i, part_start, size, FS_SWAP, NULL);
-                       continue;
-               }
-               if (!strcmp(p->mount, "raid")) {
-                       save_ptn(i, part_start, size, FS_RAID, NULL);
-                       continue;                       
-               } else if (!strcmp(p->mount, "cgd")) {
-                       save_ptn(i, part_start, size, FS_CGD, NULL);
-                       continue;
-               }
-               save_ptn(i, part_start, size, FS_BSDFFS, p->mount);
-       }
-#endif
-       return true;
+       return pset->ok;
 }
 
 static int



Home | Main Index | Thread Index | Old Index