require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_nnpfs_vnodeops_h)) {
    eval 'sub _nnpfs_vnodeops_h () {1;}' unless defined(&_nnpfs_vnodeops_h);
    if(defined(&__osf__)) {
	eval 'sub nnpfs_vfs_readlock {
	    my($vp, $proc) = @_;
    	    eval q( &vref(($vp)));
	}' unless defined(&nnpfs_vfs_readlock);
	eval 'sub nnpfs_vfs_writelock {
	    my($vp, $proc) = @_;
    	    eval q( &vref(($vp)));
	}' unless defined(&nnpfs_vfs_writelock);
	eval 'sub nnpfs_vfs_unlock {
	    my($vp, $proc) = @_;
    	    eval q( &vrele(($vp)));
	}' unless defined(&nnpfs_vfs_unlock);
	eval 'sub nnpfs_vfs_vn_lock {
	    my($vp, $flags, $proc) = @_;
    	    eval q((0));
	}' unless defined(&nnpfs_vfs_vn_lock);
    }
 elsif(defined( &HAVE_TWO_ARGUMENT_VOP_LOCK)) {
	eval 'sub nnpfs_vfs_readlock {
	    my($vp, $proc) = @_;
    	    eval q( &vn_lock(($vp),  &LK_SHARED |  &LK_RETRY));
	}' unless defined(&nnpfs_vfs_readlock);
	eval 'sub nnpfs_vfs_writelock {
	    my($vp, $proc) = @_;
    	    eval q( &vn_lock(($vp),  &LK_EXCLUSIVE |  &LK_RETRY));
	}' unless defined(&nnpfs_vfs_writelock);
	eval 'sub nnpfs_vfs_unlock {
	    my($vp, $proc) = @_;
    	    eval q( &VOP_UNLOCK(($vp), 0));
	}' unless defined(&nnpfs_vfs_unlock);
	eval 'sub nnpfs_vfs_vn_lock {
	    my($vp, $flags, $proc) = @_;
    	    eval q( &vn_lock(($vp), ($flags)));
	}' unless defined(&nnpfs_vfs_vn_lock);
    }
 elsif(defined( &HAVE_THREE_ARGUMENT_VOP_LOCK)) {
	eval 'sub nnpfs_vfs_readlock {
	    my($vp, $proc) = @_;
    	    eval q( &vn_lock(($vp),  &LK_SHARED |  &LK_RETRY, ($proc)));
	}' unless defined(&nnpfs_vfs_readlock);
	eval 'sub nnpfs_vfs_writelock {
	    my($vp, $proc) = @_;
    	    eval q( &vn_lock(($vp),  &LK_EXCLUSIVE |  &LK_RETRY, ($proc)));
	}' unless defined(&nnpfs_vfs_writelock);
	eval 'sub nnpfs_vfs_unlock {
	    my($vp, $proc) = @_;
    	    eval q( &VOP_UNLOCK(($vp), 0, ($proc)));
	}' unless defined(&nnpfs_vfs_unlock);
	eval 'sub nnpfs_vfs_vn_lock {
	    my($vp, $flags, $proc) = @_;
    	    eval q( &vn_lock(($vp), ($flags), ($proc)));
	}' unless defined(&nnpfs_vfs_vn_lock);
    }
 elsif(defined( &HAVE_ONE_ARGUMENT_VOP_LOCK)) {
	eval 'sub nnpfs_vfs_readlock {
	    my($vp, $proc) = @_;
    	    eval q( &VOP_LOCK(($vp)));
	}' unless defined(&nnpfs_vfs_readlock);
	eval 'sub nnpfs_vfs_writelock {
	    my($vp, $proc) = @_;
    	    eval q( &VOP_LOCK(($vp)));
	}' unless defined(&nnpfs_vfs_writelock);
	eval 'sub nnpfs_vfs_unlock {
	    my($vp, $proc) = @_;
    	    eval q( &VOP_UNLOCK(($vp)));
	}' unless defined(&nnpfs_vfs_unlock);
	eval 'sub nnpfs_vfs_vn_lock {
	    my($vp, $flags, $proc) = @_;
    	    eval q((0));
	}' unless defined(&nnpfs_vfs_vn_lock);
    } else {
	die("what\ kind\ of\ VOP_LOCK\?");
    }
}
1;
