require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_SYS_NAMEI_H_)) {
    eval 'sub _SYS_NAMEI_H_ () {1;}' unless defined(&_SYS_NAMEI_H_);
    require 'sys/queue.ph';
    require 'sys/mutex.ph';
    if(defined(&_KERNEL) || defined(&_MODULE)) {
	require 'sys/kauth.ph';
	require 'sys/rwlock.ph';
	eval 'sub LOOKUP () {0;}' unless defined(&LOOKUP);
	eval 'sub CREATE () {1;}' unless defined(&CREATE);
	eval 'sub DELETE () {2;}' unless defined(&DELETE);
	eval 'sub RENAME () {3;}' unless defined(&RENAME);
	eval 'sub OPMASK () {3;}' unless defined(&OPMASK);
	eval 'sub LOCKLEAF () {0x4;}' unless defined(&LOCKLEAF);
	eval 'sub LOCKPARENT () {0x8;}' unless defined(&LOCKPARENT);
	eval 'sub TRYEMULROOT () {0x10;}' unless defined(&TRYEMULROOT);
	eval 'sub NOCACHE () {0x20;}' unless defined(&NOCACHE);
	eval 'sub FOLLOW () {0x40;}' unless defined(&FOLLOW);
	eval 'sub NOFOLLOW () {0x;}' unless defined(&NOFOLLOW);
	eval 'sub EMULROOTSET () {0x80;}' unless defined(&EMULROOTSET);
	eval 'sub LOCKSHARED () {0x100;}' unless defined(&LOCKSHARED);
	eval 'sub NOCHROOT () {0x1000000;}' unless defined(&NOCHROOT);
	eval 'sub NONEXCLHACK () {0x2000000;}' unless defined(&NONEXCLHACK);
	eval 'sub MODMASK () {0x30001fc;}' unless defined(&MODMASK);
	eval 'sub NOCROSSMOUNT () {0x800;}' unless defined(&NOCROSSMOUNT);
	eval 'sub RDONLY () {0x1000;}' unless defined(&RDONLY);
	eval 'sub ISDOTDOT () {0x2000;}' unless defined(&ISDOTDOT);
	eval 'sub MAKEENTRY () {0x4000;}' unless defined(&MAKEENTRY);
	eval 'sub ISLASTCN () {0x8000;}' unless defined(&ISLASTCN);
	eval 'sub WILLBEDIR () {0x10000;}' unless defined(&WILLBEDIR);
	eval 'sub ISWHITEOUT () {0x20000;}' unless defined(&ISWHITEOUT);
	eval 'sub DOWHITEOUT () {0x40000;}' unless defined(&DOWHITEOUT);
	eval 'sub REQUIREDIR () {0x80000;}' unless defined(&REQUIREDIR);
	eval 'sub CREATEDIR () {0x200000;}' unless defined(&CREATEDIR);
	eval 'sub PARAMASK () {0x2ff800;}' unless defined(&PARAMASK);
	eval 'sub NDINIT {
	    my($ndp, $op, $flags, $pathbuf) = @_;
    	    eval q({ ($ndp)-> ($ni_cnd->{cn_nameiop}) = $op; ($ndp)-> ($ni_cnd->{cn_flags}) = $flags; ($ndp)-> &ni_atdir =  &NULL; ($ndp)-> &ni_pathbuf = $pathbuf; ($ndp)-> ($ni_cnd->{cn_cred}) =  &kauth_cred_get(); });
	}' unless defined(&NDINIT);
	eval 'sub NDAT {
	    my($ndp, $dir) = @_;
    	    eval q({ ($ndp)-> &ni_atdir = ($dir); });
	}' unless defined(&NDAT);
    }
    if(defined(&__NAMECACHE_PRIVATE)) {
	require 'sys/rbtree.ph';
	eval 'sub NCHNAMLEN () {$sizeof{( &NULL)-> &nc_name};}' unless defined(&NCHNAMLEN);
    }
    if(defined(&_KERNEL)) {
	require 'sys/pool.ph';
	eval 'sub PNBUF_GET () {
	    eval q(( &pool_cache_get( &pnbuf_cache,  &PR_WAITOK)));
	}' unless defined(&PNBUF_GET);
	eval 'sub PNBUF_PUT {
	    my($pnb) = @_;
    	    eval q( &pool_cache_put( &pnbuf_cache, ( &void *)($pnb)));
	}' unless defined(&PNBUF_PUT);
	eval 'sub PURGE_PARENTS () {1;}' unless defined(&PURGE_PARENTS);
	eval 'sub PURGE_CHILDREN () {2;}' unless defined(&PURGE_CHILDREN);
	eval 'sub cache_purge {
	    my($vp) = @_;
    	    eval q( &cache_purge1(($vp), &NULL,0, &PURGE_PARENTS| &PURGE_CHILDREN));
	}' unless defined(&cache_purge);
    }
    eval 'sub _NAMEI_CACHE_STATS {
        my($type) = @_;
	    eval q({ $type  &ncs_goodhits; $type  &ncs_neghits; $type  &ncs_badhits; $type  &ncs_falsehits; $type  &ncs_miss; $type \'ncs_long\'; $type  &ncs_pass2; $type  &ncs_2passes; $type  &ncs_revhits; $type  &ncs_revmiss; $type  &ncs_denied; });
    }' unless defined(&_NAMEI_CACHE_STATS);
    eval 'sub NAMEI_LOOKUP () {0;}' unless defined(&NAMEI_LOOKUP);
    eval 'sub NAMEI_CREATE () {1;}' unless defined(&NAMEI_CREATE);
    eval 'sub NAMEI_DELETE () {2;}' unless defined(&NAMEI_DELETE);
    eval 'sub NAMEI_RENAME () {3;}' unless defined(&NAMEI_RENAME);
    eval 'sub NAMEI_OPMASK () {3;}' unless defined(&NAMEI_OPMASK);
    eval 'sub NAMEI_LOCKLEAF () {0x4;}' unless defined(&NAMEI_LOCKLEAF);
    eval 'sub NAMEI_LOCKPARENT () {0x8;}' unless defined(&NAMEI_LOCKPARENT);
    eval 'sub NAMEI_TRYEMULROOT () {0x10;}' unless defined(&NAMEI_TRYEMULROOT);
    eval 'sub NAMEI_NOCACHE () {0x20;}' unless defined(&NAMEI_NOCACHE);
    eval 'sub NAMEI_FOLLOW () {0x40;}' unless defined(&NAMEI_FOLLOW);
    eval 'sub NAMEI_NOFOLLOW () {0x;}' unless defined(&NAMEI_NOFOLLOW);
    eval 'sub NAMEI_EMULROOTSET () {0x80;}' unless defined(&NAMEI_EMULROOTSET);
    eval 'sub NAMEI_LOCKSHARED () {0x100;}' unless defined(&NAMEI_LOCKSHARED);
    eval 'sub NAMEI_NOCHROOT () {0x1000000;}' unless defined(&NAMEI_NOCHROOT);
    eval 'sub NAMEI_NONEXCLHACK () {0x2000000;}' unless defined(&NAMEI_NONEXCLHACK);
    eval 'sub NAMEI_MODMASK () {0x30001fc;}' unless defined(&NAMEI_MODMASK);
    eval 'sub NAMEI_NOCROSSMOUNT () {0x800;}' unless defined(&NAMEI_NOCROSSMOUNT);
    eval 'sub NAMEI_RDONLY () {0x1000;}' unless defined(&NAMEI_RDONLY);
    eval 'sub NAMEI_ISDOTDOT () {0x2000;}' unless defined(&NAMEI_ISDOTDOT);
    eval 'sub NAMEI_MAKEENTRY () {0x4000;}' unless defined(&NAMEI_MAKEENTRY);
    eval 'sub NAMEI_ISLASTCN () {0x8000;}' unless defined(&NAMEI_ISLASTCN);
    eval 'sub NAMEI_WILLBEDIR () {0x10000;}' unless defined(&NAMEI_WILLBEDIR);
    eval 'sub NAMEI_ISWHITEOUT () {0x20000;}' unless defined(&NAMEI_ISWHITEOUT);
    eval 'sub NAMEI_DOWHITEOUT () {0x40000;}' unless defined(&NAMEI_DOWHITEOUT);
    eval 'sub NAMEI_REQUIREDIR () {0x80000;}' unless defined(&NAMEI_REQUIREDIR);
    eval 'sub NAMEI_CREATEDIR () {0x200000;}' unless defined(&NAMEI_CREATEDIR);
    eval 'sub NAMEI_PARAMASK () {0x2ff800;}' unless defined(&NAMEI_PARAMASK);
}
1;
