199767f8919635c4928607450d9e0abb932109ceToomas Soome/*-
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright (c) 1987, 1988, 1993
199767f8919635c4928607450d9e0abb932109ceToomas Soome * The Regents of the University of California. All rights reserved.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Redistribution and use in source and binary forms, with or without
199767f8919635c4928607450d9e0abb932109ceToomas Soome * modification, are permitted provided that the following conditions
199767f8919635c4928607450d9e0abb932109ceToomas Soome * are met:
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 1. Redistributions of source code must retain the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 2. Redistributions in binary form must reproduce the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer in the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * documentation and/or other materials provided with the distribution.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 4. Neither the name of the University nor the names of its contributors
199767f8919635c4928607450d9e0abb932109ceToomas Soome * may be used to endorse or promote products derived from this software
199767f8919635c4928607450d9e0abb932109ceToomas Soome * without specific prior written permission.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
199767f8919635c4928607450d9e0abb932109ceToomas Soome * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
199767f8919635c4928607450d9e0abb932109ceToomas Soome * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
199767f8919635c4928607450d9e0abb932109ceToomas Soome * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
199767f8919635c4928607450d9e0abb932109ceToomas Soome * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
199767f8919635c4928607450d9e0abb932109ceToomas Soome * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
199767f8919635c4928607450d9e0abb932109ceToomas Soome * SUCH DAMAGE.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * @(#)disklabel.h 8.2 (Berkeley) 7/10/94
199767f8919635c4928607450d9e0abb932109ceToomas Soome * $FreeBSD$
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _SYS_DISKLABEL_H_
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _SYS_DISKLABEL_H_
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _KERNEL
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include <sys/types.h>
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include <sys/ioccom.h>
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Disk description table, see disktab(5)
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _PATH_DISKTAB "/etc/disktab"
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Each disk has a label which includes information about the hardware
199767f8919635c4928607450d9e0abb932109ceToomas Soome * disk geometry, filesystem partitions, and drive specific information.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * The label is in block 0 or 1, possibly offset from the beginning
199767f8919635c4928607450d9e0abb932109ceToomas Soome * to leave room for a bootstrap, etc.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* XXX these should be defined per controller (or drive) elsewhere, not here! */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if defined(__i386__) || defined(__amd64__) || defined(__arm__) || \
199767f8919635c4928607450d9e0abb932109ceToomas Soome defined(__powerpc__) || defined(__mips__)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define LABELSECTOR 1 /* sector containing label */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define LABELOFFSET 0 /* offset of label in sector */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define DISKMAGIC ((u_int32_t)0x82564557) /* The disk magic number */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef MAXPARTITIONS
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define MAXPARTITIONS 8
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* Size of bootblock area in sector-size neutral bytes */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define BBSIZE 8192
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define LABEL_PART 2 /* partition containing label */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define RAW_PART 2 /* partition containing whole disk */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SWAP_PART 1 /* partition normally containing swap */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct disklabel {
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int32_t d_magic; /* the magic number */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int16_t d_type; /* drive type */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int16_t d_subtype; /* controller/d_type specific */
199767f8919635c4928607450d9e0abb932109ceToomas Soome char d_typename[16]; /* type name, e.g. "eagle" */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome char d_packname[16]; /* pack identifier */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* disk geometry: */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int32_t d_secsize; /* # of bytes per sector */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int32_t d_nsectors; /* # of data sectors per track */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int32_t d_ntracks; /* # of tracks per cylinder */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int32_t d_ncylinders; /* # of data cylinders per unit */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int32_t d_secpercyl; /* # of data sectors per cylinder */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int32_t d_secperunit; /* # of data sectors per unit */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome /*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Spares (bad sector replacements) below are not counted in
199767f8919635c4928607450d9e0abb932109ceToomas Soome * d_nsectors or d_secpercyl. Spare sectors are assumed to
199767f8919635c4928607450d9e0abb932109ceToomas Soome * be physical sectors which occupy space at the end of each
199767f8919635c4928607450d9e0abb932109ceToomas Soome * track and/or cylinder.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int16_t d_sparespertrack; /* # of spare sectors per track */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int16_t d_sparespercyl; /* # of spare sectors per cylinder */
199767f8919635c4928607450d9e0abb932109ceToomas Soome /*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Alternate cylinders include maintenance, replacement, configuration
199767f8919635c4928607450d9e0abb932109ceToomas Soome * description areas, etc.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int32_t d_acylinders; /* # of alt. cylinders per unit */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* hardware characteristics: */
199767f8919635c4928607450d9e0abb932109ceToomas Soome /*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * d_interleave, d_trackskew and d_cylskew describe perturbations
199767f8919635c4928607450d9e0abb932109ceToomas Soome * in the media format used to compensate for a slow controller.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Interleave is physical sector interleave, set up by the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * formatter or controller when formatting. When interleaving is
199767f8919635c4928607450d9e0abb932109ceToomas Soome * in use, logically adjacent sectors are not physically
199767f8919635c4928607450d9e0abb932109ceToomas Soome * contiguous, but instead are separated by some number of
199767f8919635c4928607450d9e0abb932109ceToomas Soome * sectors. It is specified as the ratio of physical sectors
199767f8919635c4928607450d9e0abb932109ceToomas Soome * traversed per logical sector. Thus an interleave of 1:1
199767f8919635c4928607450d9e0abb932109ceToomas Soome * implies contiguous layout, while 2:1 implies that logical
199767f8919635c4928607450d9e0abb932109ceToomas Soome * sector 0 is separated by one sector from logical sector 1.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * d_trackskew is the offset of sector 0 on track N relative to
199767f8919635c4928607450d9e0abb932109ceToomas Soome * sector 0 on track N-1 on the same cylinder. Finally, d_cylskew
199767f8919635c4928607450d9e0abb932109ceToomas Soome * is the offset of sector 0 on cylinder N relative to sector 0
199767f8919635c4928607450d9e0abb932109ceToomas Soome * on cylinder N-1.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int16_t d_rpm; /* rotational speed */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int16_t d_interleave; /* hardware sector interleave */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int16_t d_trackskew; /* sector 0 skew, per track */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int16_t d_cylskew; /* sector 0 skew, per cylinder */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int32_t d_headswitch; /* head switch time, usec */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int32_t d_trkseek; /* track-to-track seek, usec */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int32_t d_flags; /* generic flags */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define NDDATA 5
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int32_t d_drivedata[NDDATA]; /* drive-type specific information */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define NSPARE 5
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int32_t d_spare[NSPARE]; /* reserved for future use */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int32_t d_magic2; /* the magic number (again) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int16_t d_checksum; /* xor of data incl. partitions */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* filesystem and partition information: */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int16_t d_npartitions; /* number of partitions in following */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int32_t d_bbsize; /* size of boot area at sn0, bytes */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int32_t d_sbsize; /* max size of fs superblock, bytes */
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct partition { /* the partition table */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int32_t p_size; /* number of sectors in partition */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int32_t p_offset; /* starting sector */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int32_t p_fsize; /* filesystem basic fragment size */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int8_t p_fstype; /* filesystem type, see below */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int8_t p_frag; /* filesystem fragments per block */
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int16_t p_cpg; /* filesystem cylinders per group */
199767f8919635c4928607450d9e0abb932109ceToomas Soome } d_partitions[MAXPARTITIONS]; /* actually may be more */
199767f8919635c4928607450d9e0abb932109ceToomas Soome};
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifdef CTASSERT
199767f8919635c4928607450d9e0abb932109ceToomas SoomeCTASSERT(sizeof(struct disklabel) == 148 + MAXPARTITIONS * 16);
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic __inline u_int16_t dkcksum(struct disklabel *lp);
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic __inline u_int16_t
199767f8919635c4928607450d9e0abb932109ceToomas Soomedkcksum(struct disklabel *lp)
199767f8919635c4928607450d9e0abb932109ceToomas Soome{
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int16_t *start, *end;
199767f8919635c4928607450d9e0abb932109ceToomas Soome u_int16_t sum = 0;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome start = (u_int16_t *)lp;
199767f8919635c4928607450d9e0abb932109ceToomas Soome end = (u_int16_t *)&lp->d_partitions[lp->d_npartitions];
199767f8919635c4928607450d9e0abb932109ceToomas Soome while (start < end)
199767f8919635c4928607450d9e0abb932109ceToomas Soome sum ^= *start++;
199767f8919635c4928607450d9e0abb932109ceToomas Soome return (sum);
199767f8919635c4928607450d9e0abb932109ceToomas Soome}
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* d_type values: */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define DTYPE_SMD 1 /* SMD, XSMD; VAX hp/up */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define DTYPE_MSCP 2 /* MSCP */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define DTYPE_DEC 3 /* other DEC (rk, rl) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define DTYPE_SCSI 4 /* SCSI */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define DTYPE_ESDI 5 /* ESDI interface */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define DTYPE_ST506 6 /* ST506 etc. */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define DTYPE_HPIB 7 /* CS/80 on HP-IB */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define DTYPE_HPFL 8 /* HP Fiber-link */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define DTYPE_FLOPPY 10 /* floppy */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define DTYPE_CCD 11 /* concatenated disk */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define DTYPE_VINUM 12 /* vinum volume */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define DTYPE_DOC2K 13 /* Msys DiskOnChip */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define DTYPE_RAID 14 /* CMU RAIDFrame */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define DTYPE_JFS2 16 /* IBM JFS 2 */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifdef DKTYPENAMES
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic const char *dktypenames[] = {
199767f8919635c4928607450d9e0abb932109ceToomas Soome "unknown",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "SMD",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "MSCP",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "old DEC",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "SCSI",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "ESDI",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "ST506",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "HP-IB",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "HP-FL",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "type 9",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "floppy",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "CCD",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "Vinum",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "DOC2K",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "Raid",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "?",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "jfs",
199767f8919635c4928607450d9e0abb932109ceToomas Soome NULL
199767f8919635c4928607450d9e0abb932109ceToomas Soome};
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define DKMAXTYPES (sizeof(dktypenames) / sizeof(dktypenames[0]) - 1)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Filesystem type and version.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Used to interpret other filesystem-specific
199767f8919635c4928607450d9e0abb932109ceToomas Soome * per-partition information.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_UNUSED 0 /* unused */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_SWAP 1 /* swap */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_V6 2 /* Sixth Edition */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_V7 3 /* Seventh Edition */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_SYSV 4 /* System V */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_V71K 5 /* V7 with 1K blocks (4.1, 2.9) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_V8 6 /* Eighth Edition, 4K blocks */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_BSDFFS 7 /* 4.2BSD fast filesystem */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_MSDOS 8 /* MSDOS filesystem */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_BSDLFS 9 /* 4.4BSD log-structured filesystem */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_OTHER 10 /* in use, but unknown/unsupported */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_HPFS 11 /* OS/2 high-performance filesystem */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_ISO9660 12 /* ISO 9660, normally CD-ROM */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_BOOT 13 /* partition contains bootstrap */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_VINUM 14 /* Vinum drive */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_RAID 15 /* RAIDFrame drive */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_FILECORE 16 /* Acorn Filecore Filing System */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_EXT2FS 17 /* ext2fs */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_NTFS 18 /* Windows/NT file system */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_CCD 20 /* concatenated disk component */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_JFS2 21 /* IBM JFS2 */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_HAMMER 22 /* DragonFlyBSD Hammer FS */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_HAMMER2 23 /* DragonFlyBSD Hammer2 FS */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_UDF 24 /* UDF */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_EFS 26 /* SGI's Extent File system */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_ZFS 27 /* Sun's ZFS */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FS_NANDFS 30 /* FreeBSD nandfs (NiLFS derived) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifdef FSTYPENAMES
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic const char *fstypenames[] = {
199767f8919635c4928607450d9e0abb932109ceToomas Soome "unused",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "swap",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "Version 6",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "Version 7",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "System V",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "4.1BSD",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "Eighth Edition",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "4.2BSD",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "MSDOS",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "4.4LFS",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "unknown",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "HPFS",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "ISO9660",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "boot",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "vinum",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "raid",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "Filecore",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "EXT2FS",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "NTFS",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "?",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "ccd",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "jfs",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "HAMMER",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "HAMMER2",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "UDF",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "?",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "EFS",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "ZFS",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "?",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "?",
199767f8919635c4928607450d9e0abb932109ceToomas Soome "nandfs",
199767f8919635c4928607450d9e0abb932109ceToomas Soome NULL
199767f8919635c4928607450d9e0abb932109ceToomas Soome};
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define FSMAXTYPES (sizeof(fstypenames) / sizeof(fstypenames[0]) - 1)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * flags shared by various drives:
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define D_REMOVABLE 0x01 /* removable media */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define D_ECC 0x02 /* supports ECC */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define D_BADSECT 0x04 /* supports bad sector forw. */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define D_RAMDISK 0x08 /* disk emulator */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define D_CHAIN 0x10 /* can do back-back transfers */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * NB: <sys/disk.h> defines ioctls from 'd'/128 and up.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Functions for proper encoding/decoding of struct disklabel into/from
199767f8919635c4928607450d9e0abb932109ceToomas Soome * bytestring.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soomevoid bsd_partition_le_dec(u_char *ptr, struct partition *d);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint bsd_disklabel_le_dec(u_char *ptr, struct disklabel *d, int maxpart);
199767f8919635c4928607450d9e0abb932109ceToomas Soomevoid bsd_partition_le_enc(u_char *ptr, struct partition *d);
199767f8919635c4928607450d9e0abb932109ceToomas Soomevoid bsd_disklabel_le_enc(u_char *ptr, struct disklabel *d);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _KERNEL
199767f8919635c4928607450d9e0abb932109ceToomas Soome__BEGIN_DECLS
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct disklabel *getdiskbyname(const char *);
199767f8919635c4928607450d9e0abb932109ceToomas Soome__END_DECLS
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* !_SYS_DISKLABEL_H_ */