NetBSD/lib/libahdi/ahdi_readlabel.3

123 lines
4.1 KiB
Groff

.\" $NetBSD: ahdi_readlabel.3,v 1.1 2000/02/05 20:40:38 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_readlabel 3
.Sh NAME
.Nm ahdi_readlabel
.Nd read AHDI partition label from disk
.Sh LIBRARY
.Lb libahdi
.Sh SYNOPSIS
.Fd #include <libahdi.h>
.Ft int
.Fn ahdi_readlabel "struct ahdi_ptable *ptable" "char *diskname" "int flags"
.Sh DESCRIPTION
The
.Nm
function reads an AHDI partitioned disk and places the AHDI partition label
into
.Em ptable .
Partition letters are first assigned sequentially to partitions that have
the id `NBD' and then sequentially to other partitions. Partition `b' will
only be assigned if a partition with the id `SWP' exists. Partition `c' is
reserved for the whole disk.
.Pp
The function takes the following flags:
.Bl -column "AHDI_IGN_EXISTS" "Result" -offset indent
.It Em Flag Ta Em Result
.It Li FORCE_AHDI Ta
Read AHDI label even if NetBSD label exists
.It Li AHDI_IGN_EXISTS Ta
Ignore partition exists flag and assume all partitions are real
.It Li AHDI_IGN_EXT Ta
Ignore final extended partition pointer
.It Li AHDI_IGN_CKSUM Ta
Ignore mismatch between on-disk and calculated checksums
.It Li AHDI_IGN_SPU Ta
Ignore total sectors from root sector if different from that reported by the disk
.El
.Pp
The
.Nm
function will try to open
.Em diskname ,
.Li then r Ns Em diskname Ns c,
.Li then /dev/r Ns Em diskname Ns c .
.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
OK
.It Li -1 Ta
System call error (see value of errno)
.It Li -2 Ta
Device is not 512 bytes/sector
.It Li -3 Ta
No AHDI partitions found (or disk has valid NetBSD partitions)
.It Li -4 Ta
AHDI checksum error (on disk different from calculated)
.It Li -5 Ta
Bogus final extended partition (does not point to auxiliary root)
.It Li -6 Ta
AHDI total sectors does not match device total sectors
.El
.Sh SEE ALSO
.Xr errno 2 ,
.Xr ahdi_buildlabel 3 ,
.Xr ahdi_checklabel 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
.Sh BUGS
The
.Nm
function does not recognise the (deprecated) partition ID's
.Em NBR ,
.Em NBU
or
.Em NBS .