NetBSD/lib/libahdi/ahdi_writelabel.3

121 lines
3.7 KiB
Groff

.\" $NetBSD: ahdi_writelabel.3,v 1.1 2000/02/05 20:40:42 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_writelabel 3
.Sh NAME
.Nm ahdi_writelabel
.Nd write AHDI partition label to disk
.Sh LIBRARY
.Lb libahdi
.Sh SYNOPSIS
.Fd #include <libahdi.h>
.Ft int
.Fn ahdi_writelabel "struct ahdi_ptable *ptable" "char *diskname" "int flags"
.Sh DESCRIPTION
The
.Nm
function writes an AHDI format disk from an AHDI label. The root sector
that is written contains no boot code and the bad sector list contains no
entries. Any existing NetBSD disklabel for this disk will be invalidated.
.Nm
calls
.Xr ahdi_checklabel
and will not write the information if
.Xr ahdi_checklabel
returns an error.
.Pp
The function takes the following flags:
.Bl -column "AHDI_IGN_EXISTS" "Result" -offset indent
.It Em Flag Ta Em Result
.It Li AHDI_KEEP_BOOT Ta
Keep the existing boot code in the root sector
.It Li AHDI_KEEP_BSL Ta
Keep the existing bad sector list
.It Li AHDI_KEEP_NBDA Ta
Keep the existing NetBSD disk label
.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 <-1 Ta
.Xr ahdi_checklabel
returned an error
.El
.Sh SEE ALSO
.Xr errno
.Xr ahdi_buildlabel 3 ,
.Xr ahdi_checklabel 3 ,
.Xr ahdi_readlabel 3 ,
.Xr ahdi_writedisktab 3 ,
.Xr ahdi 4 ,
.Xr installboot 8
.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 .
.Pp
If no partition of type
.Em NBD
or
.Em RAW
exist, no NetBSD disklabel can be written to the disk.