PERFORCE change 162212 for review
Zhao Shuai
zhaoshuai at FreeBSD.org
Sun May 17 13:07:17 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=162212
Change 162212 by zhaoshuai at zhaoshuai on 2009/05/17 13:06:25
first version of fifo_vnops that compiles, still incomplete
Affected files ...
.. //depot/projects/soc2009/fifo/sys/fs/fifofs/fifo_vnops.c#4 edit
Differences ...
==== //depot/projects/soc2009/fifo/sys/fs/fifofs/fifo_vnops.c#4 (text+ko) ====
@@ -44,6 +44,7 @@
#include <sys/unistd.h>
#include <sys/vnode.h>
#include <sys/pipe.h>
+#include <fs/fifofs/fifo.h>
static fo_rdwr_t fifo_read_f;
static fo_rdwr_t fifo_write_f;
@@ -55,14 +56,14 @@
static fo_truncate_t fifo_truncate_f;
struct fileops fifo_ops_f = {
- .fo_read = fifo_read_f;
- .fo_write = fifo_write_f;
- .fo_truncate = fifo_truncate_f;
- .fo_ioctl = fifo_ioctl_f;
- .fo_poll = fifo_poll_f;
- .fo_kqfilter = fifo_kqfilter_f;
- .fo_stat = fifo_stat_f;
- .fo_close = fifo_close_t;
+ .fo_read = fifo_read_f,
+ .fo_write = fifo_write_f,
+ .fo_truncate = fifo_truncate_f,
+ .fo_ioctl = fifo_ioctl_f,
+ .fo_poll = fifo_poll_f,
+ .fo_kqfilter = fifo_kqfilter_f,
+ .fo_stat = fifo_stat_f,
+ .fo_close = fifo_close_f,
.fo_flags = DFLAG_PASSABLE
};
@@ -83,15 +84,14 @@
static vop_advlock_t fifo_advlock;
struct vop_vector fifo_specops = {
- .vop_default = &default_vndeops.
+ .vop_default = &default_vnodeops,
.vop_access = VOP_EBADF,
.vop_advlock = fifo_advlock,
- .vop_close = fifo_close.
- .vop_create = VOP_PANIC.
+ .vop_close = fifo_close,
+ .vop_create = VOP_PANIC,
.vop_getattr = VOP_EBADF,
.vop_ioctl = VOP_PANIC,
.vop_kqfilter = VOP_PANIC,
- .vop_lease = VOP_NULL,
.vop_link = VOP_PANIC,
.vop_mkdir = VOP_PANIC,
.vop_mknod = VOP_PANIC,
@@ -128,8 +128,6 @@
{
struct vnode *vp = ap->a_vp;
struct fifoinfo *fip;
- struct thread *td = ap->a_td;
- struct ucred *cred = ap->a_cred;
struct file *fp = ap->a_fp;
struct pipepair *pp;
@@ -177,7 +175,7 @@
int a_fflag;
struct ucred *a_cred;
struct thread *a_td;
- } */ ap;
+ } */ *ap;
{
struct vnode *vp = ap->a_vp;
struct fifoinfo *fip = vp->v_fifoinfo;
@@ -194,15 +192,12 @@
}
/*
- * Print out the contents of a fifo vnode
+ * Print out internel contents of a fifo vnode
*/
-static int
-fifo_print(ap)
- struct vop_print_args /* {
- struct vnode *a_vp;
- } */ ap;
+int
+fifo_printinfo(struct vnode *vp)
{
- struct fifoinfo *fip = ap->a_vp->v_fifoinfo;
+ struct fifoinfo *fip = vp->v_fifoinfo;
if (fip == NULL) {
printf(", NULL v_fifoinfo");
@@ -210,6 +205,20 @@
}
printf(", fifo with %ld readers and %ld writers",
fip->fi_readers, fip->fi_writers);
+ return (0);
+}
+
+/*
+ * Print out the contents of a fifo vnode.
+ */
+static int
+fifo_print(ap)
+ struct vop_print_args /* {
+ struct vnode *a_vp;
+ } */ *ap;
+{
+ printf(" ");
+ fifo_printinfo(ap->a_vp);
printf("\n");
return (0);
}
@@ -241,7 +250,7 @@
int a_flags;
} */ *ap;
{
- return (ap->a_flags & F_FLOCK ? EOPNOTSUPPP : EINVAL);
+ return (ap->a_flags & F_FLOCK ? EOPNOTSUPP : EINVAL);
}
static int
@@ -249,7 +258,7 @@
{
int error;
struct fifoinfo *fip = fp->f_data;
- fp->f_data = &fip->fi_pp->rpipe;
+ fp->f_data = &fip->fi_pp->pp_rpipe;
error = pipe_read(fp, uio, cred, flags, td);
fp->f_data = fip;
@@ -261,7 +270,7 @@
{
int error;
struct fifoinfo *fip = fp->f_data;
- fp->f_data = &fip->fi_pp->wpipe;
+ fp->f_data = &fip->fi_pp->pp_wpipe;
error = pipe_write(fp, uio, cred, flags, td);
fp->f_data = fip;
More information about the p4-projects
mailing list