From aa6dcc602115795494189992f3e11bcbb8bf5aef Mon Sep 17 00:00:00 2001 From: "Jordan K. Hubbard" Date: Wed, 20 Jan 1999 11:53:20 +0000 Subject: [PATCH] nuke dset - it doesn't work in a post-ELF world and abial has something better as a replacement (kget). --- sbin/Makefile | 3 +- sbin/dset/Makefile | 7 - sbin/dset/dset.8 | 78 -------- sbin/dset/dset.c | 433 --------------------------------------------- 4 files changed, 1 insertion(+), 520 deletions(-) delete mode 100644 sbin/dset/Makefile delete mode 100644 sbin/dset/dset.8 delete mode 100644 sbin/dset/dset.c diff --git a/sbin/Makefile b/sbin/Makefile index 58ad81c3e974..63337224be0a 100644 --- a/sbin/Makefile +++ b/sbin/Makefile @@ -1,5 +1,5 @@ # @(#)Makefile 8.5 (Berkeley) 3/31/94 -# $Id: Makefile,v 1.60 1998/12/27 19:43:28 sos Exp $ +# $Id: Makefile,v 1.61 1998/12/28 11:06:21 sos Exp $ # XXX MISSING: icheck ncheck @@ -11,7 +11,6 @@ SUBDIR= adjkerntz \ clri \ disklabel \ dmesg \ - dset \ dump \ dumpfs \ dumpon \ diff --git a/sbin/dset/Makefile b/sbin/dset/Makefile deleted file mode 100644 index ce15a61510aa..000000000000 --- a/sbin/dset/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -PROG= dset -DPADD= ${LIBKVM} -LDADD= -lkvm -CFLAGS+=-I${.CURDIR}/../../sys/ -MAN8= dset.8 - -.include diff --git a/sbin/dset/dset.8 b/sbin/dset/dset.8 deleted file mode 100644 index ed88d4ed06b7..000000000000 --- a/sbin/dset/dset.8 +++ /dev/null @@ -1,78 +0,0 @@ -.\" -.\" Copyright (c) 1996 Joerg Wunsch -.\" -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 THE DEVELOPERS 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 THE POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $Id: dset.8,v 1.6 1997/02/22 14:32:15 peter Exp $ -.\" " -.Dd May 2, 1996 -.Dt DSET 8 -.Os FreeBSD -.Sh NAME -.Nm dset -.Nd "update the boot file to the current configuration" -.Sh SYNOPSIS -.Nm dset -.Op Fl vqt -.Sh DESCRIPTION -.Nm Dset -records the configuration changes for ISA devices that have been made -from -.Em UserConfig -after booting with the -.Fl c -option. The changes (if any) are recorded to the file name returned by -.Xr getbootfile 3 . -.Nm Dset -is typically called from within -.Pa /etc/rc . -.Pp -.Nm Dset -understands the following options: -.Bl -tag -width indent -compact -.It Fl v -Verbose; tell what is being done. -.It Fl q -Quiet; don't print any error messages. -.It Fl t -Test only; don't actually record any changes to the boot file, print -only what would have been done. This implies -.Fl v . -.El -.Sh DIAGNOSTICS -The -.Nm -utility exits with status 0 on success, or with status 1 if any -problem occurred. Unless -.Fl q -has been specified, a short message hinting to the cause of the problem -will be printed to standard error output. -.Sh SEE ALSO -.Xr getbootfile 3 , -.Xr boot_i386 8 , -.Xr rc 8 -.Sh HISTORY -The -.Nm -command appeared in -.Fx 2.0.5 . diff --git a/sbin/dset/dset.c b/sbin/dset/dset.c deleted file mode 100644 index 210e92aa053b..000000000000 --- a/sbin/dset/dset.c +++ /dev/null @@ -1,433 +0,0 @@ -/* - * Copyright (c) 1995 Ugen J.S.Antsilevich - * - * Redistribution and use in source forms, with and without modification, - * are permitted provided that this entire comment appears intact. - * - * Redistribution in binary form may occur without any restrictions. - * Obviously, it would be nice if you gave credit where credit is due - * but requiring it would be too onerous. - * - * This software is provided ``AS IS'' without any warranties of any kind. - * - * Device configuration to kernel image saving utility. - */ - -#ifndef lint -static const char rcsid[] = - "$Id: dset.c,v 1.13 1998/06/28 19:06:17 bde Exp $"; -#endif /* not lint */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "i386/isa/isa_device.h" - -#include "i386/isa/pnp.h" -struct pnp_cinfo new_ov[MAX_PNP_LDN]; -struct pnp_cinfo old_ov[MAX_PNP_LDN]; - -#define TRUE 1 -#define FALSE 0 - -struct nlist nl[] = { -#define N_TABTTY 0 - {"_isa_devtab_tty"}, -#define N_TABBIO 1 - {"_isa_devtab_bio"}, -#define N_TABNET 2 - {"_isa_devtab_net"}, -#define N_TABCAM 3 - {"_isa_devtab_cam"}, -#define N_TABNULL 4 - {"_isa_devtab_null"}, - {""}, -}; -#define N_TABLAST N_TABNULL - -struct nlist nlk[] = { - {"_isa_devlist"}, - {""}, -}; - -struct nlist nlaux[] = { - {"_num_eisa_slots"}, - {""}, -}; - -struct nlist nlpnp[] = { - {"_pnp_ldn_overrides"}, - {""}, -}; - -struct nlist nlconfig[] = { - {"config.o"}, - {""}, -}; - -int quiet = FALSE; - -void -fatal(name, str) - char *name, *str; -{ - if (quiet) - exit(1); - if (str) - errx(1, "%s: %s", name, str); - else - errx(1, "%s", name); -} - -void -error(name, str) - char *name, *str; -{ - if (quiet) - return; - if (str) - warnx("%s: %s", name, str); - else - warnx("%s", name); -} - -void -usage() -{ - fprintf(stderr, "usage: dset [-qtv]\n"); - exit(1); -} - -int -main(ac, av) - int ac; - char **av; -{ - int f, res, s, i; - int modified,dev_found; - int sym; - u_long pos, entry, pos1, pos_t; - u_long flags; - struct isa_device buf, buf1; - struct isa_driver dbuf; - char nbuf[5]; - struct stat fst; - struct exec es; - kvm_t *kd; - static char errb[_POSIX2_LINE_MAX]; - const char *kernel = NULL; - - char ch; - int testonly = FALSE; - int verbose = FALSE; - - while ((ch = getopt(ac, av, "qtv")) != -1) - switch (ch) { - case 'q': - quiet = TRUE; - break; - case 't': - testonly = TRUE; - /* In test mode we want to be verbose */ - - case 'v': - verbose = TRUE; - break; - - case '?': - default: - usage(); - } - - - kernel = getbootfile(); - if (verbose) - printf("Boot image: %s\n", kernel); - - if (!(kd = kvm_open(NULL, NULL, NULL, O_RDONLY, errb))) - fatal("kvm_open", NULL); - - if (kvm_nlist(kd, nlk) != 0) - fatal("kvm_nlist", NULL); - - if (nlk[0].n_type == 0) - fatal("kvm_nlist", "bad symbol type"); - - if (nlist(kernel, nl) != 0) - fatal("nlist", NULL); - - if (nl[0].n_type == 0) - fatal("nlist", "bad symbol type"); - - if (stat(kernel, &fst) < 0) - fatal("stat", NULL); - - flags = fst.st_flags; - - if (chflags(kernel, (u_long) 0) < 0) - fatal("chflags", NULL); - - if ((f = open(kernel, O_RDWR)) <= 0) - fatal("open", NULL); - - if (read(f, &es, sizeof(struct exec)) <= 0) - fatal("read header", NULL); - - entry = es.a_entry; - - for (sym = 0; sym <= N_TABLAST; sym++) { - if (verbose) - printf("\nTable: %s\n", nl[sym].n_name); - pos = nl[sym].n_value + getpagesize() - entry; - - pos1 = nlk[0].n_value; - - if (lseek(f, pos, SEEK_SET) != pos) - fatal("seek", NULL); - - if (verbose) - printf("----------------------------------------------------\n"); - - do { - if ((res = read(f, (char *) &buf, sizeof(struct isa_device))) - <= 0) - fatal("read", NULL); - - - - if (kvm_read(kd, pos1, &pos_t, sizeof(u_long)) < 0) - fatal("kvmread", NULL); - dev_found = 0; - - while(pos_t!=0) { - if (kvm_read(kd, pos_t, &buf1, sizeof(struct isa_device)) < 0) - fatal("kvmread", NULL); - - if (buf1.id_id != buf.id_id) { - pos_t = (u_long)(buf1.id_next); - continue; - } else - dev_found=1; - - if (buf1.id_driver) - if (kvm_read(kd, (u_long) buf1.id_driver, - &dbuf, sizeof(struct isa_driver)) < 0) { - error("kvm_read", "no driver"); - } else { - if (kvm_read(kd, (u_long) dbuf.name, - nbuf, sizeof(nbuf)) < 0) { - error("kvm_read", NULL); - } else { - nbuf[sizeof(nbuf) - 1] = 0; - if (verbose) - printf("Device: %s%d\n", nbuf, buf1.id_unit); - } - } - else - error("kvm_read", "no driver"); - break; - - }; - - if (!dev_found) - continue; - - if (buf1.id_id != 0) - if (verbose) - printf( - "kernel: id=%u io=%X irq=%d drq=%d maddr=%p msize=%d flags=%X enabled=%X \n", - buf1.id_id, buf1.id_iobase, buf1.id_irq, buf1.id_drq, - buf1.id_maddr, buf1.id_msize, buf1.id_flags, buf1.id_enabled); - - if (buf.id_id != 0) - if (verbose) - printf( - "file: id=%u io=%X irq=%d drq=%d maddr=%p msize=%d flags=%X enabled=%X \n", - buf.id_id, buf.id_iobase, buf.id_irq, buf.id_drq, - buf.id_maddr, buf.id_msize, buf.id_flags, buf.id_enabled); - - - /* - * OK,now we'd compare values and set'em from kernel. - */ - modified = FALSE; - - if (buf.id_iobase != -1 && buf.id_iobase != - buf1.id_iobase) { - if (verbose) - printf("Setting IO addr\n"); - buf.id_iobase = buf1.id_iobase; - modified = TRUE; - } - if (buf.id_irq != (u_short)-1 && buf.id_irq != buf1.id_irq) { - if (verbose) - printf("Setting IRQ\n"); - buf.id_irq = buf1.id_irq; - modified = TRUE; - } - if (buf.id_drq != -1 && buf.id_drq != buf1.id_drq) { - if (verbose) - printf("Setting DRQ\n"); - buf.id_drq = buf1.id_drq; - modified = TRUE; - } - if (buf.id_maddr != (caddr_t)-1 && buf.id_maddr != buf1.id_maddr) { - if (verbose) - printf("Setting memory addres\n"); - buf.id_maddr = buf1.id_maddr; - modified = TRUE; - } - if (buf.id_msize != buf1.id_msize) { - if (verbose) - printf("Setting msize\n"); - buf.id_msize = buf1.id_msize; - modified = TRUE; - } - if (buf.id_flags != buf1.id_flags) { - if (verbose) - printf("Setting flags\n"); - buf.id_flags = buf1.id_flags; - modified = TRUE; - } - if (buf.id_enabled != buf1.id_enabled) { - if (verbose) - printf("Setting device enable/disable\n"); - buf.id_enabled = buf1.id_enabled; - modified = TRUE; - } - if (verbose) - printf("----------------------------------------------------\n"); - if (modified && !testonly) { - - res = lseek(f, -(off_t) sizeof(struct isa_device), - SEEK_CUR); - if (write(f, &buf, sizeof(struct isa_device)) <= 0) - fatal("write", NULL); - - } - } while (buf.id_id != 0 && buf1.id_id != 0); - } - - if (kvm_nlist(kd, nlaux) != 0) { - /* num_eisa_conf need not exist, only handle it if found */ - if (verbose) - printf("num_eisa_slots not found, ignoring.\n"); - } else { - if (nlaux[0].n_type == 0) - fatal("kvm_nlist", "bad symbol type"); - pos1 = nlaux[0].n_value; - if (kvm_read(kd, pos1, &s, sizeof(int)) < 0) - fatal("kvmread", NULL); - - if (nlist(kernel, nlaux) != 0) - fatal("nlist", NULL); - if (nlaux[0].n_type == 0) - fatal("nlist", "bad symbol type"); - pos = nlaux[0].n_value + getpagesize() - entry; - if (lseek(f, pos, SEEK_SET) != pos) - fatal("seek", NULL); - if ((res = read(f, (char *) &i, sizeof(int))) - <= 0) - fatal("read", NULL); - - if (i != s) { - if (verbose) - printf("\nChanging num_eisa_slots from %d to %d.\n", - i, s); - if (!testonly) { - res = lseek(f, -(off_t) sizeof(int), - SEEK_CUR); - if (write(f, &s, sizeof(int)) <= 0) - fatal("write", NULL); - } - } - } - - if (kvm_nlist(kd, nlpnp) != 0) { - /* pnp_ldn_overrides need not exist, only handle it if found */ - if (verbose) - printf("pnp_ldn_overrides not found, ignoring.\n"); - } else { - if (nlpnp[0].n_type == 0) - fatal("kvm_nlist", "bad symbol type"); - /* must handle it, read and write... */ - pos1 = nlpnp[0].n_value ; - if (kvm_read(kd, pos1, &new_ov, sizeof(new_ov) ) < 0 ) - fatal("kvmread", NULL); - if (nlist(kernel, nlpnp) != 0) - fatal("nlist", NULL); - if (nlpnp[0].n_type == 0) - fatal("nlist", "bad symbol type"); - pos = nlpnp[0].n_value + getpagesize() - entry; - if (lseek(f, pos, SEEK_SET) != pos) - fatal("seek", NULL); - if ((res = read(f, (char *) &old_ov, sizeof(old_ov))) <= 0 ) - fatal("read", NULL); - if (testonly || bcmp(&old_ov, &new_ov, sizeof(old_ov)) ) { - if (verbose) { - int i; - printf("CSN LDN conf en irq drq vendor_id. ....\n"); - for (i=0; i < MAX_PNP_LDN ; i++) { - if (new_ov[i].csn>0 && new_ov[i].csn<255) { - int maxp, maxm; - for (maxp=7; maxp>=0 ; maxp--) - if (new_ov[i].port[maxp] !=0) break; - for (maxm=3; maxm>=0 ; maxm--) - if (new_ov[i].mem[maxm].base !=0) break; - printf("%3d %3d %-4s %c ", - new_ov[i].csn, - new_ov[i].ldn, - new_ov[i].override ? "OS":"BIOS", - new_ov[i].enable ? 'y':'n'); - printf(new_ov[i].irq[0] == 0 ? " -":" %2d", - new_ov[i].irq[0]); - printf(new_ov[i].irq[1] == 0 ? " - ":"%-2d", - new_ov[i].irq[1]); - printf(new_ov[i].drq[0] == 4 ? " -":" %d", - new_ov[i].drq[0]); - printf(new_ov[i].drq[1] == 4 ? " -":" %d", - new_ov[i].drq[1]); - if (new_ov[i].vendor_id > 0) - printf(" 0x%08x", new_ov[i].vendor_id); - if (new_ov[i].flags > 0) - printf(" flags 0x%08lx", new_ov[i].flags); - if (maxp >=0) { - int j; - printf(" port 0x%x", new_ov[i].port[0]); - for(j=1;j<=maxp;j++) - printf(" 0x%x", new_ov[i].port[j]); - } - if (maxm >=0) { - int j; - printf(" mem 0x%lx", new_ov[i].mem[0].base); - for(j=1;j<=maxm;j++) - printf(" 0x%lx", new_ov[i].mem[j].base); - } - printf("\n"); - } - } - } - if (!testonly) { - res = lseek(f, -(off_t) sizeof(new_ov), - SEEK_CUR); - if (write(f,&new_ov, sizeof(new_ov)) <= 0) - fatal("write", NULL); - } - } - } - if (chflags(kernel, flags) < 0) - fatal("chflags restore", NULL); - - kvm_close(kd); - close(f); - return(0); -}