Remove superfluous (and old) copies.

There are still many more things to clean up here...
This commit is contained in:
Andrzej Bialecki 1998-09-24 16:37:37 +00:00
parent 05209199cf
commit 0f28f98cb8
8 changed files with 8 additions and 260 deletions

View File

@ -1,7 +1,8 @@
# $Id: Makefile,v 1.1 1997/07/16 12:24:19 julian Exp $
# $Id: Makefile,v 1.1 1997/07/22 02:50:58 julian Exp $
#
PROG=dumpnlist
NOMAN=yes
.PATH: ${.CURDIR}/../../..
.include <bsd.prog.mk>

View File

@ -1,45 +0,0 @@
#include <sys/types.h>
#include <sys/fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <nlist.h>
#include <stdio.h>
struct nlist nl[] = {
{"_isa_devtab_bio"},
{"_isa_devtab_tty"},
{"_isa_devtab_net"},
{"_isa_devtab_null"},
{"_isa_biotab_wdc"},
{"_isa_biotab_fdc"},
{"_eisadriver_set"},
{"_eisa_dev_list"},
{"_pcidevice_set"},
{"_device_list"},
{"_scbusses"},
{"_scsi_cinit"},
{"_scsi_dinit"},
{"_scsi_tinit"},
{""},
};
int
main(int ac, char **av)
{
int i;
i = nlist(av[1], nl);
if (i == -1) {
fprintf(stderr, "nlist returns error for %s\n", av[1]);
perror("nlist");
return 1;
}
printf("%d\n", sizeof(nl) / sizeof(struct nlist));
i=0;
do {
printf("%s\n", nl[i].n_name);
printf("%d %d %d %ld\n",
nl[i].n_type, nl[i].n_other, nl[i].n_desc, nl[i].n_value);
} while(strcmp(nl[i++].n_name,"")!=NULL);
return 0;
}

View File

@ -1,7 +1,8 @@
# $Id: Makefile,v 1.1 1997/07/16 12:24:20 julian Exp $
# $Id: Makefile,v 1.1 1997/07/22 02:50:59 julian Exp $
#
PROG=write_mfs_in_kernel
NOMAN=yes
.PATH: ${.CURDIR}/../../..
.include <bsd.prog.mk>

View File

@ -1,70 +0,0 @@
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: write_mfs_in_kernel.c,v 1.1 1997/07/16 12:24:21 julian Exp $
*
* This program patches a filesystem into a kernel made with MFS_ROOT
* option.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <ufs/ffs/fs.h>
main(int argc, char **argv)
{
unsigned char *buf_kernel, *buf_fs, *p,*q;
int fd_kernel, fd_fs;
struct stat st_kernel, st_fs;
u_long l;
if (argc < 3) {
fprintf(stderr,"Usage:\n\t%s kernel fs\n");
exit(2);
}
fd_kernel = open(argv[1],O_RDWR);
if (fd_kernel < 0) { perror(argv[1]); exit(2); }
fstat(fd_kernel,&st_kernel);
fd_fs = open(argv[2],O_RDONLY);
if (fd_fs < 0) { perror(argv[2]); exit(2); }
fstat(fd_fs,&st_fs);
buf_kernel = malloc(st_kernel.st_size);
if (!buf_kernel) { perror("malloc"); exit(2); }
buf_fs = malloc(st_fs.st_size);
if (!buf_fs) { perror("malloc"); exit(2); }
if (st_kernel.st_size != read(fd_kernel,buf_kernel,st_kernel.st_size))
{ perror(argv[1]); exit(2); }
if (st_fs.st_size != read(fd_fs,buf_fs,st_fs.st_size))
{ perror(argv[2]); exit(2); }
for(l=0,p=buf_kernel; l < st_kernel.st_size - st_fs.st_size ; l++,p++ )
if(*p == 'M' && !strcmp(p,"MFS Filesystem goes here"))
goto found;
fprintf(stderr,"MFS filesystem signature not found in %s\n",argv[1]);
exit(1);
found:
for(l=0,q= p + SBOFF; l < st_fs.st_size - SBOFF ; l++,q++ )
if (*q)
goto fail;
memcpy(p+SBOFF,buf_fs+SBOFF,st_fs.st_size-SBOFF);
lseek(fd_kernel,0L,SEEK_SET);
if (st_kernel.st_size != write(fd_kernel,buf_kernel,st_kernel.st_size))
{ perror(argv[1]); exit(2); }
exit(0);
fail:
l += SBOFF;
fprintf(stderr,"Obstruction in kernel after %ld bytes (%ld Kbyte)\n",
l, l/1024);
fprintf(stderr,"Filesystem is %ld bytes (%ld Kbyte)\n",
(u_long)st_fs.st_size, (u_long)st_fs.st_size/1024);
exit(1);
}

View File

@ -1,7 +1,8 @@
# $Id: Makefile,v 1.1.1.1 1998/07/14 07:30:53 abial Exp $
# $Id: Makefile,v 1.1.1.1 1998/08/27 17:38:45 abial Exp $
#
PROG=dumpnlist
NOMAN=yes
.PATH: ${.CURDIR}/../../..
.include <bsd.prog.mk>

