1*142201d4Sandvar /* $NetBSD: disklabel.h,v 1.2 2022/05/24 19:37:39 andvar Exp $ */ 26cf6fe02Smatt 36cf6fe02Smatt /*- 46cf6fe02Smatt * Copyright (c) 2014 The NetBSD Foundation, Inc. 56cf6fe02Smatt * All rights reserved. 66cf6fe02Smatt * 76cf6fe02Smatt * This code is derived from software contributed to The NetBSD Foundation 86cf6fe02Smatt * by Matt Thomas of 3am Software Foundry. 96cf6fe02Smatt * 106cf6fe02Smatt * Redistribution and use in source and binary forms, with or without 116cf6fe02Smatt * modification, are permitted provided that the following conditions 126cf6fe02Smatt * are met: 136cf6fe02Smatt * 1. Redistributions of source code must retain the above copyright 146cf6fe02Smatt * notice, this list of conditions and the following disclaimer. 156cf6fe02Smatt * 2. Redistributions in binary form must reproduce the above copyright 166cf6fe02Smatt * notice, this list of conditions and the following disclaimer in the 176cf6fe02Smatt * documentation and/or other materials provided with the distribution. 186cf6fe02Smatt * 196cf6fe02Smatt * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 206cf6fe02Smatt * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 216cf6fe02Smatt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 226cf6fe02Smatt * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 236cf6fe02Smatt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 246cf6fe02Smatt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 256cf6fe02Smatt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 266cf6fe02Smatt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 276cf6fe02Smatt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 286cf6fe02Smatt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 296cf6fe02Smatt * POSSIBILITY OF SUCH DAMAGE. 306cf6fe02Smatt */ 316cf6fe02Smatt 326cf6fe02Smatt #ifndef _RISCV_DISKLABEL_H_ 336cf6fe02Smatt #define _RISCV_DISKLABEL_H_ 346cf6fe02Smatt 356cf6fe02Smatt #define LABELUSESMBR 1 /* use MBR partitionning */ 366cf6fe02Smatt #define LABELSECTOR 1 /* sector containing label */ 376cf6fe02Smatt #define LABELOFFSET 0 /* offset of label in sector */ 386cf6fe02Smatt #define MAXPARTITIONS 16 /* number of partitions */ 396cf6fe02Smatt #define RAW_PART 2 /* raw partition: XX?c */ 406cf6fe02Smatt 416cf6fe02Smatt #if HAVE_NBTOOL_CONFIG_H 426cf6fe02Smatt #include <nbinclude/sys/dkbad.h> 436cf6fe02Smatt #include <nbinclude/sys/bootblock.h> 446cf6fe02Smatt #else 456cf6fe02Smatt #include <sys/dkbad.h> 466cf6fe02Smatt #include <sys/bootblock.h> 476cf6fe02Smatt #endif /* HAVE_NBTOOL_CONFIG_H */ 486cf6fe02Smatt 496cf6fe02Smatt struct cpu_disklabel { 506cf6fe02Smatt struct mbr_partition mbrparts[MBR_PART_COUNT]; 516cf6fe02Smatt #define __HAVE_DISKLABEL_DKBAD 526cf6fe02Smatt struct dkbad bad; 536cf6fe02Smatt }; 546cf6fe02Smatt 556cf6fe02Smatt #ifdef _KERNEL 566cf6fe02Smatt struct buf; 576cf6fe02Smatt struct disklabel; 586cf6fe02Smatt 596cf6fe02Smatt /* for readdisklabel. rv != 0 -> matches, msg == NULL -> success */ 606cf6fe02Smatt int mbr_label_read(dev_t, void (*)(struct buf *), struct disklabel *, 616cf6fe02Smatt struct cpu_disklabel *, const char **, int *, int *); 626cf6fe02Smatt 63*142201d4Sandvar /* for writedisklabel. rv == 0 -> doesn't match, rv > 0 -> success */ 646cf6fe02Smatt int mbr_label_locate(dev_t, void (*)(struct buf *), 656cf6fe02Smatt struct disklabel *, struct cpu_disklabel *, int *, int *); 666cf6fe02Smatt #endif /* _KERNEL */ 676cf6fe02Smatt 686cf6fe02Smatt #endif /* _RISCV_DISKLABEL_H_ */ 69