Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libahdi Routines to handle Atari's AHDI disk partitionin...



details:   https://anonhg.NetBSD.org/src/rev/885dc0ee4c59
branches:  trunk
changeset: 481776:885dc0ee4c59
user:      jdc <jdc%NetBSD.org@localhost>
date:      Sat Feb 05 20:40:35 2000 +0000

description:
Routines to handle Atari's AHDI disk partitioning scheme.

diffstat:

 lib/libahdi/Makefile            |   19 ++
 lib/libahdi/ahdi.4              |  135 +++++++++++++++
 lib/libahdi/ahdi_buildlabel.3   |   85 +++++++++
 lib/libahdi/ahdi_checklabel.3   |   96 +++++++++++
 lib/libahdi/ahdi_readlabel.3    |  122 ++++++++++++++
 lib/libahdi/ahdi_writedisktab.3 |  114 +++++++++++++
 lib/libahdi/ahdi_writelabel.3   |  120 +++++++++++++
 lib/libahdi/build.c             |   87 ++++++++++
 lib/libahdi/check.c             |  143 ++++++++++++++++
 lib/libahdi/cksum.c             |   73 ++++++++
 lib/libahdi/libahdi.h           |   80 +++++++++
 lib/libahdi/magic.c             |   80 +++++++++
 lib/libahdi/openraw.c           |   66 +++++++
 lib/libahdi/privahdi.h          |   56 ++++++
 lib/libahdi/read.c              |  272 +++++++++++++++++++++++++++++++
 lib/libahdi/shlib_version       |    6 +
 lib/libahdi/write.c             |  348 ++++++++++++++++++++++++++++++++++++++++
 lib/libahdi/writedtab.c         |  116 +++++++++++++
 18 files changed, 2018 insertions(+), 0 deletions(-)

diffs (truncated from 2090 to 300 lines):

