1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
%{
#include <linux/fs.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
#include <linux/path.h>
#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();
%}
|