require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_SYS_LKM_H_)) {
    eval 'sub _SYS_LKM_H_ () {1;}' unless defined(&_SYS_LKM_H_);
    require 'sys/queue.ph';
    eval("sub LM_SYSCALL () { 0; }") unless defined(&LM_SYSCALL);
    eval("sub LM_VFS () { 1; }") unless defined(&LM_VFS);
    eval("sub LM_DEV () { 2; }") unless defined(&LM_DEV);
    eval("sub LM_EXEC () { 3; }") unless defined(&LM_EXEC);
    eval("sub LM_MISC () { 4; }") unless defined(&LM_MISC);
    eval 'sub LKM_OLDVERSION () {1;}' unless defined(&LKM_OLDVERSION);
    eval 'sub LKM_VERSION () {2;}' unless defined(&LKM_VERSION);
    eval 'sub MAXLKMNAME () {32;}' unless defined(&MAXLKMNAME);
    if(defined(&_KERNEL)) {
	eval("sub LM_DT_BLOCK () { 0; }") unless defined(&LM_DT_BLOCK);
	eval("sub LM_DT_CHAR () { 1; }") unless defined(&LM_DT_CHAR);
	eval 'sub LKM_E_LOAD () {1;}' unless defined(&LKM_E_LOAD);
	eval 'sub LKM_E_UNLOAD () {2;}' unless defined(&LKM_E_UNLOAD);
	eval 'sub LKM_E_STAT () {3;}' unless defined(&LKM_E_STAT);
	eval 'sub MOD_SYSCALL {
	    my($name,$callslot,$sysentp) = @_;
    	    eval q( &static \'struct lkm_syscall\'  &_module = {  &LM_SYSCALL,  &LKM_VERSION, $name, $callslot, $sysentp };);
	}' unless defined(&MOD_SYSCALL);
	eval 'sub MOD_VFS {
	    my($name,$vfsslot,$vfsconf) = @_;
    	    eval q( &static \'struct lkm_vfs\'  &_module = {  &LM_VFS,  &LKM_VERSION, $name, $vfsslot, $vfsconf };);
	}' unless defined(&MOD_VFS);
	eval 'sub MOD_DEV {
	    my($name,$devtype,$devslot,$devp) = @_;
    	    eval q( &static \'struct lkm_dev\'  &_module = {  &LM_DEV,  &LKM_VERSION, $name, $devslot, $devtype, {( &void *)$devp} };);
	}' unless defined(&MOD_DEV);
	eval 'sub MOD_EXEC {
	    my($name,$execslot,$execsw) = @_;
    	    eval q( &static \'struct lkm_exec\'  &_module = {  &LM_EXEC,  &LKM_VERSION, $name, $execslot, $execsw };);
	}' unless defined(&MOD_EXEC);
	eval 'sub MOD_MISC {
	    my($name) = @_;
    	    eval q( &static \'struct lkm_misc\'  &_module = {  &LM_MISC,  &LKM_VERSION, $name };);
	}' unless defined(&MOD_MISC);
	eval 'sub DISPATCH {
	    my($lkmtp,$cmd,$ver,$load,$unload,$stat) = @_;
    	    eval q( &if ($ver !=  &LKM_VERSION)  &return  &EINVAL;  &switch ($cmd) { \'int\'  &error;  &case  &LKM_E_LOAD:  ($lkmtp->{private}->{lkm_any}) = & &_module;  &if (( &error = $load($lkmtp, $cmd)) != 0)  &return  &error;  &break;  &case  &LKM_E_UNLOAD:  &if (( &error = $unload($lkmtp, $cmd)) != 0)  &return  &error;  &break;  &case  &LKM_E_STAT:  &if (( &error = $stat($lkmtp, $cmd)) != 0)  &return  &error;  &break; }  &return  &lkmdispatch($lkmtp, $cmd););
	}' unless defined(&DISPATCH);
    }
    eval 'sub LMRESERV_O () { &_IOWR(ord(\'K\'), 0, \'struct lmc_resrv\');}' unless defined(&LMRESERV_O);
    eval 'sub LMLOADBUF () { &_IOW(ord(\'K\'), 1, \'struct lmc_loadbuf\');}' unless defined(&LMLOADBUF);
    eval 'sub LMUNRESRV () { &_IO(ord(\'K\'), 2);}' unless defined(&LMUNRESRV);
    eval 'sub LMREADY () { &_IOW(ord(\'K\'), 3, \'u_long\');}' unless defined(&LMREADY);
    eval 'sub LMRESERV () { &_IOWR(ord(\'K\'), 4, \'struct lmc_resrv\');}' unless defined(&LMRESERV);
    eval 'sub LMLOAD () { &_IOW(ord(\'K\'), 9, \'struct lmc_load\');}' unless defined(&LMLOAD);
    eval 'sub LMUNLOAD () { &_IOWR(ord(\'K\'), 10, \'struct lmc_unload\');}' unless defined(&LMUNLOAD);
    eval 'sub LMSTAT () { &_IOWR(ord(\'K\'), 11, \'struct lmc_stat\');}' unless defined(&LMSTAT);
    eval 'sub LMLOADSYMS () { &_IOW(ord(\'K\'), 12, \'struct lmc_loadbuf\');}' unless defined(&LMLOADSYMS);
    eval 'sub MODIOBUF () {512;}' unless defined(&MODIOBUF);
}
1;
