require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_FS_HFS_HFS_H_)) {
    eval 'sub _FS_HFS_HFS_H_ () {1;}' unless defined(&_FS_HFS_HFS_H_);
    require 'sys/vnode.ph';
    require 'sys/mount.ph';
    require 'miscfs/genfs/genfs_node.ph';
    if(defined(&HFS_DEBUG)) {
	if(defined(&_KERNEL)) {
	    require './fs/hfs/opt_ddb.ph';
	}
    }
    require 'fs/hfs/libhfs.ph';
    eval 'sub HFS_DEFAULT_UID () {0;}' unless defined(&HFS_DEFAULT_UID);
    eval 'sub HFS_DEFAULT_GID () {0;}' unless defined(&HFS_DEFAULT_GID);
    eval 'sub HFS_DEFAULT_DIR_MODE () {0755;}' unless defined(&HFS_DEFAULT_DIR_MODE);
    eval 'sub HFS_DEFAULT_FILE_MODE () {0755;}' unless defined(&HFS_DEFAULT_FILE_MODE);
    eval 'sub h_fork () { ($h_key->{hnk_fork});}' unless defined(&h_fork);
    if(defined(&_KERNEL)) {
	require 'sys/malloc.ph';
	eval 'sub VFSTOHFS {
	    my($mp) = @_;
    	    eval q(((($mp)-> &mnt_data)));
	}' unless defined(&VFSTOHFS);
	eval 'sub VTOH {
	    my($vp) = @_;
    	    eval q((($vp)-> &v_data));
	}' unless defined(&VTOH);
	eval 'sub HTOV {
	    my($hp) = @_;
    	    eval q((($hp)-> &h_vnode));
	}' unless defined(&HTOV);
	eval 'sub HFS_BLOCKSIZE {
	    my($vp) = @_;
    	    eval q(( &VTOH($vp)-> ($h_hmp->{hm_vol}->{vh}->{block_size})));
	}' unless defined(&HFS_BLOCKSIZE);
	eval 'sub HFS_CONVERT_RDEV {
	    my($x) = @_;
    	    eval q( &makedev(($x)>>24, ($x)&0xffffff));
	}' unless defined(&HFS_CONVERT_RDEV);
    }
}
1;
