diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 1999-05-03 22:47:46 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 1999-05-03 22:47:46 +0000 |
commit | 00643782085b380c153577e17447f93d2dfd479b (patch) | |
tree | 56e064399ece314675935cbdb6cfa34b21aaad54 | |
parent | 5536ef0569d704c1a7dbc2e355846fec3a7911cd (diff) |
lifvar.h -- bye, bye
-rw-r--r-- | sys/arch/hppa/include/lifvar.h | 122 | ||||
-rw-r--r-- | sys/arch/hppa/stand/libsa/lif.c | 11 | ||||
-rw-r--r-- | sys/arch/hppa/stand/libsa/machdep.c | 4 | ||||
-rw-r--r-- | sys/arch/hppa/stand/mkboot/mkboot.c | 23 |
4 files changed, 19 insertions, 141 deletions
diff --git a/sys/arch/hppa/include/lifvar.h b/sys/arch/hppa/include/lifvar.h deleted file mode 100644 index e604e751c4c..00000000000 --- a/sys/arch/hppa/include/lifvar.h +++ /dev/null @@ -1,122 +0,0 @@ -/* $OpenBSD: lifvar.h,v 1.2 1998/09/29 07:32:26 mickey Exp $ */ - -/* - * Copyright (c) 1998 Michael Shalayeff - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * 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. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. 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. - * - * 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 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS 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. - * - * @(#)volhdr.h 8.1 (Berkeley) 6/10/93 - */ - -/* - * vohldr.h: volume header for "LIF" format volumes - */ - -struct lifvol { - short vol_id; - char vol_label[6]; - u_int vol_addr; - short vol_oct; - short vol_dummy; - u_int vol_dirsize; - short vol_version; - short vol_zero; - u_int vol_number; - u_int vol_lastvol; - u_int vol_length; - char vol_toc[6]; - char vol_dummy1[198]; - - u_int ipl_addr; - u_int ipl_size; - u_int ipl_entry; - - u_int vol_dummy2; -}; - -struct lifdir { - char dir_name[10]; - short dir_type; - u_int dir_addr; - u_int dir_length; - char dir_toc[6]; - short dir_flag; - u_int dir_implement; -}; - -struct load { - int address; - int count; -}; - -#define VOL_ID -32768 -#define VOL_OCT 4096 -#define DIR_SWAP 0x5243 -#define DIR_FS 0xcd38 -#define DIR_IOMAP 0xcd60 -#define DIR_HPUX 0xcd80 -#define DIR_ISL 0xce00 -#define DIR_PAD 0xcffe -#define DIR_AUTO 0xcfff -#define DIR_EST 0xd001 -#define DIR_TYPE 0xe942 - -#define DIR_FLAG 0x8001 /* dont ask me! */ -#define SECTSIZE 256 - -#define LIF_NUMDIR 8 - -#define LIF_VOLSTART 0 -#define LIF_VOLSIZE sizeof(struct lifvol) -#define LIF_DIRSTART 2048 -#define LIF_DIRSIZE (LIF_NUMDIR * sizeof(struct lifdir)) -#define LIF_FILESTART 8192 - -#define btolifs(b) (((b) + (SECTSIZE - 1)) / SECTSIZE) -#define lifstob(s) ((s) * SECTSIZE) -#define lifstodb(s) ((s) * SECTSIZE / DEV_BSIZE) - -#ifdef _STANDALONE -int lif_open __P((char *path, struct open_file *f)); -int lif_close __P((struct open_file *f)); -int lif_read __P((struct open_file *f, void *buf, - size_t size, size_t *resid)); -int lif_write __P((struct open_file *f, void *buf, - size_t size, size_t *resid)); -off_t lif_seek __P((struct open_file *f, off_t offset, int where)); -int lif_stat __P((struct open_file *f, struct stat *sb)); -int lif_readdir __P((struct open_file *f, char *name)); -#endif diff --git a/sys/arch/hppa/stand/libsa/lif.c b/sys/arch/hppa/stand/libsa/lif.c index 6a7f2d0e347..dbc23798f73 100644 --- a/sys/arch/hppa/stand/libsa/lif.c +++ b/sys/arch/hppa/stand/libsa/lif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lif.c,v 1.3 1999/01/25 20:15:23 mickey Exp $ */ +/* $OpenBSD: lif.c,v 1.4 1999/05/03 22:46:38 mickey Exp $ */ /* * Copyright (c) 1998 Michael Shalayeff @@ -31,9 +31,8 @@ */ #include <sys/param.h> -#include <lib/libsa/stand.h> - -#include <machine/lifvar.h> +#include <sys/disklabel.h> +#include "libsa.h" extern int debug; @@ -59,7 +58,7 @@ lif_open (path, f) register struct file *fp; register struct lifdir *dp; register char *p = NULL, *q = NULL; /* XXX shut up gcc */ - struct load load; + struct lif_load load; int err, buf_size, l; #ifdef LIFDEBUG @@ -75,7 +74,7 @@ lif_open (path, f) if (debug) printf("lif_open: unable to read LIF header (%d)\n", err); #endif - } else if ((fp->f_lp = (struct lifvol *)fp->f_buf)->vol_id == VOL_ID) { + } else if ((fp->f_lp = (struct lifvol *)fp->f_buf)->vol_id == LIF_VOL_ID) { f->f_fsdata = fp; fp->f_ld = (struct lifdir *)(fp->f_buf + LIF_DIRSTART); fp->f_seek = 0; diff --git a/sys/arch/hppa/stand/libsa/machdep.c b/sys/arch/hppa/stand/libsa/machdep.c index 79b285cee48..87dfa733697 100644 --- a/sys/arch/hppa/stand/libsa/machdep.c +++ b/sys/arch/hppa/stand/libsa/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.4 1999/04/20 20:01:02 mickey Exp $ */ +/* $OpenBSD: machdep.c,v 1.5 1999/05/03 22:46:38 mickey Exp $ */ /* * Copyright (c) 1998 Michael Shalayeff @@ -31,11 +31,11 @@ */ #include <sys/param.h> +#include <sys/disklabel.h> #include <sys/reboot.h> #include "libsa.h" #include <machine/iomod.h> #include <machine/pdc.h> -#include <machine/lifvar.h> #include "dev_hppa.h" diff --git a/sys/arch/hppa/stand/mkboot/mkboot.c b/sys/arch/hppa/stand/mkboot/mkboot.c index 7da97bf28e1..a68d4a6dd55 100644 --- a/sys/arch/hppa/stand/mkboot/mkboot.c +++ b/sys/arch/hppa/stand/mkboot/mkboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkboot.c,v 1.5 1998/09/29 07:12:58 mickey Exp $ */ +/* $OpenBSD: mkboot.c,v 1.6 1999/05/03 22:47:05 mickey Exp $ */ /* * Copyright (c) 1990, 1993 @@ -43,7 +43,7 @@ static char copyright[] = #endif /* not lint */ #ifndef lint -static char rcsid[] = "$OpenBSD: mkboot.c,v 1.5 1998/09/29 07:12:58 mickey Exp $"; +static char rcsid[] = "$OpenBSD: mkboot.c,v 1.6 1999/05/03 22:47:05 mickey Exp $"; #endif /* not lint */ #endif @@ -63,9 +63,9 @@ static char rcsid[] = "$OpenBSD: mkboot.c,v 1.5 1998/09/29 07:12:58 mickey Exp $ #ifndef hppa /* hack for cross compile XXX */ -#include "../../include/lifvar.h" +#include "../../include/disklabel.h" #else -#include <machine/lifvar.h> +#include <sys/disklabel.h> #endif #include <stdio.h> @@ -142,10 +142,10 @@ main(argc, argv) lifd[7] = lifd[6] = lifd[5] = lifd[4] = lifd[3] = lifd[2] = lifd[1]; /* record volume info */ - lifv->vol_id = htobe16(VOL_ID); + lifv->vol_id = htobe16(LIF_VOL_ID); strncpy(lifv->vol_label, "BOOT44", 6); lifv->vol_addr = htobe32(btolifs(LIF_DIRSTART)); - lifv->vol_oct = htobe16(VOL_OCT); + lifv->vol_oct = htobe16(LIF_VOL_OCT); lifv->vol_dirsize = htobe32(btolifs(LIF_DIRSIZE)); lifv->vol_version = htobe16(1); lifv->vol_lastvol = lifv->vol_number = htobe16(1); @@ -167,17 +167,17 @@ main(argc, argv) if (lifv->ipl_entry == 0) { lifv->ipl_entry = htobe32(loadpoint + entry); lifv->ipl_size = htobe32(lifstob(n)); - lifd[optind].dir_type = htobe16(DIR_ISL); + lifd[optind].dir_type = htobe16(LIF_DIR_ISL); lifd[optind].dir_implement = 0; } else { - lifd[optind].dir_type = htobe16(DIR_TYPE); + lifd[optind].dir_type = htobe16(LIF_DIR_TYPE); lifd[1].dir_implement = htobe32(loadpoint + entry); } strcpy(lifd[optind].dir_name, lifname(argv[optind])); lifd[optind].dir_length = htobe32(n); bcddate(argv[optind], lifd[optind].dir_toc); - lifd[optind].dir_flag = htobe16(DIR_FLAG); + lifd[optind].dir_flag = htobe16(LIF_DIR_FLAG); lifv->vol_length += n; pos += lifstob(n); @@ -206,7 +206,7 @@ putfile(from_file, to) register int n, total; char buf[2048]; int from, check_sum = 0; - struct load load; + struct lif_load load; if ((from = open(from_file, O_RDONLY)) < 0) err(1, from_file); @@ -218,7 +218,6 @@ putfile(from_file, to) entry = ex.a_entry; if (N_GETMAGIC(ex) == OMAGIC || N_GETMAGIC(ex) == NMAGIC) entry += sizeof(ex); - else if (IS_ELF(*(Elf32_Ehdr *)&ex)) { Elf32_Ehdr elf_header; Elf32_Phdr *elf_segments; @@ -309,6 +308,8 @@ putfile(from_file, to) } else total += n; + /* TODO should pad here to the 65k boundary for tape boot */ + if (verbose) warnx("checksum is 0x%08x", -check_sum); |