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
|
%{
#include <linux/nfs.h>
%}
function nfsfh:string(_nfsfh:long)
%{
struct nfs_fh *fh = (struct nfs_fh *)(long) kread(&(THIS->_nfsfh));
char buf[MAXSTRINGLEN], *str, octet[10];
int cc=0, i, j;
unsigned short ofs, len;
sprintf(buf+cc, "fh: %d: ", fh->size);
cc = strlen(buf);
str = buf+cc;
len = fh->size;
for (ofs = 0; ofs < len; ofs += 16) {
/*
sprintf(str, "%03d: ", ofs );
*/
for (i=0; i < 16; i++) {
if ((i + ofs) < len)
sprintf(octet, "%02x", fh->data[ofs + i]);
else
strcpy(octet, " ");
strcat(str, octet);
}
/*
strcat(str, " \n");
*/
j = strlen(str);
str += j;
}
snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf);
CATCH_DEREF_FAULT();
%}
|