xref: /original-bsd/sbin/disklabel/dkcksum.c (revision cf2124ff)
1 /*-
2  * Copyright (c) 1991 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)dkcksum.c	5.1 (Berkeley) 02/21/91";
10 #endif /* not lint */
11 
12 #include <sys/types.h>
13 #include <sys/disklabel.h>
14 
15 u_short
16 dkcksum(lp)
17 	register struct disklabel *lp;
18 {
19 	register u_short *start, *end;
20 	register u_short sum = 0;
21 
22 	start = (u_short *)lp;
23 	end = (u_short *)&lp->d_partitions[lp->d_npartitions];
24 	while (start < end)
25 		sum ^= *start++;
26 	return (sum);
27 }
28