require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_SYS_DKIO_H_)) {
    eval 'sub _SYS_DKIO_H_ () {1;}' unless defined(&_SYS_DKIO_H_);
    require 'sys/ioccom.ph';
    require 'prop/plistref.ph';
    eval 'sub DIOCGDINFO () { &_IOR(ord(\'d\'), 101, \'struct disklabel\');}' unless defined(&DIOCGDINFO);
    eval 'sub DIOCSDINFO () { &_IOW(ord(\'d\'), 102, \'struct disklabel\');}' unless defined(&DIOCSDINFO);
    eval 'sub DIOCWDINFO () { &_IOW(ord(\'d\'), 103, \'struct disklabel\');}' unless defined(&DIOCWDINFO);
    if(defined(&_KERNEL)) {
	eval 'sub DIOCGDINFO32 () {( &DIOCGDINFO - ($sizeof{ &uint32_t} <<  &IOCPARM_SHIFT));}' unless defined(&DIOCGDINFO32);
	eval 'sub DIOCGPARTINFO () { &_IOW(ord(\'d\'), 104, \'struct partinfo\');}' unless defined(&DIOCGPARTINFO);
    }
    if(defined(&__HAVE_OLD_DISKLABEL)  && defined(&_KERNEL)) {
	eval 'sub ODIOCGDINFO () { &_IOR(ord(\'d\'), 101, \'struct olddisklabel\');}' unless defined(&ODIOCGDINFO);
	eval 'sub ODIOCSDINFO () { &_IOW(ord(\'d\'), 102, \'struct olddisklabel\');}' unless defined(&ODIOCSDINFO);
	eval 'sub ODIOCWDINFO () { &_IOW(ord(\'d\'), 103, \'struct olddisklabel\');}' unless defined(&ODIOCWDINFO);
    }
    eval 'sub DIOCRFORMAT () { &_IOWR(ord(\'d\'), 105, \'struct format_op\');}' unless defined(&DIOCRFORMAT);
    eval 'sub DIOCWFORMAT () { &_IOWR(ord(\'d\'), 106, \'struct format_op\');}' unless defined(&DIOCWFORMAT);
    eval 'sub DIOCSSTEP () { &_IOW(ord(\'d\'), 107, \'int\');}' unless defined(&DIOCSSTEP);
    eval 'sub DIOCSRETRIES () { &_IOW(ord(\'d\'), 108, \'int\');}' unless defined(&DIOCSRETRIES);
    eval 'sub DIOCKLABEL () { &_IOW(ord(\'d\'), 119, \'int\');}' unless defined(&DIOCKLABEL);
    eval 'sub DIOCWLABEL () { &_IOW(ord(\'d\'), 109, \'int\');}' unless defined(&DIOCWLABEL);
    eval 'sub DIOCSBAD () { &_IOW(ord(\'d\'), 110, \'struct dkbad\');}' unless defined(&DIOCSBAD);
    eval 'sub DIOCEJECT () { &_IOW(ord(\'d\'), 112, \'int\');}' unless defined(&DIOCEJECT);
    eval 'sub ODIOCEJECT () { &_IO(ord(\'d\'), 112);}' unless defined(&ODIOCEJECT);
    eval 'sub DIOCLOCK () { &_IOW(ord(\'d\'), 113, \'int\');}' unless defined(&DIOCLOCK);
    eval 'sub DIOCGDEFLABEL () { &_IOR(ord(\'d\'), 114, \'struct disklabel\');}' unless defined(&DIOCGDEFLABEL);
    eval 'sub DIOCCLRLABEL () { &_IO(ord(\'d\'), 115);}' unless defined(&DIOCCLRLABEL);
    if(defined(&__HAVE_OLD_DISKLABEL)  && defined(&_KERNEL)) {
	eval 'sub ODIOCGDEFLABEL () { &_IOR(ord(\'d\'), 114, \'struct olddisklabel\');}' unless defined(&ODIOCGDEFLABEL);
    }
    eval 'sub DIOCGCACHE () { &_IOR(ord(\'d\'), 116, \'int\');}' unless defined(&DIOCGCACHE);
    eval 'sub DIOCSCACHE () { &_IOW(ord(\'d\'), 117, \'int\');}' unless defined(&DIOCSCACHE);
    eval 'sub DKCACHE_READ () {0x1;}' unless defined(&DKCACHE_READ);
    eval 'sub DKCACHE_WRITE () {0x2;}' unless defined(&DKCACHE_WRITE);
    eval 'sub DKCACHE_RCHANGE () {0x100;}' unless defined(&DKCACHE_RCHANGE);
    eval 'sub DKCACHE_WCHANGE () {0x200;}' unless defined(&DKCACHE_WCHANGE);
    eval 'sub DKCACHE_SAVE () {0x10000;}' unless defined(&DKCACHE_SAVE);
    eval 'sub DKCACHE_FUA () {0x20000;}' unless defined(&DKCACHE_FUA);
    eval 'sub DKCACHE_DPO () {0x40000;}' unless defined(&DKCACHE_DPO);
    eval 'sub DKCACHE_COMBINE {
        my($a, $b) = @_;
	    eval q(((($a) & ($b)) | ((($a) | ($b)) & ( &DKCACHE_WRITE| &DKCACHE_WCHANGE))));
    }' unless defined(&DKCACHE_COMBINE);
    eval 'sub DIOCCACHESYNC () { &_IOW(ord(\'d\'), 118, \'int\');}' unless defined(&DIOCCACHESYNC);
    eval 'sub DIOCBSLIST () { &_IOWR(ord(\'d\'), 119, \'struct disk_badsecinfo\');}' unless defined(&DIOCBSLIST);
    eval 'sub DIOCBSFLUSH () { &_IO(ord(\'d\'), 120);}' unless defined(&DIOCBSFLUSH);
    eval 'sub DIOCAWEDGE () { &_IOWR(ord(\'d\'), 121, \'struct dkwedge_info\');}' unless defined(&DIOCAWEDGE);
    eval 'sub DIOCGWEDGEINFO () { &_IOR(ord(\'d\'), 122, \'struct dkwedge_info\');}' unless defined(&DIOCGWEDGEINFO);
    eval 'sub DIOCDWEDGE () { &_IOW(ord(\'d\'), 123, \'struct dkwedge_info\');}' unless defined(&DIOCDWEDGE);
    eval 'sub DIOCLWEDGES () { &_IOWR(ord(\'d\'), 124, \'struct dkwedge_list\');}' unless defined(&DIOCLWEDGES);
    eval 'sub DIOCGSTRATEGY () { &_IOR(ord(\'d\'), 125, \'struct disk_strategy\');}' unless defined(&DIOCGSTRATEGY);
    eval 'sub DIOCSSTRATEGY () { &_IOW(ord(\'d\'), 126, \'struct disk_strategy\');}' unless defined(&DIOCSSTRATEGY);
    eval 'sub DIOCGDISKINFO () { &_IOR(ord(\'d\'), 127, \'struct plistref\');}' unless defined(&DIOCGDISKINFO);
    eval 'sub DIOCTUR () { &_IOR(ord(\'d\'), 128, \'int\');}' unless defined(&DIOCTUR);
    eval 'sub DIOCMWEDGES () { &_IOR(ord(\'d\'), 131, \'int\');}' unless defined(&DIOCMWEDGES);
    eval 'sub DIOCGSECTORSIZE () { &_IOR(ord(\'d\'), 133, \'u_int\');}' unless defined(&DIOCGSECTORSIZE);
    eval 'sub DIOCGMEDIASIZE () { &_IOR(ord(\'d\'), 132,  &off_t);}' unless defined(&DIOCGMEDIASIZE);
    eval 'sub DIOCRMWEDGES () { &_IOR(ord(\'d\'), 134, \'int\');}' unless defined(&DIOCRMWEDGES);
    eval 'sub DIOCGSECTORALIGN () { &_IOR(ord(\'d\'), 135, \'struct disk_sectoralign\');}' unless defined(&DIOCGSECTORALIGN);
}
1;
