require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_NFS_NFSM_SUBS_H_)) {
    eval 'sub _NFS_NFSM_SUBS_H_ () {1;}' unless defined(&_NFS_NFSM_SUBS_H_);
    eval 'sub nfsm_dissect {
        my($a, $c, $s) = @_;
	    eval q({  &t1 =  &mtod( ($info->{nmi_md}), \'caddr_t\') +  ($info->{nmi_md}->{m_len}) -  ($info->{nmi_dpos});  &if ( &t1 >= ($s)) { ($a) = ($c)( ($info->{nmi_dpos}));  ($info->{nmi_dpos}) += ($s); }  &else  &if (( &t1 =  &nfsm_disct( ($info->{nmi_md}),  ($info->{nmi_dpos}), ($s),  &t1,  &cp2)) != 0) {  &error =  &t1;  &m_freem( ($info->{nmi_mrep}));  &goto  &nfsmout; }  &else { ($a) = ($c) &cp2; } });
    }' unless defined(&nfsm_dissect);
    eval 'sub nfsm_srvpostop_fh {
        my($f) = @_;
	    eval q({  &tl =  &nfsm_build( ($info->{nmi_mb}), 2*  &NFSX_UNSIGNED +  &NFSX_V3FH); * &tl++ =  &nfs_true; * &tl++ =  &txdr_unsigned;  &bcopy(,  &tl,  &NFSX_V3FH); });
    }' unless defined(&nfsm_srvpostop_fh);
    eval 'sub nfsm_mtofh {
        my($d, $v, $v3, $f) = @_;
	    eval q({ \'struct nfsnode\' * &ttnp;  &nfsfh_t * &ttfhp; \'int\'  &ttfhsize;  &if ($v3) {  &nfsm_dissect( &tl,  &u_int32_t *,  &NFSX_UNSIGNED); ($f) =  &fxdr_unsigned(\'int\', * &tl); }  &else ($f) = 1;  &if ($f) {  &nfsm_getfh( &ttfhp,  &ttfhsize, ($v3));  &if (( &t1 =  &nfs_nget(($d)-> &v_mount,  &ttfhp,  &ttfhsize,  &ttnp)) != 0) {  &error =  &t1;  &m_freem( ($info->{nmi_mrep}));  &goto  &nfsmout; } ($v) =  &NFSTOV( &ttnp); }  &if ($v3) {  &nfsm_dissect( &tl,  &u_int32_t *,  &NFSX_UNSIGNED);  &if ($f) ($f) =  &fxdr_unsigned(\'int\', * &tl);  &else  &if ( &fxdr_unsigned(\'int\', * &tl))  &nfsm_adv( &NFSX_V3FATTR); }  &if ($f)  &nfsm_loadattr(($v),  &NULL); });
    }' unless defined(&nfsm_mtofh);
    eval 'sub nfsm_getfh {
        my($f, $s, $v3) = @_;
	    eval q({  &if ($v3) {  &nfsm_dissect( &tl,  &u_int32_t *,  &NFSX_UNSIGNED);  &if ((($s) =  &fxdr_unsigned(\'int\', * &tl)) <= 0|| ($s) >  &NFSX_V3FHMAX) {  &m_freem( ($info->{nmi_mrep}));  &error =  &EBADRPC;  &goto  &nfsmout; } }  &else ($s) =  &NFSX_V2FH;  &nfsm_dissect(($f),  &nfsfh_t *,  &nfsm_rndup($s)); });
    }' unless defined(&nfsm_getfh);
    eval 'sub nfsm_loadattr {
        my($v, $a) = @_;
	    eval q({ \'struct vnode\' * &ttvp = ($v);  &if (( &t1 =  &nfs_loadattrcache( &ttvp,  ($info->{nmi_md}),  ($info->{nmi_dpos}), ($a))) != 0) {  &error =  &t1;  &m_freem( ($info->{nmi_mrep}));  &goto  &nfsmout; } ($v) =  &ttvp; });
    }' unless defined(&nfsm_loadattr);
    eval 'sub nfsm_postop_attr {
        my($v, $f) = @_;
	    eval q({  &if ( ($info->{nmi_mrep}) !=  &NULL) { \'struct vnode\' * &ttvp = ($v);  &nfsm_dissect( &tl,  &u_int32_t *,  &NFSX_UNSIGNED);  &if ((($f) =  &fxdr_unsigned(\'int\', * &tl)) != 0) {  &if (( &t1 =  &nfs_loadattrcache( &ttvp,  ($info->{nmi_md}),  ($info->{nmi_dpos}),  &NULL)) != 0) {  &error =  &t1; ($f) = 0;  &m_freem( ($info->{nmi_mrep}));  &goto  &nfsmout; } ($v) =  &ttvp; } } });
    }' unless defined(&nfsm_postop_attr);
    eval 'sub NFSV3_WCCRATTR () {0;}' unless defined(&NFSV3_WCCRATTR);
    eval 'sub NFSV3_WCCCHK () {1;}' unless defined(&NFSV3_WCCCHK);
    eval 'sub nfsm_wcc_data {
        my($v, $f) = @_;
	    eval q( &do {  &if ( ($info->{nmi_mrep}) !=  &NULL) { \'struct timespec\'  &_mtime; \'int\'  &ttattrf,  &ttretf = 0;  &nfsm_dissect( &tl,  &u_int32_t *,  &NFSX_UNSIGNED);  &if (* &tl ==  &nfs_true) {  &nfsm_dissect( &tl,  &u_int32_t *, 6*  &NFSX_UNSIGNED);  &fxdr_nfsv3time( &tl + 2, & &_mtime);  &if ($f) {  &ttretf =  &timespeccmp( &VTONFS($v)-> &n_mtime, & &_mtime, !=); } }  &nfsm_postop_attr(($v),  &ttattrf);  &if ($f) { ($f) =  &ttretf; }  &else { ($f) =  &ttattrf; } } }  &while (0));
    }' unless defined(&nfsm_wcc_data);
    eval 'sub nfsm_strsiz {
        my($s,$m) = @_;
	    eval q({  &nfsm_dissect( &tl, &u_int32_t *, &NFSX_UNSIGNED);  &if ((($s) =  &fxdr_unsigned( &int32_t,* &tl)) > ($m)) {  &m_freem( ($info->{n$mi_mrep}));  &error =  &EBADRPC;  &goto  &nfsmout; } });
    }' unless defined(&nfsm_strsiz);
    eval 'sub nfsm_srvnamesiz {
        my($s) = @_;
	    eval q({  &nfsm_dissect( &tl, &u_int32_t *, &NFSX_UNSIGNED);  &if ((($s) =  &fxdr_unsigned( &int32_t,* &tl)) >  &NFS_MAXNAMLEN)  &error =  &NFSERR_NAMETOL;  &if (($s) <= 0)  &error =  &EBADRPC;  &if ( &error)  &nfsm_reply(0); });
    }' unless defined(&nfsm_srvnamesiz);
    eval 'sub nfsm_mtouio {
        my($p,$s) = @_;
	    eval q( &if (($s) > 0 && ( &t1 =  &nfsm_mbuftouio( ($info->{nmi_md}),($p),($s),  ($info->{nmi_dpos}))) != 0) {  &error =  &t1;  &m_freem( ($info->{nmi_mrep}));  &goto  &nfsmout; });
    }' unless defined(&nfsm_mtouio);
    eval 'sub nfsm_rndup {
        my($a) = @_;
	    eval q(((($a)+3)(~0x3)));
    }' unless defined(&nfsm_rndup);
    eval 'sub nfsm_strtom {
        my($a,$s,$m) = @_;
	    eval q( &if (($s) > ($m)) {  &m_freem( ($info->{n$mi_mreq}));  &error =  &ENAMETOOLONG;  &goto  &nfsmout; }  &nfsm_strtombuf( ($info->{n$mi_mb}), ($a), ($s)));
    }' unless defined(&nfsm_strtom);
    eval 'sub nfsm_reply {
        my($s) = @_;
	    eval q({  ($nfsd->{nd_repstat}) =  &error;  &if ( &error  && !( ($nfsd->{nd_flag}) &  &ND_NFSV3)) ( &void)  &nfs_rephead(0,  &nfsd,  &slp,  &error,  ($info->{nmi_mreq}),  ($info->{nmi_mb}));  &else ( &void)  &nfs_rephead(($s),  &nfsd,  &slp,  &error,  ($info->{nmi_mreq}),  ($info->{nmi_mb}));  &if ( ($info->{nmi_mrep}) !=  &NULL) {  &m_freem( ($info->{nmi_mrep}));  ($info->{nmi_mrep}) =  &NULL; } * &mrq =  ($info->{nmi_mreq});  &if ( &error  && (!( ($nfsd->{nd_flag}) &  &ND_NFSV3) ||  &error ==  &EBADRPC))  &return(0); });
    }' unless defined(&nfsm_reply);
    eval 'sub nfsm_writereply {
        my($s, $v3) = @_;
	    eval q({  ($nfsd->{nd_repstat}) =  &error;  &if ( &error  && !($v3)) ( &void)  &nfs_rephead(0,  &nfsd,  &slp,  &error,  ($info->{nmi_mreq}),  ($info->{nmi_mb}));  &else ( &void)  &nfs_rephead(($s),  &nfsd,  &slp,  &error,  ($info->{nmi_mreq}),  ($info->{nmi_mb})); });
    }' unless defined(&nfsm_writereply);
    eval 'sub nfsm_adv {
        my($s) = @_;
	    eval q({  &t1 =  &mtod( ($info->{nmi_md}), \'caddr_t\') +  ($info->{nmi_md}->{m_len}) -  ($info->{nmi_dpos});  &if ( &t1 >= ($s)) {  ($info->{nmi_dpos}) += ($s); }  &else  &if (( &t1 =  &nfs_adv( ($info->{nmi_md}),  ($info->{nmi_dpos}), ($s),  &t1)) != 0) {  &error =  &t1;  &m_freem( ($info->{nmi_mrep}));  &goto  &nfsmout; } });
    }' unless defined(&nfsm_adv);
    eval 'sub nfsm_srvmtofh {
        my($f) = @_;
	    eval q({  &if ( ($n$fsd->{nd_flag}) &  &ND_NFSV3) {  &nfsm_dissect( &tl,  &u_int32_t *,  &NFSX_UNSIGNED);  &if ( &fxdr_unsigned(\'int\', * &tl) !=  &NFSX_V3FH) {  &error =  &EBADRPC;  &nfsm_reply; } }  &nfsm_dissect( &tl,  &u_int32_t *,  &NFSX_V3FH);  &bcopy( &tl, ($f),  &NFSX_V3FH);  &if (( ($n$fsd->{nd_flag}) &  &ND_NFSV3) == 0)  &nfsm_adv( &NFSX_V2FH -  &NFSX_V3FH); });
    }' unless defined(&nfsm_srvmtofh);
}
1;
