require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_PATH_DISKTAB)) {
    sub _PATH_DISKTAB () {	"/etc/disktab";}
}
unless(defined(&DISKTAB)) {
    sub DISKTAB () {	"/etc/disktab";}
}
require 'machine/disklabel.ph';
unless(defined(&MAXMAXPARTITIONS)) {
    sub MAXMAXPARTITIONS () {	22;}
}
if((defined(&MAXPARTITIONS) ? &MAXPARTITIONS : undef) > (defined(&MAXMAXPARTITIONS) ? &MAXMAXPARTITIONS : undef)) {
}
unless(defined(&DISKUNIT)) {
    sub DISKUNIT {
	my($dev) = @_;
	eval q(( &minor($dev) /  &MAXPARTITIONS));
    }
}
unless(defined(&DISKPART)) {
    sub DISKPART {
	my($dev) = @_;
	eval q(( &minor($dev) %  &MAXPARTITIONS));
    }
}
unless(defined(&RAW_PART)) {
    sub RAW_PART () {	2;}
}
unless(defined(&DISKMINOR)) {
    sub DISKMINOR {
	my($unit, $part) = @_;
	eval q(((($unit) *  &MAXPARTITIONS) + ($part)));
    }
}
unless(defined(&MAKEDISKDEV)) {
    sub MAKEDISKDEV {
	my($maj, $unit, $part) = @_;
	eval q(( &makedev(($maj),  &DISKMINOR(($unit), ($part)))));
    }
}
unless(defined(&DISKLABELDEV)) {
    sub DISKLABELDEV {
	my($dev) = @_;
	eval q(( &MAKEDISKDEV( &major($dev),  &DISKUNIT($dev),  &RAW_PART)));
    }
}
unless(defined(&DISKMAGIC)) {
    sub DISKMAGIC () {	(( &u_int32_t)0x82564557);}
}
unless(defined(&MAXDISKSIZE)) {
    sub MAXDISKSIZE () {	0x7fffffffffff;}
}
unless(defined(&_LOCORE)) {
    eval 'sub d_packname () { ($d_un->{un_d_packname});}' unless defined(&d_packname);
    eval 'sub d_boot0 () { ($d_un->{un_b}->{un_d_boot0});}' unless defined(&d_boot0);
    eval 'sub d_boot1 () { ($d_un->{un_b}->{un_d_boot1});}' unless defined(&d_boot1);
    eval 'sub NDDATA () {5;}' unless defined(&NDDATA);
    eval 'sub NSPARE () {4;}' unless defined(&NSPARE);
}
unless(defined(&DISKLABELV1_FFS_FRAGBLOCK)) {
    sub DISKLABELV1_FFS_FRAGBLOCK {
	my($fsize, $frag) = @_;
	eval q((($fsize) * ($frag) == 0? 0: ((( &ffs(($fsize) * ($frag)) - 13) << 3) | ( &ffs($frag)))));
    }
}
unless(defined(&DISKLABELV1_FFS_BSIZE)) {
    sub DISKLABELV1_FFS_BSIZE {
	my($i) = @_;
	eval q((($i) == 0? 0: (1<< ((($i) >> 3) + 12))));
    }
}
unless(defined(&DISKLABELV1_FFS_FRAG)) {
    sub DISKLABELV1_FFS_FRAG {
	my($i) = @_;
	eval q((($i) == 0? 0: (1<< ((($i) & 0x7) - 1))));
    }
}
unless(defined(&DISKLABELV1_FFS_FSIZE)) {
    sub DISKLABELV1_FFS_FSIZE {
	my($i) = @_;
	eval q(( &DISKLABELV1_FFS_FRAG($i) == 0? 0: ( &DISKLABELV1_FFS_BSIZE($i) /  &DISKLABELV1_FFS_FRAG($i))));
    }
}
unless(defined(&DL_GETPSIZE)) {
    sub DL_GETPSIZE {
	my($p) = @_;
	eval q(((( &u_int64_t)($p)-> &p_sizeh << 32) + ($p)-> &p_size));
    }
}
unless(defined(&DL_SETPSIZE)) {
    sub DL_SETPSIZE {
	my($p, $n) = @_;
	eval q( &do {  &daddr64_t  &x = ($n); ($p)-> &p_sizeh =  &x >> 32; ($p)-> &p_size =  &x; }  &while (0));
    }
}
unless(defined(&DL_GETPOFFSET)) {
    sub DL_GETPOFFSET {
	my($p) = @_;
	eval q(((( &u_int64_t)($p)-> &p_offseth << 32) + ($p)-> &p_offset));
    }
}
unless(defined(&DL_SETPOFFSET)) {
    sub DL_SETPOFFSET {
	my($p, $n) = @_;
	eval q( &do {  &daddr64_t  &x = ($n); ($p)-> &p_offseth =  &x >> 32; ($p)-> &p_offset =  &x; }  &while (0));
    }
}
unless(defined(&DL_GETDSIZE)) {
    sub DL_GETDSIZE {
	my($d) = @_;
	eval q(((( &u_int64_t)($d)-> &d_secperunith << 32) + ($d)-> &d_secperunit));
    }
}
unless(defined(&DL_SETDSIZE)) {
    sub DL_SETDSIZE {
	my($d, $n) = @_;
	eval q( &do {  &daddr64_t  &x = ($n); ($d)-> &d_secperunith =  &x >> 32; ($d)-> &d_secperunit =  &x; }  &while (0));
    }
}
unless(defined(&DL_GETBSTART)) {
    sub DL_GETBSTART {
	my($d) = @_;
	eval q(((( &u_int64_t)($d)-> &d_bstarth << 32) + ($d)-> &d_bstart));
    }
}
unless(defined(&DL_SETBSTART)) {
    sub DL_SETBSTART {
	my($d, $n) = @_;
	eval q( &do {  &daddr64_t  &x = ($n); ($d)-> &d_bstarth =  &x >> 32; ($d)-> &d_bstart =  &x; }  &while (0));
    }
}
unless(defined(&DL_GETBEND)) {
    sub DL_GETBEND {
	my($d) = @_;
	eval q(((( &u_int64_t)($d)-> &d_bendh << 32) + ($d)-> &d_bend));
    }
}
unless(defined(&DL_SETBEND)) {
    sub DL_SETBEND {
	my($d, $n) = @_;
	eval q( &do {  &daddr64_t  &x = ($n); ($d)-> &d_bendh =  &x >> 32; ($d)-> &d_bend =  &x; }  &while (0));
    }
}
unless(defined(&DL_BLKSPERSEC)) {
    sub DL_BLKSPERSEC {
	my($d) = @_;
	eval q((($d)-> &d_secsize /  &DEV_BSIZE));
    }
}
unless(defined(&DL_SECTOBLK)) {
    sub DL_SECTOBLK {
	my($d, $n) = @_;
	eval q((($n) *  &DL_BLKSPERSEC($d)));
    }
}
unless(defined(&DL_BLKTOSEC)) {
    sub DL_BLKTOSEC {
	my($d, $n) = @_;
	eval q((($n) /  &DL_BLKSPERSEC($d)));
    }
}
unless(defined(&DL_BLKOFFSET)) {
    sub DL_BLKOFFSET {
	my($d, $n) = @_;
	eval q(((($n) %  &DL_BLKSPERSEC($d)) *  &DEV_BSIZE));
    }
}
unless(defined(&DTYPE_SMD)) {
    sub DTYPE_SMD () {	1;}
}
unless(defined(&DTYPE_MSCP)) {
    sub DTYPE_MSCP () {	2;}
}
unless(defined(&DTYPE_DEC)) {
    sub DTYPE_DEC () {	3;}
}
unless(defined(&DTYPE_SCSI)) {
    sub DTYPE_SCSI () {	4;}
}
unless(defined(&DTYPE_ESDI)) {
    sub DTYPE_ESDI () {	5;}
}
unless(defined(&DTYPE_ST506)) {
    sub DTYPE_ST506 () {	6;}
}
unless(defined(&DTYPE_HPIB)) {
    sub DTYPE_HPIB () {	7;}
}
unless(defined(&DTYPE_HPFL)) {
    sub DTYPE_HPFL () {	8;}
}
unless(defined(&DTYPE_FLOPPY)) {
    sub DTYPE_FLOPPY () {	10;}
}
unless(defined(&DTYPE_CCD)) {
    sub DTYPE_CCD () {	11;}
}
unless(defined(&DTYPE_VND)) {
    sub DTYPE_VND () {	12;}
}
unless(defined(&DTYPE_ATAPI)) {
    sub DTYPE_ATAPI () {	13;}
}
unless(defined(&DTYPE_RAID)) {
    sub DTYPE_RAID () {	14;}
}
if(defined(&DKTYPENAMES)) {
    eval 'sub DKMAXTYPES () {($sizeof{ &dktypenames} / $sizeof{ $dktypenames[0]} - 1);}' unless defined(&DKMAXTYPES);
}
unless(defined(&FS_UNUSED)) {
    sub FS_UNUSED () {	0;}
}
unless(defined(&FS_SWAP)) {
    sub FS_SWAP () {	1;}
}
unless(defined(&FS_V6)) {
    sub FS_V6 () {	2;}
}
unless(defined(&FS_V7)) {
    sub FS_V7 () {	3;}
}
unless(defined(&FS_SYSV)) {
    sub FS_SYSV () {	4;}
}
unless(defined(&FS_V71K)) {
    sub FS_V71K () {	5;}
}
unless(defined(&FS_V8)) {
    sub FS_V8 () {	6;}
}
unless(defined(&FS_BSDFFS)) {
    sub FS_BSDFFS () {	7;}
}
unless(defined(&FS_MSDOS)) {
    sub FS_MSDOS () {	8;}
}
unless(defined(&FS_BSDLFS)) {
    sub FS_BSDLFS () {	9;}
}
unless(defined(&FS_OTHER)) {
    sub FS_OTHER () {	10;}
}
unless(defined(&FS_HPFS)) {
    sub FS_HPFS () {	11;}
}
unless(defined(&FS_ISO9660)) {
    sub FS_ISO9660 () {	12;}
}
unless(defined(&FS_BOOT)) {
    sub FS_BOOT () {	13;}
}
unless(defined(&FS_ADOS)) {
    sub FS_ADOS () {	14;}
}
unless(defined(&FS_HFS)) {
    sub FS_HFS () {	15;}
}
unless(defined(&FS_ADFS)) {
    sub FS_ADFS () {	16;}
}
unless(defined(&FS_EXT2FS)) {
    sub FS_EXT2FS () {	17;}
}
unless(defined(&FS_CCD)) {
    sub FS_CCD () {	18;}
}
unless(defined(&FS_RAID)) {
    sub FS_RAID () {	19;}
}
unless(defined(&FS_NTFS)) {
    sub FS_NTFS () {	20;}
}
unless(defined(&FS_UDF)) {
    sub FS_UDF () {	21;}
}
if(defined(&DKTYPENAMES)) {
    eval 'sub FSMAXTYPES () {($sizeof{ &fstypenames} / $sizeof{ $fstypenames[0]} - 1);}' unless defined(&FSMAXTYPES);
}
unless(defined(&D_BADSECT)) {
    sub D_BADSECT () {	0x4;}
}
unless(defined(&D_VENDOR)) {
    sub D_VENDOR () {	0x8;}
}
unless(defined(&d_smdflags)) {
    sub d_smdflags () {	 $d_drivedata[0];}
}
unless(defined(&D_SSE)) {
    sub D_SSE () {	0x1;}
}
unless(defined(&d_mindist)) {
    sub d_mindist () {	 $d_drivedata[1];}
}
unless(defined(&d_maxdist)) {
    sub d_maxdist () {	 $d_drivedata[2];}
}
unless(defined(&d_sdist)) {
    sub d_sdist () {	 $d_drivedata[3];}
}
unless(defined(&d_precompcyl)) {
    sub d_precompcyl () {	 $d_drivedata[0];}
}
unless(defined(&d_gap3)) {
    sub d_gap3 () {	 $d_drivedata[1];}
}
unless(defined(&d_blind)) {
    sub d_blind () {	 $d_drivedata[0];}
}
unless(defined(&_LOCORE)) {
    eval 'sub DOS_LABELSECTOR () {1;}' unless defined(&DOS_LABELSECTOR);
    eval 'sub DOSBBSECTOR () {0;}' unless defined(&DOSBBSECTOR);
    eval 'sub DOSPARTOFF () {446;}' unless defined(&DOSPARTOFF);
    eval 'sub DOSDISKOFF () {444;}' unless defined(&DOSDISKOFF);
    eval 'sub NDOSPART () {4;}' unless defined(&NDOSPART);
    eval 'sub DOSACTIVE () {0x80;}' unless defined(&DOSACTIVE);
    eval 'sub DOSMBR_SIGNATURE () {(0xaa55);}' unless defined(&DOSMBR_SIGNATURE);
    eval 'sub DOSMBR_SIGNATURE_OFF () {(0x1fe);}' unless defined(&DOSMBR_SIGNATURE_OFF);
    eval 'sub DOS_MAXEBR () {256;}' unless defined(&DOS_MAXEBR);
    eval 'sub DPSECT {
        my($s) = @_;
	    eval q((($s) & 0x3f));
    }' unless defined(&DPSECT);
    eval 'sub DPCYL {
        my($c, $s) = @_;
	    eval q((($c) + ((($s) & 0xc0) << 2)));
    }' unless defined(&DPCYL);
    eval 'sub DOSPTYP_UNUSED () {0x;}' unless defined(&DOSPTYP_UNUSED);
    eval 'sub DOSPTYP_FAT12 () {0x1;}' unless defined(&DOSPTYP_FAT12);
    eval 'sub DOSPTYP_FAT16S () {0x4;}' unless defined(&DOSPTYP_FAT16S);
    eval 'sub DOSPTYP_EXTEND () {0x5;}' unless defined(&DOSPTYP_EXTEND);
    eval 'sub DOSPTYP_FAT16B () {0x6;}' unless defined(&DOSPTYP_FAT16B);
    eval 'sub DOSPTYP_NTFS () {0x7;}' unless defined(&DOSPTYP_NTFS);
    eval 'sub DOSPTYP_FAT32 () {0xb;}' unless defined(&DOSPTYP_FAT32);
    eval 'sub DOSPTYP_FAT32L () {0xc;}' unless defined(&DOSPTYP_FAT32L);
    eval 'sub DOSPTYP_FAT16L () {0xe;}' unless defined(&DOSPTYP_FAT16L);
    eval 'sub DOSPTYP_EXTENDL () {0xf;}' unless defined(&DOSPTYP_EXTENDL);
    eval 'sub DOSPTYP_ONTRACK () {0x54;}' unless defined(&DOSPTYP_ONTRACK);
    eval 'sub DOSPTYP_LINUX () {0x83;}' unless defined(&DOSPTYP_LINUX);
    eval 'sub DOSPTYP_FREEBSD () {0xa5;}' unless defined(&DOSPTYP_FREEBSD);
    eval 'sub DOSPTYP_OPENBSD () {0xa6;}' unless defined(&DOSPTYP_OPENBSD);
    eval 'sub DOSPTYP_NETBSD () {0xa9;}' unless defined(&DOSPTYP_NETBSD);
    if(defined(&_KERNEL)) {
	if(defined(&CD9660)) {
	}
	if(defined(&UDF)) {
	}
    }
}
if(!defined(&_KERNEL)  && !defined(&_LOCORE)) {
    require 'sys/cdefs.ph';
}
1;
