Subject: Disklabels arrive for 2.11BSD (#266 part 17 of 18)
Index:	sys,bin,usr.lib,(many more)/<many> 2.11BSD

Description:
	The moving the partitions tables out of the disk drivers and to
	a disklabel residing on the media has been on the wish list for
	many many years.

	Disklabels have finally arrived for 2.11BSD!

Repeat-By:
	Observation.  Also a reading of the setup and installation
	documentation for previous 2BSD releases (2.9, 2.10, 2.11)
	all have a paragraph similar to this present:

"It is possible to change the partitions by changing the code for the
table in the disk driver.  Since it's desirable to do this, these tables
really should be read off each pack...."

Fix:
	This is part 17 of 18.  Gather all parts before doing anything
	except reading the instructions which are in #250 (part 1).

	Updated by this part are:

/usr/src/usr.lib/libutil/dkcksum.c
/usr/src/usr.lib/libutil/Makefile

	dkcksum.c is a new file added to the system by unpacking the shar
	file included below.  This is the routine which computes the checksum
	of a disklabel.

	The Makefile is updated to include the newly added file.

	Cut where indicated and save to a file (/tmp/266).  Then:

		cd /tmp
		sh 266
		sh usr.lib.shar
		patch -p0 < usr.lib.patch
		rm 266 usr.lib.shar usr.lib.patch

--------------------------cut here---------------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	usr.lib.patch
#	usr.lib.shar
# This archive created: Tue Jun 27 22:34:03 1995
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f 'usr.lib.patch'
then
	echo shar: "will not over-write existing file 'usr.lib.patch'"
else
sed 's/^Y//' << \SHAR_EOF > 'usr.lib.patch'
Y*** /usr/src/usr.lib/libutil/Makefile.old	Sun Jan  2 01:59:06 1994
Y--- /usr/src/usr.lib/libutil/Makefile	Thu Apr 13 20:05:03 1995
Y***************
Y*** 14,26 ****
Y  # WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
Y  # FITNESS FOR A PARTICULAR PURPOSE.
Y  #
Y! # @(#)Makefile	5.4 (2.11BSD GTE) 1/2/94
Y  #
Y  
Y- # DEFS=	-DLIBC_SCCS
Y  CFLAGS=	-O ${DEFS}
Y! SRCS=	login.c logout.c logwtmp.c
Y! OBJS=	login.o logout.o logwtmp.o
Y  
Y  .c.o:
Y  	@${CC} -p ${CFLAGS} -c $*.c
Y--- 14,25 ----
Y  # WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
Y  # FITNESS FOR A PARTICULAR PURPOSE.
Y  #
Y! # @(#)Makefile	5.4.1 (2.11BSD GTE) 1995/04/13
Y  #
Y  
Y  CFLAGS=	-O ${DEFS}
Y! SRCS=	login.c logout.c logwtmp.c dkcksum.c
Y! OBJS=	login.o logout.o logwtmp.o dkcksum.o
Y  
Y  .c.o:
Y  	@${CC} -p ${CFLAGS} -c $*.c
SHAR_EOF
fi
if test -f 'usr.lib.shar'
then
	echo shar: "will not over-write existing file 'usr.lib.shar'"
else
sed 's/^Y//' << \SHAR_EOF > 'usr.lib.shar'
Y#! /bin/sh
Y# This is a shell archive, meaning:
Y# 1. Remove everything above the #! /bin/sh line.
Y# 2. Save the resulting text in a file.
Y# 3. Execute the file with /bin/sh (not csh) to create:
Y#	/usr/src/usr.lib/libutil/dkcksum.c
Y# This archive created: Mon Jun 19 21:27:32 1995
Yexport PATH; PATH=/bin:/usr/bin:$PATH
Yif test -f '/usr/src/usr.lib/libutil/dkcksum.c'
Ythen
Y	echo shar: "will not over-write existing file '/usr/src/usr.lib/libutil/dkcksum.c'"
Yelse
Ysed 's/^X//' << \SHAR_EOF > '/usr/src/usr.lib/libutil/dkcksum.c'
YX/*-
YX * Copyright (c) 1991, 1993
YX *	The Regents of the University of California.  All rights reserved.
YX *
YX * Redistribution and use in source and binary forms, with or without
YX * modification, are permitted provided that the following conditions
YX * are met:
YX * 1. Redistributions of source code must retain the above copyright
YX *    notice, this list of conditions and the following disclaimer.
YX * 2. Redistributions in binary form must reproduce the above copyright
YX *    notice, this list of conditions and the following disclaimer in the
YX *    documentation and/or other materials provided with the distribution.
YX * 3. All advertising materials mentioning features or use of this software
YX *    must display the following acknowledgement:
YX *	This product includes software developed by the University of
YX *	California, Berkeley and its contributors.
YX * 4. Neither the name of the University nor the names of its contributors
YX *    may be used to endorse or promote products derived from this software
YX *    without specific prior written permission.
YX *
YX * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
YX * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
YX * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
YX * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
YX * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
YX * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
YX * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
YX * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
YX * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
YX * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
YX * SUCH DAMAGE.
YX */
YX
YX#if	!defined(lint) && defined(LIBC_SCCS)
YXstatic char sccsid[] = "@(#)dkcksum.c	8.1 (Berkeley) 6/5/93";
YX#endif
YX
YX#include <sys/types.h>
YX#include <sys/disklabel.h>
YX
YXu_short
YXdkcksum(lp)
YX	register struct disklabel *lp;
YX{
YX	register u_short *start, *end;
YX	register u_short sum = 0;
YX
YX	start = (u_short *)lp;
YX	end = (u_short *)&lp->d_partitions[lp->d_npartitions];
YX	while (start < end)
YX		sum ^= *start++;
YX	return (sum);
YX}
YSHAR_EOF
Yfi
Yexit 0
Y#	End of shell archive
SHAR_EOF
fi
exit 0
#	End of shell archive
