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
|
%{
#include <linux/types.h>
#include <linux/sunrpc/svc.h>
#include <linux/sunrpc/cache.h>
static void hexdump(char *inbuf, const unsigned char *buf, unsigned short len )
{
static char str[80];
char octet[10];
int ofs, i, l, cc=0;
for (ofs = 0; ofs < len; ofs += 16) {
sprintf( str, "%03d: ", ofs );
for (i = 0; i < 16; i++) {
if ((i + ofs) < len)
sprintf( octet, "%02x ", buf[ofs + i] );
else
strcpy( octet, " " );
strcat( str, octet );
}
strcat( str, " " );
l = strlen( str );
for (i = 0; (i < 16) && ((i + ofs) < len); i++)
str[l++] = isprint( buf[ofs + i] ) ? buf[ofs + i] : '.';
str[l] = '\0';
sprintf(inbuf+cc, "%s\n", str );
cc = strlen(inbuf);
}
}
%}
function svc_creds:string(_rqstp:long)
%{
struct svc_rqst *rqstp =
(struct svc_rqst *)(long) kread(&(THIS->_rqstp));
struct kvec *rq_vec;
char buf[MAXSTRINGLEN];
int cc=0;
rq_vec = &rqstp->rq_arg.head[0];
sprintf(buf+cc, "cr_uid %d cr_gid %d", rqstp->rq_cred.cr_uid,
rqstp->rq_cred.cr_gid);
cc = strlen(buf);
snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf);
CATCH_DEREF_FAULT();
%}
function svc_rqst:string(_rqstp:long)
%{
struct svc_rqst *rqstp =
(struct svc_rqst *)(long) kread(&(THIS->_rqstp));
struct kvec *iov;
char buf[MAXSTRINGLEN];
int cc=0;
__be32 flavor;
iov = &rqstp->rq_arg.head[0];
memcpy(&flavor, iov->iov_base, sizeof(flavor));
sprintf(buf+cc, "iov_len %ld", iov->iov_len);
cc = strlen(buf);
/*
hexdump(buf+cc, iov->iov_base+sizeof(__be32), 64);
*/
snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf);
CATCH_DEREF_FAULT();
%}
|