summaryrefslogtreecommitdiffstats
path: root/tapset/nfsd_fh.stp
blob: ef1d7a3ca2c894bb4c855dc8189dc4622e05099a (plain)
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
%{
#include <linux/fs.h>
#include <linux/sunrpc/svc.h>
#include <linux/nfsd/nfsfh.h>
#include <linux/nfsd/export.h>
#include <linux/nfsd/state.h>
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,24)
#include <linux/nfsd/xdr4.h>
#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();
%}