diff options
| author | cvs2svn <cvs2svn@FreeBSD.org> | 1999-01-21 00:55:32 +0000 |
|---|---|---|
| committer | cvs2svn <cvs2svn@FreeBSD.org> | 1999-01-21 00:55:32 +0000 |
| commit | 76b5366091f76c9bc73570149ef5055648fc2c39 (patch) | |
| tree | 590d020e0f2a5bea6e09d66d951a674443b21d67 /lib/libdisk | |
| parent | 4b4d01da6f07f7754ff6a6e4f5223e9f0984d1a6 (diff) | |
Diffstat (limited to 'lib/libdisk')
| -rw-r--r-- | lib/libdisk/Makefile | 22 | ||||
| -rw-r--r-- | lib/libdisk/create_chunk.c | 22 | ||||
| -rw-r--r-- | lib/libdisk/disk.c | 4 | ||||
| -rw-r--r-- | lib/libdisk/libdisk.3 | 9 | ||||
| -rw-r--r-- | lib/libdisk/libdisk.h | 3 | ||||
| -rw-r--r-- | lib/libdisk/write_disk.c | 17 |
6 files changed, 39 insertions, 38 deletions
diff --git a/lib/libdisk/Makefile b/lib/libdisk/Makefile index 1a3809931453f..1b1200dedbad1 100644 --- a/lib/libdisk/Makefile +++ b/lib/libdisk/Makefile @@ -1,11 +1,11 @@ -# $Id: Makefile,v 1.24 1998/12/30 13:29:11 jkh Exp $ +# $Id: Makefile,v 1.20 1997/02/22 15:06:25 peter Exp $ LIB= disk SRCS= blocks.c disklabel.c dkcksum.c chunk.c disk.c change.c \ - create_chunk.c rules.c write_disk.c + create_chunk.c rules.c write_disk.c data.c CFLAGS+= -Wall -CLEANFILES+= tmp.c tst01 tst01.o +CLEANFILES+= tmp.c tst01 tst01.o data.c VPATH= ${.CURDIR}/../../sbin/disklabel NOPROFILE= yes NOSHARED= yes @@ -42,6 +42,22 @@ MLINKS+= libdisk.3 Open_Disk.3 \ .include <bsd.lib.mk> +BOOTS=/usr/mdec + +.if ${MACHINE_ARCH} == "i386" +data.c: ${.CURDIR}/libdisk.h ${BOOTS}/boot1 ${BOOTS}/boot2 + file2c 'const unsigned char boot1[] = {' '};' \ + < ${BOOTS}/boot1 > tmp.c + file2c 'const unsigned char boot2[] = {' '};' \ + < ${BOOTS}/boot2 >> tmp.c + mv -f tmp.c data.c +.elif ${MACHINE_ARCH} == "alpha" +data.c: ${.CURDIR}/libdisk.h ${BOOTS}/boot1 + file2c 'const unsigned char boot1[] = {' '};' \ + < ${BOOTS}/boot1 > tmp.c + mv -f tmp.c data.c +.endif + beforeinstall: ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/libdisk.h \ ${DESTDIR}/usr/include/libdisk.h diff --git a/lib/libdisk/create_chunk.c b/lib/libdisk/create_chunk.c index 9bb8dd51f9da1..86e18f87319a1 100644 --- a/lib/libdisk/create_chunk.c +++ b/lib/libdisk/create_chunk.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: create_chunk.c,v 1.33 1999/01/08 00:32:19 jkh Exp $ + * $Id: create_chunk.c,v 1.30 1998/03/20 23:43:03 jkh Exp $ * */ @@ -151,7 +151,6 @@ Fixup_Names(struct disk *d) continue; if (strcmp(c2->name,"X")) continue; -#ifndef __alpha__ c2->oname = malloc(12); if(!c2->oname) err(1,"malloc failed"); for(j=1;j<=NDOSPART;j++) { @@ -168,10 +167,6 @@ Fixup_Names(struct disk *d) } if (c2->oname) free(c2->oname); -#else - free(c2->name); - c2->name = strdup(c1->name); -#endif } for(c2 = c1->part; c2 ; c2 = c2->next) { if (c2->type == freebsd) { @@ -259,19 +254,18 @@ MakeDev(struct chunk *c1, const char *path) return 0; if (!strncmp(p, "wd", 2)) - bmaj = 0, cmaj = 3, p += 2; + bmaj = 0, cmaj = 3; else if (!strncmp(p, "sd", 2)) - bmaj = 4, cmaj = 13, p += 2; + bmaj = 4, cmaj = 13; else if (!strncmp(p, "wfd", 3)) - bmaj = 1, cmaj = 87, p += 3; - else if (!strncmp(p, "fla", 3)) - bmaj = 28, cmaj = 101, p += 3; + bmaj = 1, cmaj = 87; else if (!strncmp(p, "da", 2)) /* CAM support */ - bmaj = 4, cmaj = 13, p += 2; + bmaj = 4, cmaj = 13; else { msgDebug("MakeDev: Unknown major/minor for devtype %s\n", p); return 0; } + p += 2; if (!isdigit(*p)) { msgDebug("MakeDev: Invalid disk unit passed: %s\n", p); return 0; @@ -288,7 +282,6 @@ MakeDev(struct chunk *c1, const char *path) unit += (*p - '0'); p++; } -#ifndef __alpha__ if (*p != 's') { msgDebug("MakeDev: `%s' is not a valid slice delimiter\n", p); return 0; @@ -306,9 +299,6 @@ MakeDev(struct chunk *c1, const char *path) p++; } slice = slice + 1; -#else - slice = 0; -#endif if (!*p) { part = 2; if(c1->type == freebsd) diff --git a/lib/libdisk/disk.c b/lib/libdisk/disk.c index 4d6deafc65fd3..f5c19994b4a8a 100644 --- a/lib/libdisk/disk.c +++ b/lib/libdisk/disk.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: disk.c,v 1.38 1998/10/06 11:57:08 dfr Exp $ + * $Id: disk.c,v 1.37 1998/09/30 21:40:51 jkh Exp $ * */ @@ -323,7 +323,7 @@ Collapse_Disk(struct disk *d) } #endif -static char * device_list[] = {"wd", "sd", "da", "wfd", "fla", 0}; +static char * device_list[] = {"wd","sd","da","wfd",0}; char ** Disk_Names() diff --git a/lib/libdisk/libdisk.3 b/lib/libdisk/libdisk.3 index 5657fd32e4305..6b56cf7de2498 100644 --- a/lib/libdisk/libdisk.3 +++ b/lib/libdisk/libdisk.3 @@ -25,7 +25,7 @@ .\" (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: libdisk.3,v 1.7 1998/06/06 05:50:52 jkoshy Exp $ +.\" $Id: libdisk.3,v 1.6 1998/03/19 07:34:03 charnier Exp $ .\" " .Dd March 15, 1996 .Dt LIBDISK 3 @@ -63,6 +63,7 @@ .Sh SYNOPSIS .Fd #include <sys/types.h> .Fd #include <libdisk.h> +.Dv extern const u_char *boot1, boot2; .\" What is the correct way to cause a single line break ??? .Bd -literal .Dv extern const char *chunk_n[]; @@ -262,7 +263,11 @@ is called. .Fn Set_Boot_Blocks sets the boot-blocks for use on this disk. Gets written when .Fn Write_Disk -is called. +is called. The external variables +.Dv boot1 +and +.Dv boot2 +contain suitable data to be passed to this function. .Pp .Fn Write_Disk writes all the MBRs, disklabels, bootblocks and boot managers. diff --git a/lib/libdisk/libdisk.h b/lib/libdisk/libdisk.h index 91b1817b6ddd0..3ae62cab12f39 100644 --- a/lib/libdisk/libdisk.h +++ b/lib/libdisk/libdisk.h @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * -* $Id: libdisk.h,v 1.29 1998/10/06 11:57:08 dfr Exp $ +* $Id: libdisk.h,v 1.28 1998/01/20 11:03:15 bde Exp $ * */ @@ -86,6 +86,7 @@ struct chunk { }; extern const char *chunk_n[]; +extern const u_char boot1[], boot2[]; const char * slice_type_name( int type, int subtype ); diff --git a/lib/libdisk/write_disk.c b/lib/libdisk/write_disk.c index b27d17b2c79e2..6d3b2a7d1d1c5 100644 --- a/lib/libdisk/write_disk.c +++ b/lib/libdisk/write_disk.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: write_disk.c,v 1.24 1998/10/27 21:14:03 msmith Exp $ + * $Id: write_disk.c,v 1.22 1998/09/30 21:40:51 jkh Exp $ * */ @@ -64,10 +64,10 @@ Write_FreeBSD(int fd, struct disk *new, struct disk *old, struct chunk *c1) for(c2=c1->part;c2;c2=c2->next) { if (c2->type == unused) continue; if (!strcmp(c2->name,"X")) continue; - j = c2->name[strlen(new->name) + 2] - 'a'; + j = c2->name[5] - 'a'; if (j < 0 || j >= MAXPARTITIONS || j == RAW_PART) { #ifdef DEBUG - warn("Weird parititon letter %c",c2->name[strlen(new->name) + 2]); + warn("Weird parititon letter %c",c2->name[5]); #endif continue; } @@ -110,14 +110,6 @@ Write_FreeBSD(int fd, struct disk *new, struct disk *old, struct chunk *c1) #ifdef __alpha__ /* - * Tell SRM where the bootstrap is. - */ - lp = (u_long *)buf; - lp[60] = 15; - lp[61] = 1; - lp[62] = 0; - - /* * Generate the bootblock checksum for the SRM console. */ for (lp = (u_long *)buf, i = 0, sum = 0; i < 63; i++) @@ -181,7 +173,6 @@ Write_Disk(struct disk *d1) if (c1->type == unused) continue; if (!strcmp(c1->name,"X")) continue; j = c1->name[4] - '1'; - j = c1->name[strlen(d1->name) + 1] - '1'; if (j < 0 || j > 3) continue; s[j]++; @@ -250,7 +241,6 @@ Write_Disk(struct disk *d1) if (dp[i].dp_typ == 0xa5) dp[i].dp_flag = 0x80; -#ifndef __alpha__ mbr = read_block(fd,WHERE(0,d1)); if (d1->bootmgr) memcpy(mbr,d1->bootmgr,DOSPARTOFF); @@ -258,7 +248,6 @@ Write_Disk(struct disk *d1) mbr[512-2] = 0x55; mbr[512-1] = 0xaa; write_block(fd,WHERE(0,d1),mbr); -#endif i = 1; i = ioctl(fd,DIOCSYNCSLICEINFO,&i); |
