xref: /netbsd-src/sys/arch/or1k/include/disklabel.h (revision 142201d4f561fa19554c2387d447a5f955e6d1a3)
1*142201d4Sandvar /* $NetBSD: disklabel.h,v 1.2 2022/05/24 19:37:39 andvar Exp $ */
227620987Smatt 
327620987Smatt /*-
427620987Smatt  * Copyright (c) 2014 The NetBSD Foundation, Inc.
527620987Smatt  * All rights reserved.
627620987Smatt  *
727620987Smatt  * This code is derived from software contributed to The NetBSD Foundation
827620987Smatt  * by Matt Thomas of 3am Software Foundry.
927620987Smatt  *
1027620987Smatt  * Redistribution and use in source and binary forms, with or without
1127620987Smatt  * modification, are permitted provided that the following conditions
1227620987Smatt  * are met:
1327620987Smatt  * 1. Redistributions of source code must retain the above copyright
1427620987Smatt  *    notice, this list of conditions and the following disclaimer.
1527620987Smatt  * 2. Redistributions in binary form must reproduce the above copyright
1627620987Smatt  *    notice, this list of conditions and the following disclaimer in the
1727620987Smatt  *    documentation and/or other materials provided with the distribution.
1827620987Smatt  *
1927620987Smatt  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
2027620987Smatt  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2127620987Smatt  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2227620987Smatt  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2327620987Smatt  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2427620987Smatt  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2527620987Smatt  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2627620987Smatt  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2727620987Smatt  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2827620987Smatt  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2927620987Smatt  * POSSIBILITY OF SUCH DAMAGE.
3027620987Smatt  */
3127620987Smatt 
3227620987Smatt #ifndef _OR1K_DISKLABEL_H_
3327620987Smatt #define _OR1K_DISKLABEL_H_
3427620987Smatt 
3527620987Smatt #define LABELUSESMBR		1	/* use MBR partitionning */
3627620987Smatt #define LABELSECTOR		1	/* sector containing label */
3727620987Smatt #define LABELOFFSET		0	/* offset of label in sector */
3827620987Smatt #define MAXPARTITIONS		16	/* number of partitions */
3927620987Smatt #define RAW_PART		2	/* raw partition: XX?c */
4027620987Smatt 
4127620987Smatt #if HAVE_NBTOOL_CONFIG_H
4227620987Smatt #include <nbinclude/sys/dkbad.h>
4327620987Smatt #include <nbinclude/sys/bootblock.h>
4427620987Smatt #else
4527620987Smatt #include <sys/dkbad.h>
4627620987Smatt #include <sys/bootblock.h>
4727620987Smatt #endif /* HAVE_NBTOOL_CONFIG_H */
4827620987Smatt 
4927620987Smatt struct cpu_disklabel {
5027620987Smatt 	struct mbr_partition mbrparts[MBR_PART_COUNT];
5127620987Smatt #define __HAVE_DISKLABEL_DKBAD
5227620987Smatt 	struct dkbad bad;
5327620987Smatt };
5427620987Smatt 
5527620987Smatt #ifdef _KERNEL
5627620987Smatt struct buf;
5727620987Smatt struct disklabel;
5827620987Smatt 
5927620987Smatt /* for readdisklabel.  rv != 0 -> matches, msg == NULL -> success */
6027620987Smatt int	mbr_label_read(dev_t, void (*)(struct buf *), struct disklabel *,
6127620987Smatt 	    struct cpu_disklabel *, const char **, int *, int *);
6227620987Smatt 
63*142201d4Sandvar /* for writedisklabel.  rv == 0 -> doesn't match, rv > 0 -> success */
6427620987Smatt int	mbr_label_locate(dev_t, void (*)(struct buf *),
6527620987Smatt 	    struct disklabel *, struct cpu_disklabel *, int *, int *);
6627620987Smatt #endif /* _KERNEL */
6727620987Smatt 
6827620987Smatt #endif /* _OR1K_DISKLABEL_H_ */
69