xref: /original-bsd/sbin/disklabel/dkcksum.c (revision c3e32dec)
1 /*-
2  * Copyright (c) 1991, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)dkcksum.c	8.1 (Berkeley) 06/05/93";
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