diff --git a/lib/libdisk/Makefile b/lib/libdisk/Makefile index 371108561a6d..0916c467de16 100644 --- a/lib/libdisk/Makefile +++ b/lib/libdisk/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ LIB= disk -SRCS= blocks.c disklabel.c dkcksum.c chunk.c disk.c change.c \ +SRCS= blocks.c disklabel.c chunk.c disk.c change.c \ create_chunk.c rules.c write_disk.c INCS= libdisk.h @@ -10,7 +10,6 @@ CFLAGS+= -Wall CFLAGS+= -DPC98 .endif CLEANFILES+= tmp.c tst01 tst01.o -VPATH= ${.CURDIR}/../../sbin/disklabel NOPROFILE= yes NOSHARED= yes NOPIC= yes diff --git a/lib/libdisk/libdisk.h b/lib/libdisk/libdisk.h index 34646dd95148..0a33717ff3c8 100644 --- a/lib/libdisk/libdisk.h +++ b/lib/libdisk/libdisk.h @@ -265,7 +265,6 @@ int Add_Chunk(struct disk *, long, u_long, const char *, chunk_e, int, u_long); void * read_block(int, daddr_t); void write_block(int fd, daddr_t block, void *foo); struct disklabel * read_disklabel(int, daddr_t); -u_short dkcksum(struct disklabel *); struct chunk * Find_Mother_Chunk(struct chunk *, u_long, u_long, chunk_e); struct disk * Int_Open_Disk(const char *name, u_long size); void Fixup_Names(struct disk *); diff --git a/lib/libstand/stand.h b/lib/libstand/stand.h index e48565ac7c22..b3d7c412ae57 100644 --- a/lib/libstand/stand.h +++ b/lib/libstand/stand.h @@ -212,7 +212,6 @@ extern void free_region(void *start, void *end); /* disklabel support (undocumented, may be junk) */ struct disklabel; extern char *getdisklabel(const char *, struct disklabel *); -extern int dkcksum(struct disklabel *); extern int printf(const char *fmt, ...); extern void vprintf(const char *fmt, _BSD_VA_LIST_); diff --git a/sbin/bsdlabel/Makefile b/sbin/bsdlabel/Makefile index 4090fc418d95..5513ad30437a 100644 --- a/sbin/bsdlabel/Makefile +++ b/sbin/bsdlabel/Makefile @@ -2,7 +2,7 @@ # $FreeBSD$ PROG= disklabel -SRCS= disklabel.c dkcksum.c +SRCS= disklabel.c MAN8= disklabel.8 MAN5= disklabel.5 diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c index 1f396a18f4be..a3fc78862e26 100644 --- a/sbin/bsdlabel/bsdlabel.c +++ b/sbin/bsdlabel/bsdlabel.c @@ -105,7 +105,6 @@ int checklabel __P((struct disklabel *)); void setbootflag __P((struct disklabel *)); void Warning (char *, ...); void usage __P((void)); -extern u_short dkcksum __P((struct disklabel *)); struct disklabel * getvirginlabel __P((void)); #define DEFEDITOR _PATH_VI diff --git a/sbin/bsdlabel/dkcksum.c b/sbin/bsdlabel/dkcksum.c deleted file mode 100644 index 3a58aa23044b..000000000000 --- a/sbin/bsdlabel/dkcksum.c +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. 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. - * 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. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)dkcksum.c 8.1 (Berkeley) 6/5/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include - -u_short -dkcksum(lp) - register struct disklabel *lp; -{ - register u_short *start, *end; - register u_short sum = 0; - - start = (u_short *)lp; - end = (u_short *)&lp->d_partitions[lp->d_npartitions]; - while (start < end) - sum ^= *start++; - return (sum); -} diff --git a/sbin/disklabel/Makefile b/sbin/disklabel/Makefile index 4090fc418d95..5513ad30437a 100644 --- a/sbin/disklabel/Makefile +++ b/sbin/disklabel/Makefile @@ -2,7 +2,7 @@ # $FreeBSD$ PROG= disklabel -SRCS= disklabel.c dkcksum.c +SRCS= disklabel.c MAN8= disklabel.8 MAN5= disklabel.5 diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c index 1f396a18f4be..a3fc78862e26 100644 --- a/sbin/disklabel/disklabel.c +++ b/sbin/disklabel/disklabel.c @@ -105,7 +105,6 @@ int checklabel __P((struct disklabel *)); void setbootflag __P((struct disklabel *)); void Warning (char *, ...); void usage __P((void)); -extern u_short dkcksum __P((struct disklabel *)); struct disklabel * getvirginlabel __P((void)); #define DEFEDITOR _PATH_VI diff --git a/sbin/disklabel/dkcksum.c b/sbin/disklabel/dkcksum.c deleted file mode 100644 index 3a58aa23044b..000000000000 --- a/sbin/disklabel/dkcksum.c +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. 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. - * 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. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)dkcksum.c 8.1 (Berkeley) 6/5/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include - -u_short -dkcksum(lp) - register struct disklabel *lp; -{ - register u_short *start, *end; - register u_short sum = 0; - - start = (u_short *)lp; - end = (u_short *)&lp->d_partitions[lp->d_npartitions]; - while (start < end) - sum ^= *start++; - return (sum); -} diff --git a/sbin/newfs/Makefile b/sbin/newfs/Makefile index 7ad8c5a0b1ca..7dc817c96636 100644 --- a/sbin/newfs/Makefile +++ b/sbin/newfs/Makefile @@ -1,12 +1,13 @@ # @(#)Makefile 8.2 (Berkeley) 3/27/94 +# $FreeBSD$ PROG= newfs -SRCS= dkcksum.c getmntopts.c newfs.c mkfs.c +SRCS= getmntopts.c newfs.c mkfs.c MAN8= newfs.8 MOUNT= ${.CURDIR}/../mount CFLAGS+=-DMFS -DFSIRAND -I${MOUNT} -.PATH: ${MOUNT} ${.CURDIR}/../disklabel +.PATH: ${MOUNT} LINKS= ${BINDIR}/newfs ${BINDIR}/mount_mfs MLINKS= newfs.8 mount_mfs.8 newfs.8 mfs.8 newfs.8 tmpfs.8 diff --git a/sys/kern/subr_disklabel.c b/sys/kern/subr_disklabel.c index ed68f3818b43..d7d5dce2b6ea 100644 --- a/sys/kern/subr_disklabel.c +++ b/sys/kern/subr_disklabel.c @@ -323,23 +323,6 @@ writedisklabel(dev, lp) return (error); } -/* - * Compute checksum for disk label. - */ -u_int -dkcksum(lp) - register struct disklabel *lp; -{ - register u_short *start, *end; - register u_short sum = 0; - - start = (u_short *)lp; - end = (u_short *)&lp->d_partitions[lp->d_npartitions]; - while (start < end) - sum ^= *start++; - return (sum); -} - /* * Disk error is the preface to plaintive error messages * about failing disk transfers. It prints messages of the form diff --git a/sys/sys/disklabel.h b/sys/sys/disklabel.h index c88f65400260..59fb31bdafd2 100644 --- a/sys/sys/disklabel.h +++ b/sys/sys/disklabel.h @@ -180,6 +180,21 @@ struct disklabel { #define p_sgs __partition_u1.sgs } d_partitions[MAXPARTITIONS]; /* actually may be more */ }; + +static __inline u_int16_t +dkcksum(lp) + struct disklabel *lp; +{ + u_int16_t *start, *end; + u_int16_t sum = 0; + + start = (u_int16_t *)lp; + end = (u_int16_t *)&lp->d_partitions[lp->d_npartitions]; + while (start < end) + sum ^= *start++; + return (sum); +} + #else /* LOCORE */ /* * offsets for asm boot files. @@ -449,7 +464,6 @@ int bounds_check_with_label __P((struct bio *bp, struct disklabel *lp, void diskerr __P((struct bio *bp, char *what, int pri, int blkdone, struct disklabel *lp)); void disksort __P((struct buf *ap, struct buf *bp)); -u_int dkcksum __P((struct disklabel *lp)); char *readdisklabel __P((dev_t dev, struct disklabel *lp)); void bioqdisksort __P((struct bio_queue_head *ap, struct bio *bp)); int setdisklabel __P((struct disklabel *olp, struct disklabel *nlp, diff --git a/sys/sys/diskmbr.h b/sys/sys/diskmbr.h index c88f65400260..59fb31bdafd2 100644 --- a/sys/sys/diskmbr.h +++ b/sys/sys/diskmbr.h @@ -180,6 +180,21 @@ struct disklabel { #define p_sgs __partition_u1.sgs } d_partitions[MAXPARTITIONS]; /* actually may be more */ }; + +static __inline u_int16_t +dkcksum(lp) + struct disklabel *lp; +{ + u_int16_t *start, *end; + u_int16_t sum = 0; + + start = (u_int16_t *)lp; + end = (u_int16_t *)&lp->d_partitions[lp->d_npartitions]; + while (start < end) + sum ^= *start++; + return (sum); +} + #else /* LOCORE */ /* * offsets for asm boot files. @@ -449,7 +464,6 @@ int bounds_check_with_label __P((struct bio *bp, struct disklabel *lp, void diskerr __P((struct bio *bp, char *what, int pri, int blkdone, struct disklabel *lp)); void disksort __P((struct buf *ap, struct buf *bp)); -u_int dkcksum __P((struct disklabel *lp)); char *readdisklabel __P((dev_t dev, struct disklabel *lp)); void bioqdisksort __P((struct bio_queue_head *ap, struct bio *bp)); int setdisklabel __P((struct disklabel *olp, struct disklabel *nlp, diff --git a/sys/sys/diskpc98.h b/sys/sys/diskpc98.h index c88f65400260..59fb31bdafd2 100644 --- a/sys/sys/diskpc98.h +++ b/sys/sys/diskpc98.h @@ -180,6 +180,21 @@ struct disklabel { #define p_sgs __partition_u1.sgs } d_partitions[MAXPARTITIONS]; /* actually may be more */ }; + +static __inline u_int16_t +dkcksum(lp) + struct disklabel *lp; +{ + u_int16_t *start, *end; + u_int16_t sum = 0; + + start = (u_int16_t *)lp; + end = (u_int16_t *)&lp->d_partitions[lp->d_npartitions]; + while (start < end) + sum ^= *start++; + return (sum); +} + #else /* LOCORE */ /* * offsets for asm boot files. @@ -449,7 +464,6 @@ int bounds_check_with_label __P((struct bio *bp, struct disklabel *lp, void diskerr __P((struct bio *bp, char *what, int pri, int blkdone, struct disklabel *lp)); void disksort __P((struct buf *ap, struct buf *bp)); -u_int dkcksum __P((struct disklabel *lp)); char *readdisklabel __P((dev_t dev, struct disklabel *lp)); void bioqdisksort __P((struct bio_queue_head *ap, struct bio *bp)); int setdisklabel __P((struct disklabel *olp, struct disklabel *nlp,