%{ #include #include #include #include #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) #include #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,24) #include #endif #endif %} function svcfhfmt:string(svcfh:long) %{ struct svc_fh *fhp = (struct svc_fh *)(long) kread(&(THIS->svcfh)); struct knfsd_fh *fh = &fhp->fh_handle; struct dentry *dentry; char buf[MAXSTRINGLEN], *filename; int cc=0; sprintf(buf+cc, "fh_version %d fh_fsid_type %d ", fh->fh_version, fh->fh_fsid_type); cc = strlen(buf); if (fhp->fh_dentry) { dentry = (struct dentry *) kread(&(fhp->fh_dentry)); filename = (char *) dentry->d_name.name; sprintf(buf+cc, "fh_dentry %p (%s)\n", dentry, filename); } else { sprintf(buf+cc, "fh_dentry %p\n", fhp->fh_dentry); } cc = strlen(buf); sprintf(buf+cc, " %d: %08x %08x %08x %08x %08x %08x", fh->fh_size, fh->fh_base.fh_pad[0], fh->fh_base.fh_pad[1], fh->fh_base.fh_pad[2], fh->fh_base.fh_pad[3], fh->fh_base.fh_pad[4], fh->fh_base.fh_pad[5]); cc = strlen(buf); snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf); CATCH_DEREF_FAULT(); %} function cstate_pr:string(cptr:long) %{ struct nfsd4_compound_state *cstate = (struct nfsd4_compound_state *)(long) kread(&(THIS->cptr)); struct svc_fh *fhp = (struct svc_fh *)&cstate->current_fh; struct knfsd_fh *fh = &fhp->fh_handle; char buf[MAXSTRINGLEN]; int cc=0; sprintf(buf+cc, "fh_dentry %p, fh_version %d fh_auth_type %d fh_fsid_type %d\n", fhp->fh_dentry, fh->fh_version, fh->fh_auth_type, fh->fh_fsid_type); cc = strlen(buf); sprintf(buf+cc, " %d: %08x %08x %08x %08x %08x %08x", fh->fh_size, fh->fh_base.fh_pad[0], fh->fh_base.fh_pad[1], fh->fh_base.fh_pad[2], fh->fh_base.fh_pad[3], fh->fh_base.fh_pad[4], fh->fh_base.fh_pad[5]); cc = strlen(buf); snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf); CATCH_DEREF_FAULT(); %}