fdisk.h revision c26dc428cee0f025b14a5ad03a7722f2a52f8383
750N/A/*
750N/A * CDDL HEADER START
750N/A *
750N/A * The contents of this file are subject to the terms of the
750N/A * Common Development and Distribution License (the "License").
750N/A * You may not use this file except in compliance with the License.
750N/A *
750N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
750N/A * or http://www.opensolaris.org/os/licensing.
750N/A * See the License for the specific language governing permissions
750N/A * and limitations under the License.
750N/A *
750N/A * When distributing Covered Code, include this CDDL HEADER in each
750N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
750N/A * If applicable, add the following below this CDDL HEADER, with the
750N/A * fields enclosed by brackets "[]" replaced with your own identifying
750N/A * information: Portions Copyright [yyyy] [name of copyright owner]
750N/A *
750N/A * CDDL HEADER END
750N/A */
750N/A
750N/A/*
750N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
750N/A * Use is subject to license terms.
750N/A */
750N/A/* Copyright (c) 1984, 1986, 1987, 1988 AT&T */
750N/A/* All Rights Reserved */
750N/A
750N/A
750N/A#ifndef _SYS_DKTP_FDISK_H
750N/A#define _SYS_DKTP_FDISK_H
750N/A
750N/A#ifdef __cplusplus
750N/Aextern "C" {
750N/A#endif
750N/A
750N/A/*
750N/A * fdisk.h
750N/A * This file defines the structure of physical disk sector 0 for use on
750N/A * AT386 systems. The format of this sector is constrained by the ROM
750N/A * BIOS and MS-DOS conventions.
750N/A * Note that this block does not define the partitions used by the unix
750N/A * driver. The unix partitions are obtained from the VTOC.
750N/A */
750N/A
750N/A/*
750N/A * the MAX values are the maximum usable values for BIOS chs values
750N/A * The MAX_CYL value of 1022 is the maximum usable value
750N/A * the value of 1023 is a fence value,
750N/A * indicating no CHS geometry exists for the corresponding LBA value.
750N/A * HEAD range [ 0 .. MAX_HEAD ], so number of heads is (MAX_HEAD + 1)
750N/A * SECT range [ 1 .. MAX_SECT ], so number of sectors is (MAX_SECT)
750N/A */
750N/A#define MAX_SECT (63)
750N/A#define MAX_CYL (1022)
750N/A#define MAX_HEAD (254)
750N/A
750N/A/*
750N/A * BOOTSZ was reduced from 446 to 440 bytes to NOT overwrite the Windows
750N/A * Vista DISKID. Otherwise Vista won't boot from Solaris GRUB in a dual-boot
750N/A * setup.
750N/A * The actual size of mboot code is 425 bytes while that of GRUB stage1 is
750N/A * 423 bytes. So this changes does not harm them.
750N/A */
750N/A#define BOOTSZ 440 /* size of boot code in master boot block */
750N/A#define FD_NUMPART 4 /* number of 'partitions' in fdisk table */
750N/A#define MBB_MAGIC 0xAA55 /* magic number for mboot.signature */
750N/A#define DEFAULT_INTLV 4 /* default interleave for testing tracks */
750N/A#define MINPSIZE 4 /* minimum number of cylinders in a partition */
750N/A#define TSTPAT 0xE5 /* test pattern for verifying disk */
750N/A
750N/A/*
750N/A * structure to hold the fdisk partition table
750N/A */
750N/Astruct ipart {
750N/A unsigned char bootid; /* bootable or not */
750N/A unsigned char beghead; /* beginning head, sector, cylinder */
750N/A unsigned char begsect; /* begcyl is a 10-bit number. High 2 bits */
750N/A unsigned char begcyl; /* are in begsect. */
750N/A unsigned char systid; /* OS type */
750N/A unsigned char endhead; /* ending head, sector, cylinder */
750N/A unsigned char endsect; /* endcyl is a 10-bit number. High 2 bits */
750N/A unsigned char endcyl; /* are in endsect. */
750N/A uint32_t relsect; /* first sector relative to start of disk */
750N/A uint32_t numsect; /* number of sectors in partition */
750N/A};
750N/A/*
750N/A * Values for bootid.
750N/A */
750N/A#define NOTACTIVE 0
750N/A#define ACTIVE 128
750N/A/*
750N/A * Values for systid.
750N/A */
750N/A#define UNUSED 0 /* Empty Partition */
750N/A#define DOSOS12 1 /* DOS partition, 12-bit FAT */
750N/A#define PCIXOS 2 /* PC/IX partition */
750N/A#define DOSOS16 4 /* DOS partition, 16-bit FAT */
750N/A#define EXTDOS 5 /* EXT-DOS partition */
750N/A#define DOSHUGE 6 /* Huge DOS partition > 32MB */
750N/A#define FDISK_IFS 7 /* Installable File System (IFS): HPFS & NTFS */
750N/A#define FDISK_AIXBOOT 8 /* AIX Boot */
750N/A#define FDISK_AIXDATA 9 /* AIX Data */
750N/A#define FDISK_OS2BOOT 10 /* OS/2 Boot Manager */
750N/A#define FDISK_WINDOWS 11 /* Windows 95 FAT32 (up to 2047GB) */
750N/A#define FDISK_EXT_WIN 12 /* Windows 95 FAT32 (extended-INT13) */
750N/A#define FDISK_FAT95 14 /* DOS 16-bit FAT, LBA-mapped */
750N/A#define FDISK_EXTLBA 15 /* Extended partition, LBA-mapped */
750N/A#define DIAGPART 18 /* Diagnostic boot partition (OS independent) */
750N/A#define FDISK_LINUX 65 /* Linux */
750N/A#define FDISK_LINUXDSWAP 66 /* Linux swap (sharing disk w/ DRDOS) */
750N/A#define FDISK_LINUXDNAT 67 /* Linux native (sharing disk with DRDOS) */
750N/A#define FDISK_CPM 82 /* CP/M */
750N/A#define DOSDATA 86 /* DOS data partition */
750N/A#define OTHEROS 98 /* part. type for appl. (DB?) needs */
750N/A /* raw partition. ID was 0 but conflicted */
750N/A /* with DOS 3.3 fdisk */
750N/A#define UNIXOS 99 /* UNIX V.x partition */
750N/A#define FDISK_NOVELL2 100 /* Novell Netware 286 */
750N/A#define FDISK_NOVELL3 101 /* Novell Netware 3.x and later */
750N/A#define FDISK_QNX4 119 /* QNX 4.x */
750N/A#define FDISK_QNX42 120 /* QNX 4.x 2nd part */
750N/A#define FDISK_QNX43 121 /* QNX 4.x 3rd part */
750N/A#define SUNIXOS 130 /* Solaris UNIX partition */
750N/A#define FDISK_LINUXNAT 131 /* Linux native */
750N/A#define FDISK_NTFSVOL1 134 /* NTFS volume set 1 */
750N/A#define FDISK_NTFSVOL2 135 /* NTFS volume set 2 */
750N/A#define FDISK_BSD 165 /* BSD/386, 386BSD, NetBSD, FreeBSD, OpenBSD */
750N/A#define FDISK_NEXTSTEP 167 /* NeXTSTEP */
750N/A#define FDISK_BSDIFS 183 /* BSDI file system */
750N/A#define FDISK_BSDISWAP 184 /* BSDI swap */
750N/A#define X86BOOT 190 /* x86 Solaris boot partition */
750N/A#define SUNIXOS2 191 /* Solaris UNIX partition */
750N/A#define EFI_PMBR 238 /* EFI PMBR */
750N/A#define EFI_FS 239 /* EFI File System (System Partition) */
750N/A#define MAXDOS 65535L /* max size (sectors) for DOS partition */
750N/A
750N/A/*
750N/A * structure to hold master boot block in physical sector 0 of the disk.
750N/A * Note that partitions stuff can't be directly included in the structure
750N/A * because of lameo '386 compiler alignment design.
750N/A * Alignment issues also force us to have 2 16bit entities for a single
750N/A * 32bit win_volserno. It is not used anywhere anyway.
750N/A */
750N/A
750N/Astruct mboot { /* master boot block */
750N/A char bootinst[BOOTSZ];
750N/A uint16_t win_volserno_lo;
750N/A uint16_t win_volserno_hi;
750N/A uint16_t reserved;
750N/A char parts[FD_NUMPART * sizeof (struct ipart)];
750N/A ushort_t signature;
750N/A};
750N/A
750N/A#if defined(__i386) || defined(__amd64)
750N/A
750N/A/* Byte offset of the start of the partition table within the sector */
750N/A#define FDISK_PART_TABLE_START 446
750N/A
750N/A/* Maximum number of valid partitions assumed as 32 */
750N/A#define MAX_EXT_PARTS 32
750N/A
750N/A#else
750N/A
750N/A#define MAX_EXT_PARTS 0
750N/A
750N/A#endif /* if defined(__i386) || defined(__amd64) */
750N/A
750N/A#ifdef __cplusplus
750N/A}
750N/A#endif
750N/A
750N/A#endif /* _SYS_DKTP_FDISK_H */
750N/A