|
|
1.1 ! root 1: /* ! 2: * Mach Operating System ! 3: * Copyright (c) 1991,1990,1989 Carnegie Mellon University ! 4: * All Rights Reserved. ! 5: * ! 6: * Permission to use, copy, modify and distribute this software and its ! 7: * documentation is hereby granted, provided that both the copyright ! 8: * notice and this permission notice appear in all copies of the ! 9: * software, derivative works or modified versions, and any portions ! 10: * thereof, and that both notices appear in supporting documentation. ! 11: * ! 12: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" ! 13: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR ! 14: * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ! 15: * ! 16: * Carnegie Mellon requests users of this software to return to ! 17: * ! 18: * Software Distribution Coordinator or [email protected] ! 19: * School of Computer Science ! 20: * Carnegie Mellon University ! 21: * Pittsburgh PA 15213-3890 ! 22: * ! 23: * any improvements or extensions that they make and grant Carnegie Mellon ! 24: * the rights to redistribute these changes. ! 25: */ ! 26: /* ! 27: * File: rz_labels.h ! 28: * Author: Alessandro Forin, Carnegie Mellon University ! 29: * Date: 10/90 ! 30: * ! 31: * Definitions of various vendor's disk label formats. ! 32: */ ! 33: ! 34: /* modified by Kevin T. Van Maren for the unified partition code */ ! 35: ! 36: #ifndef _RZ_LABELS_H_ ! 37: #define _RZ_LABELS_H_ ! 38: ! 39: /* ! 40: * This function looks for, and converts to BSD format ! 41: * a vendor's label. It is only called if we did not ! 42: * find a standard BSD label on the disk pack. ! 43: */ ! 44: extern boolean_t rz_vendor_label(); ! 45: ! 46: /* ! 47: * Definition of the DEC disk label, ! 48: * which is located (you guessed it) ! 49: * at the end of the 4.3 superblock. ! 50: */ ! 51: ! 52: struct dec_partition_info { ! 53: unsigned int n_sectors; /* how big the partition is */ ! 54: unsigned int offset; /* sector no. of start of part. */ ! 55: }; ! 56: ! 57: typedef struct { ! 58: int magic; ! 59: # define DEC_LABEL_MAGIC 0x032957 ! 60: int in_use; ! 61: struct dec_partition_info partitions[8]; ! 62: } dec_label_t; ! 63: ! 64: /* ! 65: * Physical location on disk. ! 66: * This is independent of the filesystem we use, ! 67: * although of course we'll be in trouble if we ! 68: * screwup the 4.3 SBLOCK.. ! 69: */ ! 70: ! 71: #define DEC_LABEL_BYTE_OFFSET ((2*8192)-sizeof(dec_label_t)) ! 72: ! 73: ! 74: /* ! 75: * Definitions for the primary boot information ! 76: * This is common, cuz the prom knows it. ! 77: */ ! 78: ! 79: typedef struct { ! 80: int pad[2]; ! 81: unsigned int magic; ! 82: # define DEC_BOOT0_MAGIC 0x2757a ! 83: int mode; ! 84: unsigned int phys_base; ! 85: unsigned int virt_base; ! 86: unsigned int n_sectors; ! 87: unsigned int start_sector; ! 88: } dec_boot0_t; ! 89: ! 90: typedef struct { ! 91: dec_boot0_t vax_boot; ! 92: /* BSD label still fits in pad */ ! 93: char pad[0x1e0-sizeof(dec_boot0_t)]; ! 94: unsigned long block_count; ! 95: unsigned long starting_lbn; ! 96: unsigned long flags; ! 97: unsigned long checksum; /* add cmpl-2 all but here */ ! 98: } alpha_boot0_t; ! 99: ! 100: /* ! 101: * Definition of the Omron disk label, ! 102: * which is located at sector 0. It ! 103: * _is_ sector 0, actually. ! 104: */ ! 105: struct omron_partition_info { ! 106: unsigned long offset; ! 107: unsigned long n_sectors; ! 108: }; ! 109: ! 110: typedef struct { ! 111: char packname[128]; /* in ascii */ ! 112: ! 113: char pad[512-(128+8*8+11*2+4)]; ! 114: ! 115: unsigned short badchk; /* checksum of bad track */ ! 116: unsigned long maxblk; /* # of total logical blocks */ ! 117: unsigned short dtype; /* disk drive type */ ! 118: unsigned short ndisk; /* # of disk drives */ ! 119: unsigned short ncyl; /* # of data cylinders */ ! 120: unsigned short acyl; /* # of alternate cylinders */ ! 121: unsigned short nhead; /* # of heads in this partition */ ! 122: unsigned short nsect; /* # of 512 byte sectors per track */ ! 123: unsigned short bhead; /* identifies proper label locations */ ! 124: unsigned short ppart; /* physical partition # */ ! 125: struct omron_partition_info ! 126: partitions[8]; ! 127: ! 128: unsigned short magic; /* identifies this label format */ ! 129: # define OMRON_LABEL_MAGIC 0xdabe ! 130: ! 131: unsigned short cksum; /* xor checksum of sector */ ! 132: ! 133: } omron_label_t; ! 134: ! 135: /* ! 136: * Physical location on disk. ! 137: */ ! 138: ! 139: #define OMRON_LABEL_BYTE_OFFSET 0 ! 140: ! 141: ! 142: /* ! 143: * Definition of the i386AT disk label, which lives inside sector 0. ! 144: * This is the info the BIOS knows about, which we use for bootstrapping. ! 145: * It is common across all disks known to BIOS. ! 146: */ ! 147: ! 148: struct bios_partition_info { ! 149: ! 150: unsigned char bootid; /* bootable or not */ ! 151: # define BIOS_BOOTABLE 128 ! 152: ! 153: unsigned char beghead;/* beginning head, sector, cylinder */ ! 154: unsigned char begsect;/* begcyl is a 10-bit number. High 2 bits */ ! 155: unsigned char begcyl; /* are in begsect. */ ! 156: ! 157: unsigned char systid; /* filesystem type */ ! 158: # define UNIXOS 99 /* GNU HURD? */ ! 159: # define BSDOS 165 /* 386BSD */ ! 160: # define LINUXSWAP 130 ! 161: # define LINUXOS 131 ! 162: # define DOS_EXTENDED 05 /* container for logical partitions */ ! 163: ! 164: # define HPFS 07 /* OS/2 Native */ ! 165: # define OS_2_BOOT 10 /* OS/2 Boot Manager */ ! 166: # define DOS_12 01 /* 12 bit FAT */ ! 167: # define DOS_16_OLD 04 /* < 32MB */ ! 168: # define DOS_16 06 /* >= 32MB (#4 not used anymore) */ ! 169: ! 170: /* these numbers can't be trusted because */ ! 171: /* of newer, larger drives */ ! 172: unsigned char endhead;/* ending head, sector, cylinder */ ! 173: unsigned char endsect;/* endcyl is a 10-bit number. High 2 bits */ ! 174: unsigned char endcyl; /* are in endsect. */ ! 175: ! 176: unsigned long offset; ! 177: unsigned long n_sectors; ! 178: }; ! 179: ! 180: typedef struct { ! 181: /* struct bios_partition_info bogus compiler alignes wrong ! 182: partitions[4]; ! 183: */ ! 184: char partitions[4*sizeof(struct bios_partition_info)]; ! 185: unsigned short magic; ! 186: # define BIOS_LABEL_MAGIC 0xaa55 ! 187: } bios_label_t; ! 188: ! 189: /* ! 190: * Physical location on disk. ! 191: */ ! 192: ! 193: #define BIOS_LABEL_BYTE_OFFSET 446 ! 194: ! 195: /* ! 196: * Definitions for the primary boot information ! 197: * This _is_ block 0 ! 198: */ ! 199: ! 200: #define BIOS_BOOT0_SIZE BIOS_LABEL_BYTE_OFFSET ! 201: ! 202: typedef struct { ! 203: char boot0[BIOS_BOOT0_SIZE]; /* boot code */ ! 204: /* bios_label_t label; bogus compiler alignes wrong */ ! 205: char label[sizeof(bios_label_t)]; ! 206: } bios_boot0_t; ! 207: ! 208: /* Moved from i386at/nhdreg.h */ ! 209: #define PDLOCATION 29 /* VTOC sector */ ! 210: ! 211: ! 212: /* these are the partition types that can contain sub-partitions */ ! 213: /* enum types... */ ! 214: #define DISKPART_NONE 0 /* smallest piece flag !?! */ ! 215: #define DISKPART_DOS 1 ! 216: #define DISKPART_BSD 2 ! 217: #define DISKPART_VTOC 3 ! 218: #define DISKPART_OMRON 4 ! 219: #define DISKPART_DEC 5 /* VAX disks? */ ! 220: #define DISKPART_UNKNOWN 99 ! 221: ! 222: ! 223: ! 224: /* for NEW partition code */ ! 225: /* this is the basic partition structure. an array of these is ! 226: filled, with element 0 being the whole drive, element 1-n being ! 227: the n top-level partitions, followed by 0+ groups of 1+ sub-partitions. */ ! 228: typedef struct diskpart { ! 229: short type; /* DISKPART_xxx (see above) */ ! 230: short fsys; /* file system (if known) */ ! 231: int nsubs; /* number of sub-slices */ ! 232: struct diskpart *subs; /* pointer to the sub-partitions */ ! 233: int start; /* relative to the start of the DRIVE */ ! 234: int size; /* # sectors in this piece */ ! 235: } diskpart; ! 236: ! 237: int get_only_partition(void *driver_info, int (*bottom_read_fun)(), ! 238: struct diskpart *array, int array_size, ! 239: int disk_size, char *drive_name); ! 240: ! 241: struct diskpart *lookup_part(struct diskpart *array, int dev_number); ! 242: #endif _RZ_LABELS_H_ ! 243:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.