summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2000-09-16 13:43:00 +0000
committerphk <phk@FreeBSD.org>2000-09-16 13:43:00 +0000
commitfc5495e38e718593b4b118d08cfd5bfaaec0324e (patch)
tree288e533daff3fc8bb716c9d5d094e36bb94cc3bc
parentd927c81a820d92ba849c803c943f34c82608d3f2 (diff)
downloadFreeBSD-src-fc5495e38e718593b4b118d08cfd5bfaaec0324e.zip
FreeBSD-src-fc5495e38e718593b4b118d08cfd5bfaaec0324e.tar.gz
Turn dkcksum() into an __inline function.
Change its type to u_int_16_t.
-rw-r--r--lib/libdisk/Makefile3
-rw-r--r--lib/libdisk/libdisk.h1
-rw-r--r--lib/libstand/stand.h1
-rw-r--r--sbin/bsdlabel/Makefile2
-rw-r--r--sbin/bsdlabel/bsdlabel.c1
-rw-r--r--sbin/bsdlabel/dkcksum.c57
-rw-r--r--sbin/disklabel/Makefile2
-rw-r--r--sbin/disklabel/disklabel.c1
-rw-r--r--sbin/disklabel/dkcksum.c57
-rw-r--r--sbin/newfs/Makefile5
-rw-r--r--sys/kern/subr_disklabel.c17
-rw-r--r--sys/sys/disklabel.h16
-rw-r--r--sys/sys/diskmbr.h16
-rw-r--r--sys/sys/diskpc98.h16
14 files changed, 51 insertions, 144 deletions
diff --git a/lib/libdisk/Makefile b/lib/libdisk/Makefile
index 3711085..0916c46 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 34646dd..0a33717 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 e48565a..b3d7c41 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 4090fc4..5513ad3 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 1f396a1..a3fc788 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 3a58aa2..0000000
--- 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 <sys/types.h>
-#include <sys/disklabel.h>
-
-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 4090fc4..5513ad3 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 1f396a1..a3fc788 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 3a58aa2..0000000
--- 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 <sys/types.h>
-#include <sys/disklabel.h>
-
-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 7ad8c5a..7dc817c 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 ed68f38..d7d5dce 100644
--- a/sys/kern/subr_disklabel.c
+++ b/sys/kern/subr_disklabel.c
@@ -324,23 +324,6 @@ done:
}
/*
- * 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 c88f654..59fb31b 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 c88f654..59fb31b 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 c88f654..59fb31b 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,
OpenPOWER on IntegriCloud