diff -r f5b6df476338 -r 885dc0ee4c59 lib/libahdi/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libahdi/Makefile      Sat Feb 05 20:40:35 2000 +0000
@@ -0,0 +1,19 @@
+#      $NetBSD: Makefile,v 1.1 2000/02/05 20:40:35 jdc Exp $
+
+.if ${MACHINE} == "atari"
+LIB=   ahdi
+SRCS=  build.c check.c cksum.c magic.c openraw.c read.c write.c writedtab.c
+INCS=  libahdi.h
+INCSDIR=/usr/include
+.endif
+
+MAN=   ahdi_buildlabel.3 ahdi_checklabel.3 ahdi_readlabel.3 \
+       ahdi_writedisktab.3 ahdi_writelabel.3 ahdi.4
+MANSUBDIR=      /atari
+
+.if ${MACHINE} == "atari"
+.include <bsd.lib.mk>
+.else
+.include <bsd.man.mk>
+.endif
+.include <bsd.subdir.mk>
diff -r f5b6df476338 -r 885dc0ee4c59 lib/libahdi/ahdi.4
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libahdi/ahdi.4        Sat Feb 05 20:40:35 2000 +0000
@@ -0,0 +1,135 @@
+.\"    $NetBSD: ahdi.4,v 1.1 2000/02/05 20:40:36 jdc Exp $
+.\"
+.\" Copyright (c) 1998 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\" 
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Julian Coleman.
+.\" 
+.\" 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 NetBSD
+.\"    Foundation, Inc. and its contributors.
+.\" 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+.\"
+.Dd January 5, 2000
+.Dt ahdi 4
+.Sh NAME
+.Nm ahdi
+.Nd format of AHDI partitioned disk
+.Sh DESCRIPTION
+The AHDI disk format consists of a root sector (sector 0) containing:
+.Bl -column "Offset" "Contents" -offset indent
+.It Em Offset Ta Em Contents
+.It Li 0x000 Ta
+Boot code (can be empty)
+.It Li 0x1c2 Ta
+Size of hard disk in sectors
+.It Li 0x1c6 Ta
+First partition information
+.It Li 0x1d2 Ta
+Second partition information
+.It Li 0x1de Ta
+Third partition information
+.It Li 0x1ea Ta
+Fourth partition information
+.It Li 0x1f6 Ta
+Sector containing start of bad sector list (usually 1)
+.It Li 0x1fa Ta
+Length of bad sector list, in sectors (usually 1)
+.It Li 0x1fe Ta
+Root sector checksum
+.El
+.Pp
+The format of the partition information is:
+.Bl -column "Offset" "Contents" -offset indent
+.It Li Em Offset Ta Em Contents
+.It Li 0x00 Ta
+Partition flag (0x1 if partition is valid, 0x0 otherwise)
+.It Li 0x01 Ta
+Partition ID (e.g. NBD, GEM)
+.It Li 0x04 Ta
+Partition start sector
+.It Li 0x08 Ta
+Partition size in sectors
+.El
+.Pp
+The offsets are in bytes from the start of the sector.
+.Pp
+If the partition ID is
+.Em XGM ,
+the partition is a pointer to an extended partition, where the start
+sector is the sector containing the auxiliary root and the size is the
+size of the auxiliary root and any partitions it references.
+.Pp
+The format of the auxiliary root sector is the same as that of the root
+sector.  However, the only valid fields are at most two of the partition
+structures.  Only one of these can reference to a non-XGM partition.  The
+start sector in the partition structure contains the offset of the partition
+from the start of the
+.Em first
+auxiliary partition.
+.Pp
+Partitions referenced from the root sector (sector 0) are known as
+.Em primary partitions ,
+while those referenced from auxiliary root sectors are known as
+.Em extended partitions .
+.Pp
+The bad sector list consists of 3-byte entries.  The first entry contains
+the number of vendor bad sectors recorded.  The first byte of the second
+entry contains a checksum byte which causes the bytewise sum of the whole
+bad sector list to be 0xa5.  The remaining entries are vendor bad sectors
+followed by user bad sectors.
+.Pp
+The
+.Nx
+disklabel is written in the first partition with ID
+.Em NBD
+or
+.Em RAW .
+If neither of these partition ID's is present on the disk, no
+.Nx
+disklabel will exist on the disk.  In this case, an in-core disklabel is
+automatically generated by the
+.Nx
+kernel.
+.Sh NOTES
+The AHDI disk format only supports media with a 512 byte sector size.
+.Pp
+It is only possible to boot from a
+.Em primary partition .
+.Sh SEE ALSO
+.Xr ahdi_buildlabel 3 ,
+.Xr ahdi_checklabel 3 ,
+.Xr ahdi_readlabel 3 ,
+.Xr ahdi_writedisktab 3 ,
+.Xr ahdi_writelabel 3
+.Sh HISTORY
+The
+.Nm libahdi
+package appeared in
+.Nx 1.5 .
+.Sh AUTHORS
+.An Julian Coleman, Waldi Ravens, Leo Weppelman
diff -r f5b6df476338 -r 885dc0ee4c59 lib/libahdi/ahdi_buildlabel.3
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libahdi/ahdi_buildlabel.3     Sat Feb 05 20:40:35 2000 +0000
@@ -0,0 +1,85 @@
+.\"    $NetBSD: ahdi_buildlabel.3,v 1.1 2000/02/05 20:40:36 jdc Exp $
+.\"
+.\" Copyright (c) 1998 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\" 
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Julian Coleman.
+.\" 
+.\" 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 NetBSD
+.\"    Foundation, Inc. and its contributors.
+.\" 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+.\"
+.Dd January 5, 2000
+.Dt ahdi_buildlabel 3
+.Sh NAME
+.Nm ahdi_buildlabel
+.Nd build AHDI partition label
+.Sh LIBRARY
+.Lb libahdi
+.Sh SYNOPSIS
+.Fd #include <libahdi.h>
+.Ft int
+.Fn ahdi_buildlabel "struct ahdi_ptable *ptable"
+.Sh DESCRIPTION
+The
+.Nm
+function builds a label suitable for use on AHDI partitioned disk.  If the
+total number of partitions is greater than four, it will make the first
+three partitions primary partitions and the others extended partitions.
+If the total number of partitions is four or less, the function will make
+all the partitions primary partitions.
+.Pp
+If passed a partition table containing primary and/or extended partitions,
+these will be modified, if necessary, to conform to the above specifications.
+If there are no primary or extended partitions in the partition table, they
+will be created.  In both cases, the start sector of partitions may be
+modified in order to leave space for any auxiliary root sectors.
+.Sh DIAGNOSTICS
+The
+.Nm
+function returns the following codes:
+.Bl -column "Code" "Meaning" -offset indent
+.It Em Code Ta Em Meaning
+.It Li 1 Ta
+Partition table was modified.
+.It Li 0 Ta
+Partition table was not modified.
+.El
+.Sh SEE ALSO
+.Xr ahdi_checklabel 3 ,
+.Xr ahdi_readlabel 3 ,
+.Xr ahdi_writedisktab 3 ,
+.Xr ahdi_writelabel 3 ,
+.Xr ahdi 4
+.Sh HISTORY
+The
+.Nm libahdi
+package appeared in
+.Nx 1.5 .
+.Sh AUTHORS
+.An Julian Coleman, Waldi Ravens, Leo Weppelman
diff -r f5b6df476338 -r 885dc0ee4c59 lib/libahdi/ahdi_checklabel.3
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libahdi/ahdi_checklabel.3     Sat Feb 05 20:40:35 2000 +0000
@@ -0,0 +1,96 @@
+.\"    $NetBSD: ahdi_checklabel.3,v 1.1 2000/02/05 20:40:37 jdc Exp $
+.\"
+.\" Copyright (c) 1998 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\" 
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Julian Coleman.
+.\" 
+.\" 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 NetBSD
+.\"    Foundation, Inc. and its contributors.
+.\" 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+.\"
+.Dd January 5, 2000
+.Dt ahdi_checklabel 3
+.Sh NAME
+.Nm ahdi_checklabel
+.Nd check AHDI partition label
+.Sh LIBRARY
+.Lb libahdi
+.Sh SYNOPSIS
+.Fd #include <libahdi.h>



Home | Main Index | Thread Index | Old Index