View File

@ -1,45 +0,0 @@
#include <sys/types.h>
#include <sys/fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <nlist.h>
#include <stdio.h>
struct nlist nl[] = {
{"_isa_devtab_bio"},
{"_isa_devtab_tty"},
{"_isa_devtab_net"},
{"_isa_devtab_null"},
{"_isa_biotab_wdc"},
{"_isa_biotab_fdc"},
{"_eisadriver_set"},
{"_eisa_dev_list"},
{"_pcidevice_set"},
{"_device_list"},
{"_scbusses"},
{"_scsi_cinit"},
{"_scsi_dinit"},
{"_scsi_tinit"},
{""},
};
int
main(int ac, char **av)
{
int i;
i = nlist(av[1], nl);
if (i == -1) {
fprintf(stderr, "nlist returns error for %s\n", av[1]);
perror("nlist");
return 1;
}
printf("%d\n", sizeof(nl) / sizeof(struct nlist));
i=0;
do {
printf("%s\n", nl[i].n_name);
printf("%d %d %d %ld\n",
nl[i].n_type, nl[i].n_other, nl[i].n_desc, nl[i].n_value);
} while(strcmp(nl[i++].n_name,"")!=NULL);
return 0;
}

View File

@ -1,8 +1,9 @@
# $Id: Makefile,v 1.1.1.1 1998/07/14 07:30:54 abial Exp $
# $Id: Makefile,v 1.1.1.1 1998/08/27 17:38:45 abial Exp $
#
PROG=wmik
SRCS=write_mfs_in_kernel.c
NOMAN=yes
.PATH: ${.CURDIR}/../../..
.include <bsd.prog.mk>

View File

@ -1,96 +0,0 @@
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: write_mfs_in_kernel.c,v 1.1.1.1 1998/07/14 07:30:54 abial Exp $
*
* This program patches a filesystem into a kernel made with MFS_ROOT
* option.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <ufs/ffs/fs.h>
static int force = 0; /* don't check for zeros, may corrupt kernel */
int
main(int argc, char **argv)
{
unsigned char *buf_kernel, *buf_fs, *p,*q, *prog;
int fd_kernel, fd_fs, ch, errs=0;
struct stat st_kernel, st_fs;
u_long l;
prog= *argv;
while ((ch = getopt(argc, argv, "f")) != EOF)
switch(ch) {
case 'f':
force = 1 - force;
break;
default:
errs++;
}
argc -= optind;
argv += optind;
if (errs || argc != 2) {
fprintf(stderr,"Usage:\n\t%s [-f] kernel fs\n", prog);
exit(2);
}
--argv; /* original prog did not use getopt(3) */
fd_kernel = open(argv[1],O_RDWR);
if (fd_kernel < 0) { perror(argv[1]); exit(2); }
fstat(fd_kernel,&st_kernel);
fd_fs = open(argv[2],O_RDONLY);
if (fd_fs < 0) { perror(argv[2]); exit(2); }
fstat(fd_fs,&st_fs);
buf_kernel = malloc(st_kernel.st_size);
if (!buf_kernel) { perror("malloc"); exit(2); }
buf_fs = malloc(st_fs.st_size);
if (!buf_fs) { perror("malloc"); exit(2); }
if (st_kernel.st_size != read(fd_kernel,buf_kernel,st_kernel.st_size))
{ perror(argv[1]); exit(2); }
if (st_fs.st_size != read(fd_fs,buf_fs,st_fs.st_size))
{ perror(argv[2]); exit(2); }
for(l=0,p=buf_kernel; l < st_kernel.st_size - st_fs.st_size ; l++,p++ )
if(*p == 'M' && !strcmp(p,"MFS Filesystem goes here"))
goto found;
fprintf(stderr,"MFS filesystem signature not found in %s\n",argv[1]);
exit(1);
found:
if (!force)
for(l=0,q= p + SBOFF; l < st_fs.st_size - SBOFF ; l++,q++ )
if (*q)
goto fail;
memcpy(p+SBOFF,buf_fs+SBOFF,st_fs.st_size-SBOFF);
lseek(fd_kernel,0L,SEEK_SET);
if (st_kernel.st_size != write(fd_kernel,buf_kernel,st_kernel.st_size))
{ perror(argv[1]); exit(2); }
exit(0);
fail:
l += SBOFF;
fprintf(stderr,"Obstruction in kernel after %ld bytes (%ld Kbyte)\n",
l, l/1024);
fprintf(stderr,"Filesystem is %ld bytes (%ld Kbyte)\n",
(u_long)st_fs.st_size, (u_long)st_fs.st_size/1024);
exit(1);
}
/*
* I added a '-f' option to force writing the image into the kernel, even when
* there is already data (i.e. not zero) in the written area. This is useful
* to rewrite a changed MFS-image. Beware: If the written image is larger than
* the space reserved in the kernel (with option MFS_ROOT) then
* THIS WILL CORRUPT THE KERNEL!
*
*/