From 6dccb7a0e98dbef140989d4bb2d7aa8676c47c86 Mon Sep 17 00:00:00 2001 From: rillig Date: Sun, 31 Jan 2021 22:45:46 +0000 Subject: [PATCH] sysinst: remove trailing whitespace from *.c *.h In contrast to the messages files, this whitespace is not significant. --- usr.sbin/sysinst/bsddisklabel.c | 18 +++++------ usr.sbin/sysinst/checkrc.c | 4 +-- usr.sbin/sysinst/configmenu.c | 6 ++-- usr.sbin/sysinst/defs.h | 6 ++-- usr.sbin/sysinst/disklabel.c | 4 +-- usr.sbin/sysinst/disks.c | 14 ++++----- usr.sbin/sysinst/geom.c | 8 ++--- usr.sbin/sysinst/gpt.c | 10 +++--- usr.sbin/sysinst/label.c | 30 +++++++++--------- usr.sbin/sysinst/main.c | 10 +++--- usr.sbin/sysinst/mbr.c | 9 +++--- usr.sbin/sysinst/net.c | 10 +++--- usr.sbin/sysinst/part_edit.c | 6 ++-- usr.sbin/sysinst/partitions.h | 4 +-- usr.sbin/sysinst/partman.c | 50 ++++++++++++++--------------- usr.sbin/sysinst/target.c | 56 ++++++++++++++++----------------- usr.sbin/sysinst/txtwalk.c | 4 +-- usr.sbin/sysinst/util.c | 14 ++++----- usr.sbin/sysinst/wskbd.c | 6 ++-- 19 files changed, 134 insertions(+), 135 deletions(-) diff --git a/usr.sbin/sysinst/bsddisklabel.c b/usr.sbin/sysinst/bsddisklabel.c index 431fa9684e22..f86c2b7ae58e 100644 --- a/usr.sbin/sysinst/bsddisklabel.c +++ b/usr.sbin/sysinst/bsddisklabel.c @@ -1,4 +1,4 @@ -/* $NetBSD: bsddisklabel.c,v 1.56 2020/10/13 17:26:28 martin Exp $ */ +/* $NetBSD: bsddisklabel.c,v 1.57 2021/01/31 22:45:46 rillig Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -386,7 +386,7 @@ inst_ext_clone(menudesc *menu, void *arg) struct part_usage_info *p; menu_ent *men; int num_men, i; - + if (!select_partitions(&selected, pm->parts)) return 0; @@ -625,7 +625,7 @@ set_ptn_size(menudesc *m, void *arg) if (is_ram_size) { new_size_val = parse_ram_size(answer, &is_percent); - if (is_percent && + if (is_percent && (new_size_val < 0 || new_size_val > 100)) continue; if (!is_percent && new_size_val < 0) @@ -1507,7 +1507,7 @@ apply_settings_to_partitions(struct disk_partitions *parts, want->cur_part_id = new_part_id; want->flags |= PUIFLG_ADD_INNER|PUIFLG_IS_OUTER; - from = roundup(infos[i].start + + from = roundup(infos[i].start + infos[i].size, outer_align); } } @@ -1656,7 +1656,7 @@ apply_settings_to_partitions(struct disk_partitions *parts, new_part_id = wanted->parts->pscheme-> add_partition( wanted->parts, &infos[i], NULL); - + if (new_part_id == NO_PART) continue; /* failed to add, skip */ } @@ -1818,7 +1818,7 @@ make_bsd_partitions(struct install_partition_desc *install) /* calc available disk area for the NetBSD partitions */ p_start = pm->ptstart; p_size = pm->ptsize; - if (parts->parent != NULL && + if (parts->parent != NULL && parts->parent->pscheme->guess_install_target != NULL) parts->parent->pscheme->guess_install_target( parts->parent, &p_start, &p_size); @@ -1826,7 +1826,7 @@ make_bsd_partitions(struct install_partition_desc *install) if (layoutkind == LY_OTHERSCHEME) { parts->pscheme->destroy_part_scheme(parts); return -1; - } else if (layoutkind == LY_USEDEFAULT) { + } else if (layoutkind == LY_USEDEFAULT) { replace_by_default(parts, p_start, p_size, &wanted); } else if (layoutkind == LY_SETSIZES) { @@ -1861,7 +1861,7 @@ make_bsd_partitions(struct install_partition_desc *install) struct disk_part_info info; if (wanted.infos[i].type != PT_root || - strcmp(wanted.infos[i].mount, "/") != 0) + strcmp(wanted.infos[i].mount, "/") != 0) continue; wanted.infos[i].cur_flags |= PTI_INSTALL_TARGET; @@ -1900,7 +1900,7 @@ make_bsd_partitions(struct install_partition_desc *install) daddr_t ps = wanted.infos[i].cur_start; daddr_t pe = ps + wanted.infos[i].size; if (target_start >= 0 && - (ps >= target_start || pe >= target_start)) + (ps >= target_start || pe >= target_start)) continue; boot_part = i; break; diff --git a/usr.sbin/sysinst/checkrc.c b/usr.sbin/sysinst/checkrc.c index f0a7385a87ef..9a912b5d6191 100644 --- a/usr.sbin/sysinst/checkrc.c +++ b/usr.sbin/sysinst/checkrc.c @@ -1,4 +1,4 @@ -/* $NetBSD: checkrc.c,v 1.2 2019/08/18 11:11:48 martin Exp $ */ +/* $NetBSD: checkrc.c,v 1.3 2021/01/31 22:45:46 rillig Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -55,7 +55,7 @@ static int create_script(const char *varname, int filetocheck) { FILE *fp; - + if ((fp = fopen(target_expand(RC_CHECK_SCRIPT), "w")) == NULL) { if (logfp) fprintf(logfp,"Could not open %s for writing", diff --git a/usr.sbin/sysinst/configmenu.c b/usr.sbin/sysinst/configmenu.c index d9d15887d3b0..eb1af844b8d0 100644 --- a/usr.sbin/sysinst/configmenu.c +++ b/usr.sbin/sysinst/configmenu.c @@ -1,4 +1,4 @@ -/* $NetBSD: configmenu.c,v 1.11 2019/11/16 20:26:59 martin Exp $ */ +/* $NetBSD: configmenu.c,v 1.12 2021/01/31 22:45:46 rillig Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -206,7 +206,7 @@ static int set_root_shell(struct menudesc *menu, void *arg) { configinfo **confp = arg; - + process_menu(MENU_rootsh, &confp[menu->cursel]->setting); if (run_program(RUN_PROGRESS | RUN_CHROOT, "chpass -s %s root", confp[menu->cursel]->setting) != 0) @@ -303,7 +303,7 @@ set_binpkg(struct menudesc *menu, void *arg) confp[menu->cursel]->setting = MSG_abandoned; return 0; } - + make_url(pkgpath, &pkg, pkg_dir); if (run_program(RUN_DISPLAY | RUN_PROGRESS | RUN_CHROOT, "pkg_add %s/pkgin", pkgpath) == 0) { diff --git a/usr.sbin/sysinst/defs.h b/usr.sbin/sysinst/defs.h index bb1e054a2959..6b1708761cd1 100644 --- a/usr.sbin/sysinst/defs.h +++ b/usr.sbin/sysinst/defs.h @@ -1,4 +1,4 @@ -/* $NetBSD: defs.h,v 1.69 2020/11/04 14:29:40 martin Exp $ */ +/* $NetBSD: defs.h,v 1.70 2021/01/31 22:45:46 rillig Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -157,7 +157,7 @@ enum { SET_MD_2, /* Machine dependent set */ SET_MD_3, /* Machine dependent set */ SET_MD_4, /* Machine dependent set */ - + /* Source sets */ SET_SYSSRC, SET_SRC, @@ -382,7 +382,7 @@ struct single_part_fs_edit { struct install_partition_desc { size_t num; /* how many entries in infos */ struct part_usage_info *infos; /* individual partitions */ - struct disk_partitions **write_back; /* partition tables from + struct disk_partitions **write_back; /* partition tables from * which we did delete some * partitions and that need * updating, even if no diff --git a/usr.sbin/sysinst/disklabel.c b/usr.sbin/sysinst/disklabel.c index 9690ef23b84e..305e2a46b3e5 100644 --- a/usr.sbin/sysinst/disklabel.c +++ b/usr.sbin/sysinst/disklabel.c @@ -1,4 +1,4 @@ -/* $NetBSD: disklabel.c,v 1.42 2020/10/13 17:26:28 martin Exp $ */ +/* $NetBSD: disklabel.c,v 1.43 2021/01/31 22:45:46 rillig Exp $ */ /* * Copyright 2018 The NetBSD Foundation, Inc. @@ -431,7 +431,7 @@ disklabel_write_to_disk(struct disk_partitions *arg) (uint32_t)(lp[i].p_fsize * lp[i].p_frag), 'a'+i, (uint32_t)lp[i].p_fsize); - + if (i < parts->l.d_npartitions - 1) scripting_fprintf(f, "\\\n"); else diff --git a/usr.sbin/sysinst/disks.c b/usr.sbin/sysinst/disks.c index 2a119c6c6e33..c7a2e3bdf1d7 100644 --- a/usr.sbin/sysinst/disks.c +++ b/usr.sbin/sysinst/disks.c @@ -1,4 +1,4 @@ -/* $NetBSD: disks.c,v 1.71 2020/10/13 17:26:28 martin Exp $ */ +/* $NetBSD: disks.c,v 1.72 2021/01/31 22:45:46 rillig Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -690,7 +690,7 @@ dump_parts(const struct disk_partitions *parts) "for partition #%zu\n", p); } } - fprintf(stderr, "%" PRIu64 " sectors free, disk size %" PRIu64 + fprintf(stderr, "%" PRIu64 " sectors free, disk size %" PRIu64 " sectors, %zu partitions used\n", parts->free_space, parts->disk_size, parts->num_part); } @@ -710,7 +710,7 @@ delete_scheme(struct pm_devs *p) static void -convert_copy(struct disk_partitions *old_parts, +convert_copy(struct disk_partitions *old_parts, struct disk_partitions *new_parts) { struct disk_part_info oinfo, ninfo; @@ -1130,7 +1130,7 @@ make_filesystems(struct install_partition_desc *install) fsname = NULL; if (ptn->size == 0 || parts == NULL|| ptn->type == PT_swap) - continue; + continue; if (parts->pscheme->get_part_device(parts, ptn->cur_part_id, devdev, sizeof devdev, &partno, parent_device_only, false, @@ -1229,7 +1229,7 @@ make_filesystems(struct install_partition_desc *install) error = target_mount_do(mnt_opts, devdev, ptn->mount); if (error) { - msg_display_subst(MSG_mountfail, 2, devdev, + msg_display_subst(MSG_mountfail, 2, devdev, ptn->mount); hit_enter_to_continue(NULL, NULL); return error; @@ -2329,7 +2329,7 @@ add_another(struct menudesc *m, void *arg) static int cancel_clone(struct menudesc *m, void *arg) -{ +{ struct part_selection_and_all_parts *sel = arg; sel->cancelled = true; @@ -2570,7 +2570,7 @@ clone_partition_data(struct disk_partitions *dest_parts, part_id did, raw_dev_name, true, true)) return false; - return run_program(RUN_DISPLAY | RUN_PROGRESS, + return run_program(RUN_DISPLAY | RUN_PROGRESS, "progress -f %s -b 1m dd bs=1m of=%s", src_dev, target_dev) == 0; } diff --git a/usr.sbin/sysinst/geom.c b/usr.sbin/sysinst/geom.c index a10e31fb494c..7ca0f37a8630 100644 --- a/usr.sbin/sysinst/geom.c +++ b/usr.sbin/sysinst/geom.c @@ -1,4 +1,4 @@ -/* $NetBSD: geom.c,v 1.3 2019/06/21 21:54:39 christos Exp $ */ +/* $NetBSD: geom.c,v 1.4 2021/01/31 22:45:46 rillig Exp $ */ /* * Copyright (c) 1995, 1997 Jason R. Thorpe. @@ -54,7 +54,7 @@ disk_ioctl(const char *disk, unsigned long cmd, void *d) /* Open the disk. */ fd = opendisk(disk, O_RDONLY, diskpath, sizeof(diskpath), 0); - if (fd == -1) + if (fd == -1) return false; if (ioctl(fd, cmd, d) == -1) { @@ -101,10 +101,10 @@ get_disk_geom(const char *disk, struct disk_geom *d) { char buf[MAXPATHLEN]; int fd, error; - + if ((fd = opendisk(disk, O_RDONLY, buf, sizeof(buf), 0)) == -1) return false; - + error = getdiskinfo(disk, fd, NULL, d, NULL); close(fd); if (error < 0) { diff --git a/usr.sbin/sysinst/gpt.c b/usr.sbin/sysinst/gpt.c index 92f678385c73..96ac601806a1 100644 --- a/usr.sbin/sysinst/gpt.c +++ b/usr.sbin/sysinst/gpt.c @@ -1,4 +1,4 @@ -/* $NetBSD: gpt.c,v 1.22 2020/10/14 04:17:43 martin Exp $ */ +/* $NetBSD: gpt.c,v 1.23 2021/01/31 22:45:46 rillig Exp $ */ /* * Copyright 2018 The NetBSD Foundation, Inc. @@ -91,7 +91,7 @@ struct { const char *name; uint fstype; enum part_type ptype; - uint fsflags; + uint fsflags; } gpt_fs_types[] = { { .name = "ffs", .fstype = FS_BSDFFS, .ptype = PT_root, .fsflags = GLM_LIKELY_FFS }, @@ -133,7 +133,7 @@ struct gpt_part_entry { const char *last_mounted; /* last mounted if known */ uint fs_type, fs_sub_type, /* FS_* and maybe sub type */ fs_opt1, fs_opt2, fs_opt3; /* transient file system options */ - uint gp_flags; + uint gp_flags; #define GPEF_ON_DISK 1 /* This entry exists on-disk */ #define GPEF_MODIFIED 2 /* this entry has been changed */ #define GPEF_WEDGE 4 /* wedge for this exists */ @@ -299,7 +299,7 @@ gpt_read_from_disk(const char *dev, daddr_t start, daddr_t len, size_t bps, (void)strtok(textbuf, "\n"); /* ignore first line */ while ((t = strtok(NULL, "\n")) != NULL) { i = 0; p_start = 0; p_size = 0; p_index = 0; - p_type[0] = 0; + p_type[0] = 0; while ((tt = strsep(&t, " \t")) != NULL) { if (strlen(tt) == 0) continue; @@ -1062,7 +1062,7 @@ gpt_info_to_part(struct gpt_part_entry *p, const struct disk_part_info *info, p->fs_opt1 = info->fs_opt1; p->fs_opt2 = info->fs_opt2; p->fs_opt3 = info->fs_opt3; - + return true; } diff --git a/usr.sbin/sysinst/label.c b/usr.sbin/sysinst/label.c index a5c191a999e5..2470a88624c4 100644 --- a/usr.sbin/sysinst/label.c +++ b/usr.sbin/sysinst/label.c @@ -1,4 +1,4 @@ -/* $NetBSD: label.c,v 1.31 2020/12/02 14:20:20 wiz Exp $ */ +/* $NetBSD: label.c,v 1.32 2021/01/31 22:45:46 rillig Exp $ */ /* * Copyright 1997 Jonathan Stone @@ -23,20 +23,20 @@ * THIS SOFTWARE IS PROVIDED BY JONATHAN STONE ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL PIERMONT INFORMATION SYSTEMS INC. BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * ARE DISCLAIMED. IN NO EVENT SHALL PIERMONT INFORMATION SYSTEMS INC. BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * */ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: label.c,v 1.31 2020/12/02 14:20:20 wiz Exp $"); +__RCSID("$NetBSD: label.c,v 1.32 2021/01/31 22:45:46 rillig Exp $"); #endif #include @@ -206,7 +206,7 @@ verify_parts(struct partition_usage_set *pset, bool install) if (strcmp(wanted->mount, "/") != 0) continue; num_root++; - + if (first_bsdstart <= 0) { first_bsdstart = wanted->cur_start; } @@ -477,7 +477,7 @@ edit_delete_ptn(menudesc *m, void *arg) edit->rv = -2; return 1; } - + /* * We have added/removed partitions, all cur_part_id values are * out of sync. Re-fetch and reorder partitions accordingly. @@ -524,7 +524,7 @@ renumber_partitions(struct partition_usage_set *pset) /* * Most often used file system types, we offer them in a first level menu. */ -static const uint edit_fs_common_types[] = +static const uint edit_fs_common_types[] = { FS_BSDFFS, FS_SWAP, FS_MSDOS, FS_BSDLFS, FS_EX2FS }; /* @@ -1540,7 +1540,7 @@ part_ext_clone(menudesc *m, void *arg) clone_src = malloc(sizeof(selected)); if (clone_src == NULL) goto err; - *clone_src = selected; + *clone_src = selected; /* find selected offset from data.res and insert clones there */ align = pset->parts->pscheme->get_part_alignment(pset->parts); @@ -1802,7 +1802,7 @@ edit_and_check_label(struct pm_devs *p, struct partition_usage_set *pset, op->opt_action = edit_fspart_add; op++; } - + /* and unit changer */ op->opt_name = MSG_askunits; op->opt_menu = MENU_sizechoice; @@ -1823,7 +1823,7 @@ edit_and_check_label(struct pm_devs *p, struct partition_usage_set *pset, op->opt_action = part_ext_clone; op++; #endif - + /* and abort option */ op->opt_name = MSG_cancel; op->opt_flags = OPT_EXIT; @@ -2022,7 +2022,7 @@ getpartoff(struct disk_partitions *parts, daddr_t defpartstart) freespace = calloc(num_freespace, sizeof(*freespace)); if (freespace == NULL) return -1; - + ptn_alignment = parts->pscheme->get_part_alignment(parts); spaces = parts->pscheme->get_free_spaces(parts, freespace, num_freespace, max(sizemult, ptn_alignment), ptn_alignment, -1, @@ -2188,7 +2188,7 @@ getpartsize(struct disk_partitions *parts, daddr_t orig_start, max_r = dflt_r; else max_r = max / sizemult; - /* the partition may have been moved and now not fit any longer */ + /* the partition may have been moved and now not fit any longer */ if (dflt > max) dflt = max; if (dflt_r > max_r) @@ -2243,7 +2243,7 @@ getpartsize(struct disk_partitions *parts, daddr_t orig_start, isize[0] <= maxpartc) { partn = isize[0] - 'a'; if (parts->pscheme->get_part_info(parts, partn, - &info)) { + &info)) { i = info.start - partstart -1; localsizemult = 1; max_r = max; diff --git a/usr.sbin/sysinst/main.c b/usr.sbin/sysinst/main.c index bae2ae52c594..abc3a57eaa38 100644 --- a/usr.sbin/sysinst/main.c +++ b/usr.sbin/sysinst/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.26 2020/08/19 02:19:07 msaitoh Exp $ */ +/* $NetBSD: main.c,v 1.27 2021/01/31 22:45:46 rillig Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -171,7 +171,7 @@ static void init(void) { const struct f_arg *arg; - + sizemult = 1; clean_xfer_dir = 0; mnt2_mounted = 0; @@ -191,14 +191,14 @@ init(void) strlcpy(arg->var, arg->dflt, arg->size); } pkg.xfer = pkgsrc.xfer = XFER_HTTP; - + clr_arg.bg=COLOR_BLUE; clr_arg.fg=COLOR_WHITE; } static void init_lang(void) -{ +{ sizemult = 1; err_outofmem = msg_string(MSG_out_of_memory); multname = msg_string(MSG_secname); @@ -294,7 +294,7 @@ main(int argc, char **argv) refresh(); /* Ensure we have mountpoint for target filesystems */ - mkdir(targetroot_mnt, S_IRWXU| S_IRGRP|S_IXGRP | S_IROTH|S_IXOTH); + mkdir(targetroot_mnt, S_IRWXU | S_IRGRP|S_IXGRP | S_IROTH|S_IXOTH); select_language(); get_kb_encoding(); diff --git a/usr.sbin/sysinst/mbr.c b/usr.sbin/sysinst/mbr.c index b31e8d75a959..f634617d36cf 100644 --- a/usr.sbin/sysinst/mbr.c +++ b/usr.sbin/sysinst/mbr.c @@ -1,4 +1,4 @@ -/* $NetBSD: mbr.c,v 1.37 2020/10/23 19:02:58 martin Exp $ */ +/* $NetBSD: mbr.c,v 1.38 2021/01/31 22:45:46 rillig Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -972,7 +972,6 @@ mbr_calc_free_space(struct mbr_disk_partitions *parts) parts->dp.free_space = 0; else parts->dp.free_space -= psize; - } } while ((m = m->extended)); } @@ -1433,7 +1432,7 @@ mbr_do_get_part_info(const struct disk_partitions *arg, part_id id, static bool get_wedge_devname(const struct disk_partitions *arg, part_id id, - const mbr_info_t *mb, int i, bool primary, + const mbr_info_t *mb, int i, bool primary, const struct mbr_partition *mp, void *cookie) { char **res = cookie; @@ -1849,7 +1848,7 @@ mbr_read_disklabel(struct disk_partitions *arg, daddr_t start, bool force_empty) struct disk_part_info part; struct disk_part_free_space space; - if (force_empty && myparts->dlabel) + if (force_empty && myparts->dlabel) myparts->dlabel->pscheme->delete_all_partitions( myparts->dlabel); @@ -1885,7 +1884,7 @@ mbr_read_disklabel(struct disk_partitions *arg, daddr_t start, bool force_empty) if (myparts->dlabel == NULL && part.size > 0) { /* we just created the outer partitions? */ - myparts->dlabel = + myparts->dlabel = disklabel_parts.create_new_for_disk( myparts->dp.disk, part.start, part.size, false, &myparts->dp); diff --git a/usr.sbin/sysinst/net.c b/usr.sbin/sysinst/net.c index a7698c450d0f..c61b7a32fa93 100644 --- a/usr.sbin/sysinst/net.c +++ b/usr.sbin/sysinst/net.c @@ -1,4 +1,4 @@ -/* $NetBSD: net.c,v 1.35 2020/01/27 21:30:17 martin Exp $ */ +/* $NetBSD: net.c,v 1.36 2021/01/31 22:45:46 rillig Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -977,7 +977,7 @@ get_pkgsrc(void) int rv = -1; process_menu(MENU_pkgsrc, &rv); - + if (rv == SET_SKIP) return SET_SKIP; @@ -996,7 +996,7 @@ get_via_ftp(unsigned int xfer) arg.rv = -1; arg.arg = (void*)(uintptr_t)(xfer); process_menu(MENU_ftpsource, &arg); - + if (arg.rv == SET_RETRY) return SET_RETRY; @@ -1028,7 +1028,7 @@ get_via_nfs(void) /* Get server and filepath */ rv = -1; process_menu(MENU_nfssource, &rv); - + if (rv == SET_RETRY) return SET_RETRY; @@ -1083,7 +1083,7 @@ mnt_net_config(void) return; /* Write hostname to /etc/rc.conf */ - if ((net_dhcpconf & DHCPCONF_HOST) == 0) + if ((net_dhcpconf & DHCPCONF_HOST) == 0) if (del_rc_conf("hostname") == 0) add_rc_conf("hostname=%s\n", recombine_host_domain()); diff --git a/usr.sbin/sysinst/part_edit.c b/usr.sbin/sysinst/part_edit.c index 7d662261e730..708703362baf 100644 --- a/usr.sbin/sysinst/part_edit.c +++ b/usr.sbin/sysinst/part_edit.c @@ -1,4 +1,4 @@ -/* $NetBSD: part_edit.c,v 1.24 2020/10/12 16:27:23 martin Exp $ */ +/* $NetBSD: part_edit.c,v 1.25 2021/01/31 22:45:46 rillig Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -737,7 +737,7 @@ draw_outer_ptn_header(menudesc *m, void *arg) if (marg->cur_id == NO_PART) return; - for (attr_no = 0; attr_no < + for (attr_no = 0; attr_no < marg->parts->pscheme->custom_attribute_count; attr_no++) { bool writable = marg->parts->pscheme->custom_attribute_writable( @@ -968,7 +968,7 @@ parts_use_wholedisk(struct disk_partitions *parts, struct disk_part_free_space space; daddr_t align, start; size_t i; - + parts->pscheme->delete_all_partitions(parts); align = parts->pscheme->get_part_alignment(parts); start = pm->ptstart > 0 ? pm->ptstart : -1; diff --git a/usr.sbin/sysinst/partitions.h b/usr.sbin/sysinst/partitions.h index eb677dfe8d32..47d5f39a8e4c 100644 --- a/usr.sbin/sysinst/partitions.h +++ b/usr.sbin/sysinst/partitions.h @@ -1,4 +1,4 @@ -/* $NetBSD: partitions.h,v 1.21 2020/12/02 14:20:20 wiz Exp $ */ +/* $NetBSD: partitions.h,v 1.22 2021/01/31 22:45:46 rillig Exp $ */ /* * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -377,7 +377,7 @@ struct disk_partitioning_scheme { * be considered "free", this is used e.g. when moving an existing * partition around. */ - size_t (*get_free_spaces)(const struct disk_partitions*, + size_t (*get_free_spaces)(const struct disk_partitions*, struct disk_part_free_space *result, size_t max_num_result, daddr_t min_space_size, daddr_t align, daddr_t start, daddr_t ignore /* -1 */); diff --git a/usr.sbin/sysinst/partman.c b/usr.sbin/sysinst/partman.c index 16f97b0ec8c0..e14d13ee0721 100644 --- a/usr.sbin/sysinst/partman.c +++ b/usr.sbin/sysinst/partman.c @@ -1,4 +1,4 @@ -/* $NetBSD: partman.c,v 1.50 2020/02/06 11:55:18 martin Exp $ */ +/* $NetBSD: partman.c,v 1.51 2021/01/31 22:45:46 rillig Exp $ */ /* * Copyright 2012 Eugene Lozovoy @@ -224,7 +224,7 @@ enum { /* CGD menu enum */ enum { /* LVM menu enum */ PML_MENU_PV, PML_MENU_NAME, PML_MENU_MAXLOGICALVOLUMES, - PML_MENU_MAXPHYSICALVOLUMES, PML_MENU_PHYSICALEXTENTSIZE, + PML_MENU_MAXPHYSICALVOLUMES, PML_MENU_PHYSICALEXTENTSIZE, PML_MENU_REMOVE, PML_MENU_END }; @@ -232,7 +232,7 @@ enum { /* LVM submenu (logical volumes) enum */ PMLV_MENU_NAME, PMLV_MENU_SIZE, PMLV_MENU_READONLY, PMLV_MENU_CONTIGUOUS, PMLV_MENU_EXTENTS, PMLV_MENU_MINOR, PMLV_MENU_PERSISTENT, PMLV_MENU_MIRRORS, PMLV_MENU_REGIONSIZE, PMLV_MENU_READAHEAD, - PMLV_MENU_STRIPES, PMLV_MENU_STRIPESIZE, PMLV_MENU_ZERO, + PMLV_MENU_STRIPES, PMLV_MENU_STRIPESIZE, PMLV_MENU_ZERO, PMLV_MENU_REMOVE, PMLV_MENU_END }; @@ -329,7 +329,7 @@ pm_edit(int menu_entries_count, void (*menu_fmt)(menudesc *, int, void *), menu_no = new_menu(NULL, menu_entries, menu_entries_count, -1, -1, 0, 40, MC_NOCLEAR | MC_SCROLL, NULL, menu_fmt, NULL, NULL, MSG_DONE); - + process_menu(menu_no, dev_ptr); free_menu(menu_no); free(menu_entries); @@ -390,7 +390,7 @@ pm_dev_list(int type) NULL, plain_name, false, true); menu_entries[num_devs] = (struct menu_ent) { - .opt_name = disk_entries[num_devs].fullname, + .opt_name = disk_entries[num_devs].fullname, .opt_action = set_menu_select, .opt_flags = OPT_EXIT, }; @@ -604,12 +604,12 @@ pm_raid_set_value(menudesc *m, void *arg) }; static int menu_disk_adddel = -1; if (menu_disk_adddel == -1) { - menu_disk_adddel = new_menu(NULL, menuent_disk_adddel, + menu_disk_adddel = new_menu(NULL, menuent_disk_adddel, __arraycount(menuent_disk_adddel), -1, -1, 0, 10, MC_NOCLEAR, NULL, NULL, NULL, NULL, MSG_cancel); } - + switch (m->cursel) { case PMR_MENU_DEVS: pm_raid_curspare = 0; @@ -1035,7 +1035,7 @@ pm_vnd_set_value(menudesc *m, void *arg) char buf[STRSIZE]; const char *msg_to_show = NULL; int *out_var = NULL; - + switch (m->cursel) { case PMV_MENU_FILEPATH: msg_prompt_win(MSG_vnd_path_ask, -1, 18, 0, 0, @@ -1189,10 +1189,10 @@ pm_vnd_commit(void) } } } - if (part_suit == NO_PART || pm_suit == NULL || + if (part_suit == NO_PART || pm_suit == NULL || mp_suit == NULL) continue; - + /* Mounting assigned partition and try to get real file path*/ if (pm_mount(pm_suit, part_suit) != 0) continue; @@ -1426,7 +1426,7 @@ pm_cgd_edit_new(struct pm_devs *mypm, part_id id) { struct part_entry pe = { .id = id, .parts = mypm->parts, .dev_ptr = mypm, .type = PM_CGD }; - + return pm_edit(PMC_MENU_END, pm_cgd_edit_menufmt, pm_cgd_set_value, pm_cgd_check, pm_cgd_init, &pe, NULL, 0, &cgds_t_info); @@ -1707,7 +1707,7 @@ pm_lvm_set_value(menudesc *m, void *arg) return 0; case PML_MENU_MAXLOGICALVOLUMES: msg_to_show = MSG_lvm_maxlv_ask; - out_var = &(dev_ptr->maxlogicalvolumes); + out_var = &(dev_ptr->maxlogicalvolumes); break; case PML_MENU_MAXPHYSICALVOLUMES: msg_to_show = MSG_lvm_maxpv_ask; @@ -1920,7 +1920,7 @@ pm_lvmlv_set_value(menudesc *m, void *arg) break; case PMLV_MENU_STRIPESIZE: if (dev_ptr->stripesize << 1 > 512) - dev_ptr->stripesize = 4; + dev_ptr->stripesize = 4; else dev_ptr->stripesize <<= 1; return 0; @@ -1987,7 +1987,7 @@ pm_lvm_commit(void) /* Stage 1: creating Physical Volumes (PV's) */ for (ii = 0; ii < MAX_LVM_PV && ! error; ii++) if (lvms[i].pv[ii].pm != NULL) { - run_program(RUN_SILENT | RUN_ERROR_OK, + run_program(RUN_SILENT | RUN_ERROR_OK, "lvm pvremove -ffy /dev/r%s", (char*)lvms[i].pv[ii].pm_name); error += run_program(RUN_DISPLAY | RUN_PROGRESS, @@ -2101,7 +2101,7 @@ pm_lvm_commit(void) } /*** - Partman generic functions + Partman generic functions ***/ int @@ -2463,7 +2463,7 @@ pm_mountall(void) int i, ii, error, ok; char dev[SSTRSIZE]; dev[0] = '\0'; struct pm_devs *pm_i; - + localfs_dev[0] = '\0'; if (mnts == NULL) mnts = calloc(MAX_MNTS, sizeof(*mnts)); @@ -2471,7 +2471,7 @@ pm_mountall(void) SLIST_FOREACH(pm_i, &pm_head, l) { ok = 0; for (i = 0; i < MAXPARTITIONS; i++) { - if (!(pm_i->bsdlabel[i].pi_flags & PIF_MOUNT && + if (!(pm_i->bsdlabel[i].pi_flags & PIF_MOUNT && pm_i->bsdlabel[i].mnt_opts != NULL)) continue; mnts[num_devs].mnt_opts = pm_i->bsdlabel[i].mnt_opts; @@ -2485,7 +2485,7 @@ pm_mountall(void) } mnts[num_devs].on = pm_i->bsdlabel[i].pi_mount; if (strcmp(pm_i->bsdlabel[i].pi_mount, "/") == 0) { - /* Use disk with / as a default if the user has + /* Use disk with / as a default if the user has the sets on a local disk */ strlcpy(localfs_dev, pm_i->diskdev, SSTRSIZE); } @@ -2675,7 +2675,7 @@ pm_commit(menudesc *m, void *arg) if (!secondary->pscheme->write_to_disk( secondary)) { if (logfp) - fprintf(logfp, + fprintf(logfp, "partitining error %s\n", pm_i->diskdev); return -1; @@ -2771,7 +2771,7 @@ pm_submenu(menudesc *m, void *arg) case PM_SPEC: if (cur_pe->dev_ptr != NULL) { pm_cur = cur_pe->dev_ptr; - if (pm_cur == NULL) + if (pm_cur == NULL) return -1; if (pm_cur->blocked) { clear(); @@ -3117,7 +3117,7 @@ partman(void) remove_raid_options(); else if (!(raids = calloc(MAX_RAID, sizeof(*raids)))) have_raid = 0; - + #define remove_vnd_options() (void)0 if (!have_vnd) remove_vnd_options(); @@ -3168,7 +3168,7 @@ partman(void) }; lv_t_info = (structinfo_t) { .max = MAX_LVM_LV, - .entry_size = sizeof lvms[0].lv[0], + .entry_size = sizeof lvms[0].lv[0], .entry_first = &lvms[0].lv[0], .entry_enabled = &(lvms[0].lv[0].size), .entry_blocked = &(lvms[0].lv[0].blocked), @@ -3201,7 +3201,7 @@ partman(void) pm_commit(NULL, NULL); } while (pm_retvalue > 0); - + /* retvalue <0 - error, retvalue ==0 - user quits, retvalue >0 - all ok */ return (pm_retvalue >= 0)?0:-1; } @@ -3299,7 +3299,7 @@ pm_whole_disk(struct part_entry *pe, int t) if (!pm_force_parts(my_pm)) return NO_PART; - + parts = my_pm->parts; parts->pscheme->delete_all_partitions(parts); if (parts->pscheme->secondary_scheme != NULL) { @@ -3328,7 +3328,7 @@ pm_whole_disk(struct part_entry *pe, int t) fst = FS_CGD; break; default: - assert(false); + assert(false); return NO_PART; } info.nat_type = parts->pscheme->get_fs_part_type(PT_root, fst, 0); diff --git a/usr.sbin/sysinst/target.c b/usr.sbin/sysinst/target.c index 6eb642458206..c79a2cdbe8fd 100644 --- a/usr.sbin/sysinst/target.c +++ b/usr.sbin/sysinst/target.c @@ -1,4 +1,4 @@ -/* $NetBSD: target.c,v 1.14 2020/09/27 17:51:48 martin Exp $ */ +/* $NetBSD: target.c,v 1.15 2021/01/31 22:45:47 rillig Exp $ */ /* * Copyright 1997 Jonathan Stone @@ -23,13 +23,13 @@ * THIS SOFTWARE IS PROVIDED BY JONATHAN STONE ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL PIERMONT INFORMATION SYSTEMS INC. BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * ARE DISCLAIMED. IN NO EVENT SHALL PIERMONT INFORMATION SYSTEMS INC. BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * */ @@ -39,7 +39,7 @@ /* * Copyright (c) 1989, 1991, 1993, 1995 * The Regents of the University of California. All rights reserved. - * + * * This code is derived from software contributed to Berkeley by * Jan-Simon Pendry. * @@ -53,8 +53,8 @@ * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * + * without specific prior written permission. + * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -66,12 +66,12 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - */ + */ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: target.c,v 1.14 2020/09/27 17:51:48 martin Exp $"); +__RCSID("$NetBSD: target.c,v 1.15 2021/01/31 22:45:47 rillig Exp $"); #endif /* @@ -101,7 +101,7 @@ __RCSID("$NetBSD: target.c,v 1.14 2020/09/27 17:51:48 martin Exp $"); #include "menu_defs.h" /* - * local prototypes + * local prototypes */ static void make_prefixed_dir (const char *prefix, const char *path); @@ -144,7 +144,7 @@ backtowin(void) /* - * Is the root partition we're running from the same as the root + * Is the root partition we're running from the same as the root * which the user has selected to install/upgrade? * Uses global variable "pm->diskdev" to find the selected device for * install/upgrade. @@ -224,7 +224,7 @@ is_root_part_mount(const char *last_mounted) } /* - * Is this device partition (e.g., "sd0a") mounted as root? + * Is this device partition (e.g., "sd0a") mounted as root? */ int is_active_rootpart(const char *dev, int ptn) @@ -256,7 +256,7 @@ is_active_rootpart(const char *dev, int ptn) } /* - * Pathname prefixing glue to support installation either + * Pathname prefixing glue to support installation either * from in-ramdisk miniroots or on-disk diskimages. * If our root is on the target disk, the install target is mounted * on /targetroot and we need to prefix installed pathnames with /targetroot. @@ -267,7 +267,7 @@ const char * target_prefix(void) { /* - * XXX fetch sysctl variable for current root, and compare + * XXX fetch sysctl variable for current root, and compare * to the devicename of the install target disk. */ return(target_already_root() ? "" : targetroot_mnt); @@ -276,11 +276,11 @@ target_prefix(void) /* * concatenate two pathnames. * XXX returns either input args or result in a static buffer. - * The caller must copy if it wants to use the pathname past the - * next call to a target-prefixing function, or to modify the inputs.. - * Used only internally so this is probably safe. + * The caller must copy if it wants to use the pathname past the + * next call to a target-prefixing function, or to modify the inputs. + * Used only internally so this is probably safe. */ -const char * +const char * concat_paths(const char *prefix, const char *suffix) { static char real_path[MAXPATHLEN]; @@ -297,7 +297,7 @@ concat_paths(const char *prefix, const char *suffix) if (suffix[0] == '/' || suffix[0] == 0) snprintf(real_path, sizeof(real_path), "%s%s", prefix, suffix); else - snprintf(real_path, sizeof(real_path), "%s/%s", + snprintf(real_path, sizeof(real_path), "%s/%s", prefix, suffix); return (real_path); } @@ -305,9 +305,9 @@ concat_paths(const char *prefix, const char *suffix) /* * Do target prefix expansion on a pathname. * XXX uses concat_paths and so returns result in a static buffer. - * The caller must copy if it wants to use the pathname past the - * next call to a target-prefixing function, or to modify the inputs.. - * Used only internally so this is probably safe. + * The caller must copy if it wants to use the pathname past the + * next call to a target-prefixing function, or to modify the inputs. + * Used only internally so this is probably safe. * * Not static so other functions can generate target related file names. */ @@ -319,7 +319,7 @@ target_expand(const char *tgtpath) } /* Make a directory, with a prefix like "/targetroot" or possibly just "". */ -static void +static void make_prefixed_dir(const char *prefix, const char *path) { @@ -406,7 +406,7 @@ cp_to_target(const char *srcpath, const char *tgt_path) /* * Duplicate a file from the current root to the same pathname * in the target system. Pathname must be an absolute pathname. - * If we're running in the target, do nothing. + * If we're running in the target, do nothing. */ void dup_file_into_target(const char *filename) @@ -521,7 +521,7 @@ target_mount(const char *opts, const char *from, const char *on) /* * unwind the mount stack, unmounting mounted filesystems. - * For now, ignore any errors in unmount. + * For now, ignore any errors in unmount. * (Why would we be unable to unmount? The user has suspended * us and forked shell sitting somewhere in the target root?) */ @@ -581,7 +581,7 @@ target_test(unsigned int mode, const char *path) } /* - * Verify a directory already exists in the target root + * Verify a directory already exists in the target root * filesystem. Do not create the directory if it doesn't exist. * Assumes that sysinst has already mounted the target root. */ @@ -593,7 +593,7 @@ target_test_dir(const char *path) } /* - * Verify an ordinary file already exists in the target root + * Verify an ordinary file already exists in the target root * filesystem. Do not create the directory if it doesn't exist. * Assumes that sysinst has already mounted the target root. */ diff --git a/usr.sbin/sysinst/txtwalk.c b/usr.sbin/sysinst/txtwalk.c index 220aea32e5a3..82d610272072 100644 --- a/usr.sbin/sysinst/txtwalk.c +++ b/usr.sbin/sysinst/txtwalk.c @@ -1,4 +1,4 @@ -/* $NetBSD: txtwalk.c,v 1.4 2020/02/06 19:53:10 martin Exp $ */ +/* $NetBSD: txtwalk.c,v 1.5 2021/01/31 22:45:47 rillig Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -242,7 +242,7 @@ finddata(const struct lookfor *item, char *line, struct data *found, size_t *num while (line[len] && !isspace((unsigned char)line[len]) && line[len] != fmt[1]) { - if (line[len] == '\\' + if (line[len] == '\\' && line[len+1] != 0) len++; len++; diff --git a/usr.sbin/sysinst/util.c b/usr.sbin/sysinst/util.c index 721bee5f5c4e..77f51da281b3 100644 --- a/usr.sbin/sysinst/util.c +++ b/usr.sbin/sysinst/util.c @@ -1,4 +1,4 @@ -/* $NetBSD: util.c,v 1.56 2020/11/10 09:14:01 gson Exp $ */ +/* $NetBSD: util.c,v 1.57 2021/01/31 22:45:47 rillig Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -1370,7 +1370,7 @@ do_check_entropy(void) } } } -#endif +#endif @@ -1951,7 +1951,7 @@ del_rc_conf(const char *value) int fd; int retval = 0; - /* The paths might seem strange, but using /tmp would require copy instead + /* The paths might seem strange, but using /tmp would require copy instead * of rename operations. */ if (asprintf(&rcconf, "%s", target_expand("/etc/rc.conf")) < 0 || asprintf(&tempname, "%s", target_expand("/etc/rc.conf.tmp.XXXXXX")) < 0 @@ -2004,7 +2004,7 @@ del_rc_conf(const char *value) } fclose(fp); fclose(nfp); - + if (done) { if (rename(rcconf, bakname)) { msg_display(MSG_rcconf_backup_failed); @@ -2128,7 +2128,7 @@ static int binary_available(const char *prog) { char *p, tmp[MAXPATHLEN], *path = getenv("PATH"), *opath; - + if (path == NULL) return access(prog, X_OK) == 0; path = strdup(path); @@ -2211,7 +2211,7 @@ bool use_tgz_for_set(const char *set_name) { const struct distinfo *dist; - + for (dist = dist_list; dist->set != SET_LAST; dist++) { if (dist->name == NULL) continue; @@ -2528,7 +2528,7 @@ free_install_desc(struct install_partition_desc *install) free_selected_partitions(src); for (j = i+1; j < install->num; j++) if (install->infos[j].clone_src == src) - install->infos[j].clone_src = NULL; + install->infos[j].clone_src = NULL; } #endif free(install->write_back); diff --git a/usr.sbin/sysinst/wskbd.c b/usr.sbin/sysinst/wskbd.c index 8a8e130d4117..a8b4faa454fa 100644 --- a/usr.sbin/sysinst/wskbd.c +++ b/usr.sbin/sysinst/wskbd.c @@ -1,4 +1,4 @@ -/* $NetBSD: wskbd.c,v 1.4 2019/12/13 12:05:11 martin Exp $ */ +/* $NetBSD: wskbd.c,v 1.5 2021/01/31 22:45:47 rillig Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: wskbd.c,v 1.4 2019/12/13 12:05:11 martin Exp $"); +__RCSID("$NetBSD: wskbd.c,v 1.5 2021/01/31 22:45:47 rillig Exp $"); #include #include @@ -138,7 +138,7 @@ save_kb_encoding(void) return; /* * Put the keyboard encoding into the wscons.conf file. Either: - * 1) replace an exiting line + * 1) replace an existing line * 2) replace a commented out line * or * 3) add a line to the end of the file