1,4 → 1,9 |
/*- |
* Copyright 2005, Anatoli Klassen <anatoli@aksoft.net> |
* All rights reserved. |
* |
* The code is based on code of geom_bsd module by Poul-Henning Kamp. |
* |
* Copyright (c) 1987, 1988, 1993 |
* The Regents of the University of California. All rights reserved. |
* |
27,23 → 32,12 |
* SUCH DAMAGE. |
* |
* @(#)disklabel.h 8.2 (Berkeley) 7/10/94 |
* $FreeBSD: src/sys/sys/disklabel.h,v 1.107 2005/04/07 22:09:02 cognet Exp $ |
*/ |
|
#ifndef _SYS_DISKLABEL_H_ |
#define _SYS_DISKLABEL_H_ |
#ifndef _NBSD_DISKLABEL_H_ |
#define _NBSD_DISKLABEL_H_ |
|
#ifndef _KERNEL |
#include <sys/types.h> |
#endif |
#include <sys/ioccom.h> |
|
/* |
* Disk description table, see disktab(5) |
*/ |
#define _PATH_DISKTAB "/etc/disktab" |
|
/* |
* Each disk has a label which includes information about the hardware |
* disk geometry, filesystem partitions, and drive specific information. |
* The label is in block 0 or 1, possibly offset from the beginning |
73,10 → 67,6 |
/* Size of bootblock area in sector-size neutral bytes */ |
#define BBSIZE 8192 |
|
#define LABEL_PART 2 /* partition containing label */ |
#define RAW_PART 2 /* partition containing whole disk */ |
#define SWAP_PART 1 /* partition normally containing swap */ |
|
struct disklabel { |
u_int32_t d_magic; /* the magic number */ |
u_int16_t d_type; /* drive type */ |
156,145 → 146,11 |
CTASSERT(sizeof(struct disklabel) == 148 + NBSD_MAXPARTITIONS * 16); |
#endif |
|
static __inline u_int16_t dkcksum(struct disklabel *lp); |
static __inline u_int16_t |
dkcksum(struct disklabel *lp) |
{ |
u_int16_t *start, *end; |
u_int16_t sum = 0; |
|
start = (u_int16_t *)lp; |
end = (u_int16_t *)&lp->d_partitions[lp->d_npartitions]; |
while (start < end) |
sum ^= *start++; |
return (sum); |
} |
|
|
/* d_type values: */ |
#define DTYPE_SMD 1 /* SMD, XSMD; VAX hp/up */ |
#define DTYPE_MSCP 2 /* MSCP */ |
#define DTYPE_DEC 3 /* other DEC (rk, rl) */ |
#define DTYPE_SCSI 4 /* SCSI */ |
#define DTYPE_ESDI 5 /* ESDI interface */ |
#define DTYPE_ST506 6 /* ST506 etc. */ |
#define DTYPE_HPIB 7 /* CS/80 on HP-IB */ |
#define DTYPE_HPFL 8 /* HP Fiber-link */ |
#define DTYPE_FLOPPY 10 /* floppy */ |
#define DTYPE_CCD 11 /* concatenated disk */ |
#define DTYPE_VINUM 12 /* vinum volume */ |
#define DTYPE_DOC2K 13 /* Msys DiskOnChip */ |
#define DTYPE_RAID 14 /* CMU RAIDFrame */ |
#define DTYPE_JFS2 16 /* IBM JFS 2 */ |
|
#ifdef DKTYPENAMES |
static const char *dktypenames[] = { |
"unknown", |
"SMD", |
"MSCP", |
"old DEC", |
"SCSI", |
"ESDI", |
"ST506", |
"HP-IB", |
"HP-FL", |
"type 9", |
"floppy", |
"CCD", |
"Vinum", |
"DOC2K", |
"Raid", |
"?", |
"jfs", |
NULL |
}; |
#define DKMAXTYPES (sizeof(dktypenames) / sizeof(dktypenames[0]) - 1) |
#endif |
|
/* |
* Filesystem type and version. |
* Used to interpret other filesystem-specific |
* per-partition information. |
*/ |
#define FS_UNUSED 0 /* unused */ |
#define FS_SWAP 1 /* swap */ |
#define FS_V6 2 /* Sixth Edition */ |
#define FS_V7 3 /* Seventh Edition */ |
#define FS_SYSV 4 /* System V */ |
#define FS_V71K 5 /* V7 with 1K blocks (4.1, 2.9) */ |
#define FS_V8 6 /* Eighth Edition, 4K blocks */ |
#define FS_BSDFFS 7 /* 4.2BSD fast filesystem */ |
#define FS_MSDOS 8 /* MSDOS filesystem */ |
#define FS_BSDLFS 9 /* 4.4BSD log-structured filesystem */ |
#define FS_OTHER 10 /* in use, but unknown/unsupported */ |
#define FS_HPFS 11 /* OS/2 high-performance filesystem */ |
#define FS_ISO9660 12 /* ISO 9660, normally CD-ROM */ |
#define FS_BOOT 13 /* partition contains bootstrap */ |
#define FS_VINUM 14 /* Vinum drive */ |
#define FS_RAID 15 /* RAIDFrame drive */ |
#define FS_JFS2 21 /* IBM JFS2 */ |
|
#ifdef FSTYPENAMES |
static const char *fstypenames[] = { |
"unused", |
"swap", |
"Version 6", |
"Version 7", |
"System V", |
"4.1BSD", |
"Eighth Edition", |
"4.2BSD", |
"MSDOS", |
"4.4LFS", |
"unknown", |
"HPFS", |
"ISO9660", |
"boot", |
"vinum", |
"raid", |
"?", |
"?", |
"?", |
"?", |
"jfs", |
NULL |
}; |
#define FSMAXTYPES (sizeof(fstypenames) / sizeof(fstypenames[0]) - 1) |
#endif |
|
/* |
* flags shared by various drives: |
*/ |
#define D_REMOVABLE 0x01 /* removable media */ |
#define D_ECC 0x02 /* supports ECC */ |
#define D_BADSECT 0x04 /* supports bad sector forw. */ |
#define D_RAMDISK 0x08 /* disk emulator */ |
#define D_CHAIN 0x10 /* can do back-back transfers */ |
|
/* |
* Disklabel-specific ioctls. |
* |
* NB: <sys/disk.h> defines ioctls from 'd'/128 and up. |
*/ |
/* get and set disklabel */ |
#define DIOCGDINFO _IOR('d', 101, struct disklabel)/* get */ |
#define DIOCSDINFO _IOW('d', 102, struct disklabel)/* set */ |
#define DIOCWDINFO _IOW('d', 103, struct disklabel)/* set, update disk */ |
#define DIOCBSDBB _IOW('d', 110, void *) /* write bootblocks */ |
|
/* |
* Functions for proper encoding/decoding of struct disklabel into/from |
* bytestring. |
*/ |
void nbsd_partition_le_dec(u_char *ptr, struct partition *d); |
int nbsd_disklabel_le_dec(u_char *ptr, struct disklabel *d, int maxpart); |
void nbsd_partition_le_enc(u_char *ptr, struct partition *d); |
void nbsd_disklabel_le_enc(u_char *ptr, struct disklabel *d); |
|
#ifndef _KERNEL |
__BEGIN_DECLS |
struct disklabel *getdiskbyname(const char *); |
__END_DECLS |
#endif |
|
#endif /* !_SYS_DISKLABEL_H_ */ |
#endif /* !_NBSD_DISKLABEL_H_ */ |