17 |
|
|
18 |
#include "nova-intern.h" |
#include "nova-intern.h" |
19 |
#include "module.h" |
#include "module.h" |
20 |
#include "vfs.h" |
#include "io-vfs.h" |
21 |
|
|
22 |
static int |
static int |
23 |
vn_open (struct vnode *vp, int mode, struct ucred *ucred, struct proc *p) |
vn_open (struct vnode *vp, int mode, struct ucred *ucred) |
24 |
{ |
{ |
25 |
switch (vp->v_type) |
switch (vp->v_type) |
26 |
{ |
{ |
27 |
case VBLK: |
case VBLK: |
28 |
return (*bdevsw[major (vp->v_rdev)].d_open) (vp->v_rdev, mode, p); |
return (*bdevsw[major (vp->v_rdev)].d_open) (vp->v_rdev, mode, 0); |
29 |
|
case VCHR: |
30 |
|
return (*cdevsw[major (vp->v_rdev)].d_open) (vp->v_rdev, mode, 0); |
31 |
} |
} |
32 |
return EIO; |
return EIO; |
33 |
} |
} |
34 |
|
|
35 |
static int |
static int |
36 |
vn_access (struct vnode *vp, int mode, struct ucred *ucred, struct proc *p) |
vn_access (struct vnode *vp, int mode, struct ucred *ucred) |
37 |
{ |
{ |
38 |
return 0; |
return 0; |
39 |
} |
} |
40 |
|
|
41 |
/* Strategy function for the spec file system. */ |
/* Strategy function for the spec file system. */ |
42 |
static int |
int |
43 |
vn_strategy (struct vnode *vp, struct io_buf *bp) |
specfs_strategy (struct io_buf *bp) |
44 |
{ |
{ |
45 |
switch (vp->v_type) |
return (*bdevsw[major (bp->dev)].d_strategy) (bp->dev, bp, 0); |
|
{ |
|
|
case VBLK: |
|
|
return (*bdevsw[major (vp->v_rdev)].d_strategy) (vp->v_rdev, bp, 0); |
|
|
} |
|
|
return EIO; |
|
46 |
} |
} |
47 |
|
|
48 |
static int |
static int |
49 |
vn_read (struct vnode *vp, struct io_uio *uio, struct ucred *ucred) |
vn_read (struct vnode *vp, struct io_uio *uio, struct ucred *ucred) |
50 |
{ |
{ |
51 |
|
switch (vp->v_type) |
52 |
|
{ |
53 |
|
case VCHR: |
54 |
|
return (*cdevsw[major (vp->v_rdev)].d_read) (vp->v_rdev, uio, 0); |
55 |
|
} |
56 |
return EIO; |
return EIO; |
57 |
} |
} |
58 |
|
|
74 |
vn_open, |
vn_open, |
75 |
vn_access, |
vn_access, |
76 |
0, /* lookup */ |
0, /* lookup */ |
77 |
vn_strategy, |
specfs_strategy, |
78 |
vn_read, /* read */ |
vn_read, /* read */ |
79 |
vn_write |
vn_write |
80 |
}; |
}; |