require '_h2ph_pre.ph';

no warnings qw(redefine misc);

require 'miscfs/genfs/layer.ph';
eval 'sub ova_target () { ($la->{target});}' unless defined(&ova_target);
eval 'sub ova_export () { ($la->{export});}' unless defined(&ova_export);
if(defined(&_KERNEL)) {
    eval 'sub ovm_rootvp () { ($lm->{layerm_rootvp});}' unless defined(&ovm_rootvp);
    eval 'sub ovm_export () { ($lm->{layerm_export});}' unless defined(&ovm_export);
    eval 'sub ovm_flags () { ($lm->{layerm_flags});}' unless defined(&ovm_flags);
    eval 'sub ovm_size () { ($lm->{layerm_size});}' unless defined(&ovm_size);
    eval 'sub ovm_tag () { ($lm->{layerm_tag});}' unless defined(&ovm_tag);
    eval 'sub ovm_bypass () { ($lm->{layerm_bypass});}' unless defined(&ovm_bypass);
    eval 'sub ovm_alloc () { ($lm->{layerm_alloc});}' unless defined(&ovm_alloc);
    eval 'sub ovm_vnodeop_p () { ($lm->{layerm_vnodeop_p});}' unless defined(&ovm_vnodeop_p);
    eval 'sub ovm_node_hashtbl () { ($lm->{layerm_node_hashtbl});}' unless defined(&ovm_node_hashtbl);
    eval 'sub ovm_node_hash () { ($lm->{layerm_node_hash});}' unless defined(&ovm_node_hash);
    eval 'sub ovm_hashlock () { ($lm->{layerm_hashlock});}' unless defined(&ovm_hashlock);
    eval 'sub ov_hash () { ($ln->{layer_hash});}' unless defined(&ov_hash);
    eval 'sub ov_lowervp () { ($ln->{layer_lowervp});}' unless defined(&ov_lowervp);
    eval 'sub ov_vnode () { ($ln->{layer_vnode});}' unless defined(&ov_vnode);
    eval 'sub ov_flags () { ($ln->{layer_flags});}' unless defined(&ov_flags);
    eval 'sub MOUNTTOOVERLAYMOUNT {
        my($mp) = @_;
	    eval q(((($mp)-> &mnt_data)));
    }' unless defined(&MOUNTTOOVERLAYMOUNT);
    eval 'sub VTOOVERLAY {
        my($vp) = @_;
	    eval q((($vp)-> &v_data));
    }' unless defined(&VTOOVERLAY);
    eval 'sub OVERLAYTOV {
        my($xp) = @_;
	    eval q((($xp)-> &ov_vnode));
    }' unless defined(&OVERLAYTOV);
    if(defined(&OVERLAYFS_DIAGNOSTIC)) {
	eval 'sub OVERLAYVPTOLOWERVP {
	    my($vp) = @_;
    	    eval q( &layer_checkvp(($vp),  &__FILE__,  &__LINE__));
	}' unless defined(&OVERLAYVPTOLOWERVP);
    } else {
	eval 'sub OVERLAYVPTOLOWERVP {
	    my($vp) = @_;
    	    eval q(( &VTOOVERLAY($vp)-> &ov_lowervp));
	}' unless defined(&OVERLAYVPTOLOWERVP);
    }
}
1;
