%{ #include #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) #include #endif %} function svc_export_dump:string(_exp:long) %{ struct svc_export *exp = (struct svc_export *)(long) kread(&(THIS->_exp)); struct dentry *dentry = NULL; struct vfsmount *mnt = NULL; char buf[MAXSTRINGLEN], *fname=NULL; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) struct path ex_path; #endif int cc=0; if (exp <= 0) { sprintf(buf+cc, "exp NULL"); } else { #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) sprintf(buf+cc, "exp %p path %s flg 0x%x fsid %d nflavors %d\n", exp, exp->ex_path > 0 ? exp->ex_path : NULL, exp->ex_flags, exp->ex_fsid, exp->ex_nflavors); cc = strlen(buf); dentry = (struct dentry *) (long) kread(&(exp->ex_dentry)); mnt = (struct vfsmount *) kread(&(exp->ex_mnt)); if (mnt && dentry) fname = d_path(dentry, mnt, buf, MAXSTRINGLEN); sprintf(buf+cc, " mnt %p dentry %p(%s)", exp->ex_mnt, exp->ex_dentry, fname > 0 ? fname : NULL); #else sprintf(buf+cc, "exp %p path %s flg 0x%x fsid %d nflavors %d\n", exp, exp->ex_pathname > 0 ? exp->ex_pathname : NULL, exp->ex_flags, exp->ex_fsid, exp->ex_nflavors); cc = strlen(buf); ex_path.dentry = (struct dentry *) (long) kread(&(exp->ex_path.dentry)); ex_path.mnt = (struct vfsmount *) kread(&(exp->ex_path.mnt)); if (ex_path.mnt && ex_path.dentry) fname = d_path(&ex_path, buf, MAXSTRINGLEN); sprintf(buf+cc, " mnt %p dentry %p(%s)", ex_path.mnt, ex_path.dentry, fname > 0 ? fname : NULL); #endif } snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf); CATCH_DEREF_FAULT(); %} function svc_export_flavors:string(_exp:long) %{ struct svc_export *exp = (struct svc_export *)(long) kread(&(THIS->_exp)); struct exp_flavor_info *end = exp->ex_flavors + exp->ex_nflavors; struct exp_flavor_info *f; char buf[MAXSTRINGLEN], *fname=NULL; int cc=0; if (exp <= 0) { sprintf(buf+cc, "exp NULL"); } else { sprintf(buf+cc, "ex_flavors[%d] ", exp->ex_nflavors); cc = strlen(buf); if (exp->ex_nflavors) { sprintf(buf+cc, "["); cc = strlen(buf); for (f = exp->ex_flavors; f < end; f++) { sprintf(buf+cc, "%d,", f->pseudoflavor); cc = strlen(buf); } sprintf(buf+cc, "]"); cc = strlen(buf); } } snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf); CATCH_DEREF_FAULT(); %}