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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
#include <u.h>
#include <libc.h>
#include <thread.h>
#include <sunrpc.h>
#include <nfs3.h>
#include <diskfs.h>
int allowall;
static Fsys *(*opentab[])(Disk*) =
{
fsysopenffs,
fsysopenhfs,
fsysopenkfs,
fsysopenext2,
fsysopenfat,
};
Fsys*
fsysopen(Disk *disk)
{
int i;
Fsys *fsys;
for(i=0; i<nelem(opentab); i++)
if((fsys = (*opentab[i])(disk)) != nil)
return fsys;
return nil;
}
Block*
fsysreadblock(Fsys *fsys, u64int blockno)
{
if(!fsys->_readblock){
werrstr("no read dispatch function");
return nil;
}
return (*fsys->_readblock)(fsys, blockno);
}
int
fsyssync(Fsys *fsys)
{
if(disksync(fsys->disk) < 0)
return -1;
if(!fsys->_sync)
return 0;
return (*fsys->_sync)(fsys);
}
void
fsysclose(Fsys *fsys)
{
if(!fsys->_close){
fprint(2, "no fsysClose\n");
abort();
}
(*fsys->_close)(fsys);
}
Nfs3Status
fsysroot(Fsys *fsys, Nfs3Handle *h)
{
if(!fsys->_root)
return Nfs3ErrNxio;
return (*fsys->_root)(fsys, h);
}
Nfs3Status
fsyslookup(Fsys *fsys, SunAuthUnix *au, Nfs3Handle *h, char *name, Nfs3Handle *nh)
{
if(!fsys->_lookup)
return Nfs3ErrNxio;
return (*fsys->_lookup)(fsys, au, h, name, nh);
}
Nfs3Status
fsysgetattr(Fsys *fsys, SunAuthUnix *au, Nfs3Handle *h, Nfs3Attr *attr)
{
if(!fsys->_getattr)
return Nfs3ErrNxio;
return (*fsys->_getattr)(fsys, au, h, attr);
}
Nfs3Status
fsysreaddir(Fsys *fsys, SunAuthUnix *au, Nfs3Handle *h, u32int count, u64int cookie, uchar **e, u32int *ne, u1int *peof)
{
if(!fsys->_readdir)
return Nfs3ErrNxio;
return (*fsys->_readdir)(fsys, au, h, count, cookie, e, ne, peof);
}
Nfs3Status
fsysreadfile(Fsys *fsys, SunAuthUnix *au, Nfs3Handle *h, u32int count, u64int offset, uchar **data, u32int *pcount, uchar *peof)
{
if(!fsys->_readfile)
return Nfs3ErrNxio;
return (*fsys->_readfile)(fsys, au, h, count, offset, data, pcount, peof);
}
Nfs3Status
fsysreadlink(Fsys *fsys, SunAuthUnix *au, Nfs3Handle *h, char **plink)
{
if(!fsys->_readlink)
return Nfs3ErrNxio;
return (*fsys->_readlink)(fsys, au, h, plink);
}
Nfs3Status
fsysaccess(Fsys *fsys, SunAuthUnix *au, Nfs3Handle *h, u32int want, u32int *got, Nfs3Attr *attr)
{
if(!fsys->_access)
return Nfs3ErrNxio;
return (*fsys->_access)(fsys, au, h, want, got, attr);
}
|