require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&SOFTRAIDVAR_H)) {
    eval 'sub SOFTRAIDVAR_H () {1;}' unless defined(&SOFTRAIDVAR_H);
    require 'crypto/md5.ph';
    require 'sys/vnode.ph';
    eval 'sub SR_UUID_MAX () {16;}' unless defined(&SR_UUID_MAX);
    eval 'sub SR_HOTSPARE_LEVEL () {0xffffffff;}' unless defined(&SR_HOTSPARE_LEVEL);
    eval 'sub SR_HOTSPARE_VOLID () {0xffffffff;}' unless defined(&SR_HOTSPARE_VOLID);
    eval 'sub SR_KEYDISK_LEVEL () {0xfffffffe;}' unless defined(&SR_KEYDISK_LEVEL);
    eval 'sub SR_KEYDISK_VOLID () {0xfffffffe;}' unless defined(&SR_KEYDISK_VOLID);
    eval 'sub SR_META_SIZE () {64;}' unless defined(&SR_META_SIZE);
    eval 'sub SR_META_OFFSET () {16;}' unless defined(&SR_META_OFFSET);
    eval 'sub SR_META_VERSION () {3;}' unless defined(&SR_META_VERSION);
    eval 'sub SR_META_F_NATIVE () {0;}' unless defined(&SR_META_F_NATIVE);
    eval 'sub SR_META_F_INVALID () {-1;}' unless defined(&SR_META_F_INVALID);
    eval 'sub SR_MAGIC () {0x4d4152436372616d;}' unless defined(&SR_MAGIC);
    eval 'sub ssdi () { &_sdd_invariant;}' unless defined(&ssdi);
    eval 'sub SR_META_DIRTY () {0x1;}' unless defined(&SR_META_DIRTY);
    eval 'sub scmi () { &_scm_invariant;}' unless defined(&scmi);
    eval 'sub SR_CRYPTO_MAXKEYBYTES () {32;}' unless defined(&SR_CRYPTO_MAXKEYBYTES);
    eval 'sub SR_CRYPTO_MAXKEYS () {32;}' unless defined(&SR_CRYPTO_MAXKEYS);
    eval 'sub SR_CRYPTO_KEYBITS () {512;}' unless defined(&SR_CRYPTO_KEYBITS);
    eval 'sub SR_CRYPTO_KEYBYTES () {( &SR_CRYPTO_KEYBITS >> 3);}' unless defined(&SR_CRYPTO_KEYBYTES);
    eval 'sub SR_CRYPTO_KDFHINTBYTES () {256;}' unless defined(&SR_CRYPTO_KDFHINTBYTES);
    eval 'sub SR_CRYPTO_CHECKBYTES () {64;}' unless defined(&SR_CRYPTO_CHECKBYTES);
    eval 'sub SR_CRYPTO_KEY_BLKSHIFT () {30;}' unless defined(&SR_CRYPTO_KEY_BLKSHIFT);
    eval 'sub SR_CRYPTOA_AES_XTS_128 () {1;}' unless defined(&SR_CRYPTOA_AES_XTS_128);
    eval 'sub SR_CRYPTOA_AES_XTS_256 () {2;}' unless defined(&SR_CRYPTOA_AES_XTS_256);
    eval 'sub SR_CRYPTOF_INVALID () {(0);}' unless defined(&SR_CRYPTOF_INVALID);
    eval 'sub SR_CRYPTOF_KEY () {(1<<0);}' unless defined(&SR_CRYPTOF_KEY);
    eval 'sub SR_CRYPTOF_KDFHINT () {(1<<1);}' unless defined(&SR_CRYPTOF_KDFHINT);
    eval 'sub SR_CRYPTOM_AES_ECB_256 () {1;}' unless defined(&SR_CRYPTOM_AES_ECB_256);
    eval 'sub SR_CRYPTOC_HMAC_SHA1 () {1;}' unless defined(&SR_CRYPTOC_HMAC_SHA1);
    eval 'sub chk_hmac_sha1 () { ($_scm_chk->{chk_hmac_sha1});}' unless defined(&chk_hmac_sha1);
    eval 'sub SR_OPT_INVALID () {0x;}' unless defined(&SR_OPT_INVALID);
    eval 'sub SR_OPT_CRYPTO () {0x1;}' unless defined(&SR_OPT_CRYPTO);
    eval 'sub somi () { &_som_invariant;}' unless defined(&somi);
    eval 'sub somi_crypto () { ($_som_invariant->{smm_crypto});}' unless defined(&somi_crypto);
    eval 'sub SR_CRYPTOKDFT_INVALID () {0;}' unless defined(&SR_CRYPTOKDFT_INVALID);
    eval 'sub SR_CRYPTOKDFT_PBKDF2 () {1;}' unless defined(&SR_CRYPTOKDFT_PBKDF2);
    eval 'sub SR_CRYPTOKDFT_KEYDISK () {2;}' unless defined(&SR_CRYPTOKDFT_KEYDISK);
    eval 'sub SR_CRYPTOKDF_INVALID () {(0);}' unless defined(&SR_CRYPTOKDF_INVALID);
    eval 'sub SR_CRYPTOKDF_KEY () {(1<<0);}' unless defined(&SR_CRYPTOKDF_KEY);
    eval 'sub SR_CRYPTOKDF_HINT () {(1<<1);}' unless defined(&SR_CRYPTOKDF_HINT);
    eval 'sub genkdf () { ($_kdfhint->{generic});}' unless defined(&genkdf);
    eval 'sub pbkdf2 () { ($_kdfhint->{pbkdf2});}' unless defined(&pbkdf2);
    eval 'sub SR_IOCTL_GET_KDFHINT () {0x1;}' unless defined(&SR_IOCTL_GET_KDFHINT);
    eval 'sub SR_IOCTL_CHANGE_PASSPHRASE () {0x2;}' unless defined(&SR_IOCTL_CHANGE_PASSPHRASE);
    if(defined(&_KERNEL)) {
	require 'dev/biovar.ph';
	require 'sys/buf.ph';
	require 'sys/pool.ph';
	require 'sys/queue.ph';
	require 'sys/rwlock.ph';
	require 'scsi/scsi_all.ph';
	require 'scsi/scsi_disk.ph';
	require 'scsi/scsiconf.ph';
	eval 'sub DEVNAME {
	    my($_s) = @_;
    	    eval q((($_s)-> ($sc_dev->{dv_xname})));
	}' unless defined(&DEVNAME);
	if(defined(&SR_DEBUG)) {
	    eval 'sub DPRINTF () {( &x...)  &do {  &if ( &sr_debug)  &printf( &x); }  &while(0);}' unless defined(&DPRINTF);
	    eval 'sub DNPRINTF () {( &n, &x...)  &do {  &if ( &sr_debug &  &n)  &printf( &x); }  &while(0);}' unless defined(&DNPRINTF);
	    eval 'sub SR_D_CMD () {0x1;}' unless defined(&SR_D_CMD);
	    eval 'sub SR_D_INTR () {0x2;}' unless defined(&SR_D_INTR);
	    eval 'sub SR_D_MISC () {0x4;}' unless defined(&SR_D_MISC);
	    eval 'sub SR_D_IOCTL () {0x8;}' unless defined(&SR_D_IOCTL);
	    eval 'sub SR_D_CCB () {0x10;}' unless defined(&SR_D_CCB);
	    eval 'sub SR_D_WU () {0x20;}' unless defined(&SR_D_WU);
	    eval 'sub SR_D_META () {0x40;}' unless defined(&SR_D_META);
	    eval 'sub SR_D_DIS () {0x80;}' unless defined(&SR_D_DIS);
	    eval 'sub SR_D_STATE () {0x100;}' unless defined(&SR_D_STATE);
	} else {
	    eval 'sub DPRINTF () {( &x...);}' unless defined(&DPRINTF);
	    eval 'sub DNPRINTF () {( &n, &x...);}' unless defined(&DNPRINTF);
	}
	eval 'sub SR_MAXFER () { &MAXPHYS;}' unless defined(&SR_MAXFER);
	eval 'sub SR_MAX_LD () {1;}' unless defined(&SR_MAX_LD);
	eval 'sub SR_MAX_CMDS () {16;}' unless defined(&SR_MAX_CMDS);
	eval 'sub SR_MAX_STATES () {7;}' unless defined(&SR_MAX_STATES);
	eval 'sub SR_VM_IGNORE_DIRTY () {1;}' unless defined(&SR_VM_IGNORE_DIRTY);
	eval 'sub SR_REBUILD_IO_SIZE () {128;}' unless defined(&SR_REBUILD_IO_SIZE);
	eval 'sub SR_CCB_FREE () {0;}' unless defined(&SR_CCB_FREE);
	eval 'sub SR_CCB_INPROGRESS () {1;}' unless defined(&SR_CCB_INPROGRESS);
	eval 'sub SR_CCB_OK () {2;}' unless defined(&SR_CCB_OK);
	eval 'sub SR_CCB_FAILED () {3;}' unless defined(&SR_CCB_FAILED);
	eval 'sub SR_CCBF_FREEBUF () {(1<<0);}' unless defined(&SR_CCBF_FREEBUF);
	eval 'sub SR_WU_FREE () {0;}' unless defined(&SR_WU_FREE);
	eval 'sub SR_WU_INPROGRESS () {1;}' unless defined(&SR_WU_INPROGRESS);
	eval 'sub SR_WU_OK () {2;}' unless defined(&SR_WU_OK);
	eval 'sub SR_WU_FAILED () {3;}' unless defined(&SR_WU_FAILED);
	eval 'sub SR_WU_PARTIALLYFAILED () {4;}' unless defined(&SR_WU_PARTIALLYFAILED);
	eval 'sub SR_WU_DEFERRED () {5;}' unless defined(&SR_WU_DEFERRED);
	eval 'sub SR_WU_PENDING () {6;}' unless defined(&SR_WU_PENDING);
	eval 'sub SR_WU_RESTART () {7;}' unless defined(&SR_WU_RESTART);
	eval 'sub SR_WU_REQUEUE () {8;}' unless defined(&SR_WU_REQUEUE);
	eval 'sub SR_WUF_REBUILD () {(1<<0);}' unless defined(&SR_WUF_REBUILD);
	eval 'sub SR_WUF_REBUILDIOCOMP () {(1<<1);}' unless defined(&SR_WUF_REBUILDIOCOMP);
	eval 'sub SR_WUF_FAIL () {(1<<2);}' unless defined(&SR_WUF_FAIL);
	eval 'sub SR_WUF_FAILIOCOMP () {(1<<3);}' unless defined(&SR_WUF_FAILIOCOMP);
	eval 'sub SR_RAID0_NOWU () {16;}' unless defined(&SR_RAID0_NOWU);
	eval 'sub SR_RAID1_NOWU () {16;}' unless defined(&SR_RAID1_NOWU);
	eval 'sub SR_RAIDP_NOWU () {16;}' unless defined(&SR_RAIDP_NOWU);
	eval 'sub SR_RAID6_NOWU () {16;}' unless defined(&SR_RAID6_NOWU);
	eval 'sub SR_CRYPTO_NOWU () {16;}' unless defined(&SR_CRYPTO_NOWU);
	eval 'sub SR_RAIDAOE_NOWU () {2;}' unless defined(&SR_RAIDAOE_NOWU);
	eval 'sub SR_MD_RAID0 () {0;}' unless defined(&SR_MD_RAID0);
	eval 'sub SR_MD_RAID1 () {1;}' unless defined(&SR_MD_RAID1);
	eval 'sub SR_MD_RAID5 () {2;}' unless defined(&SR_MD_RAID5);
	eval 'sub SR_MD_CACHE () {3;}' unless defined(&SR_MD_CACHE);
	eval 'sub SR_MD_CRYPTO () {4;}' unless defined(&SR_MD_CRYPTO);
	eval 'sub SR_MD_AOE_INIT () {5;}' unless defined(&SR_MD_AOE_INIT);
	eval 'sub SR_MD_AOE_TARG () {6;}' unless defined(&SR_MD_AOE_TARG);
	eval 'sub SR_MD_RAID4 () {7;}' unless defined(&SR_MD_RAID4);
	eval 'sub SR_MD_RAID6 () {8;}' unless defined(&SR_MD_RAID6);
	eval 'sub SR_CAP_SYSTEM_DISK () {0x1;}' unless defined(&SR_CAP_SYSTEM_DISK);
	eval 'sub SR_CAP_AUTO_ASSEMBLE () {0x2;}' unless defined(&SR_CAP_AUTO_ASSEMBLE);
	eval 'sub SR_CAP_REBUILD () {0x4;}' unless defined(&SR_CAP_REBUILD);
	if(defined(&AOE)) {
	}
	eval 'sub mds () { &sd_dis_specific;}' unless defined(&mds);
	eval 'sub SR_MAXSCSIBUS () {256;}' unless defined(&SR_MAXSCSIBUS);
	if(defined(&SR_DEBUG)) {
	}
    }
}
1;
