PERFORCE change 162355 for review

Zhao Shuai zhaoshuai at FreeBSD.org
Wed May 20 08:00:34 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=162355

Change 162355 by zhaoshuai at zhaoshuai on 2009/05/20 08:00:11

	Yes, it works!

Affected files ...

.. //depot/projects/soc2009/fifo/sys/fs/fifofs/fifo_vnops.c#5 edit
.. //depot/projects/soc2009/fifo/sys/kern/sys_pipe.c#3 edit
.. //depot/projects/soc2009/fifo/sys/sys/pipe.h#3 edit

Differences ...

==== //depot/projects/soc2009/fifo/sys/fs/fifofs/fifo_vnops.c#5 (text+ko) ====

@@ -46,25 +46,25 @@
 #include <sys/pipe.h>
 #include <fs/fifofs/fifo.h>
 
-static fo_rdwr_t		fifo_read_f;
-static fo_rdwr_t		fifo_write_f;
-static fo_ioctl_t		fifo_ioctl_f;
-static fo_poll_t		fifo_poll_f;
+static fo_rdwr_t	fifo_read_f;
+static fo_rdwr_t	fifo_write_f;
+static fo_ioctl_t	fifo_ioctl_f;
+static fo_poll_t	fifo_poll_f;
 static fo_kqfilter_t	fifo_kqfilter_f;
-static fo_stat_t		fifo_stat_f;
-static fo_close_t		fifo_close_f;
+static fo_stat_t	fifo_stat_f;
+static fo_close_t	fifo_close_f;
 static fo_truncate_t	fifo_truncate_f;
 
 struct fileops fifo_ops_f = {
-	.fo_read =		fifo_read_f,
-	.fo_write =		fifo_write_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_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
+	.fo_stat =	fifo_stat_f,
+	.fo_close =	fifo_close_f,
+	.fo_flags =	DFLAG_PASSABLE
 };
 
 /*
@@ -72,9 +72,9 @@
  * the state associated with the FIFO.
  */
 struct fifoinfo {
-	struct pipepair	*fi_pp;
-	long		fi_readers;
-	long		fi_writers;
+	struct	pipepair *fi_pp;
+	long	fi_readers;
+	long	fi_writers;
 };
 
 static vop_print_t	fifo_print;
@@ -92,13 +92,13 @@
 	.vop_getattr =		VOP_EBADF,
 	.vop_ioctl =		VOP_PANIC,
 	.vop_kqfilter =		VOP_PANIC,
-	.vop_link =			VOP_PANIC,
+	.vop_link =		VOP_PANIC,
 	.vop_mkdir =		VOP_PANIC,
 	.vop_mknod =		VOP_PANIC,
-	.vop_open =			fifo_open,
+	.vop_open =		fifo_open,
 	.vop_pathconf =		fifo_pathconf,
 	.vop_print =		fifo_print,
-	.vop_read =			VOP_PANIC,
+	.vop_read =		VOP_PANIC,
 	.vop_readdir =		VOP_PANIC,
 	.vop_readlink =		VOP_PANIC,
 	.vop_reallocblks =	VOP_PANIC,
@@ -186,7 +186,10 @@
 	if (ap->a_fflag & FWRITE)
 		fip->fi_writers--;
 	if (fip->fi_readers == 0 && fip->fi_writers == 0) {
-
+		vp->v_fifoinfo = NULL;
+		pipeclose(&fip->fi_pp->pp_rpipe);
+		pipeclose(&fip->fi_pp->pp_wpipe);
+		free(fip, M_VNODE);
 	}
 	return (0);
 }

==== //depot/projects/soc2009/fifo/sys/kern/sys_pipe.c#3 (text+ko) ====

@@ -201,7 +201,9 @@
 	  &piperesizeallowed, 0, "Pipe resizing allowed");
 
 static void pipeinit(void *dummy __unused);
+/*
 static void pipeclose(struct pipe *cpipe);
+*/
 static void pipe_free_kmem(struct pipe *cpipe);
 static int pipe_create(struct pipe *pipe, int backing);
 static __inline int pipelock(struct pipe *cpipe, int catch);
@@ -1478,7 +1480,7 @@
 /*
  * shutdown the pipe
  */
-static void
+void
 pipeclose(cpipe)
 	struct pipe *cpipe;
 {

==== //depot/projects/soc2009/fifo/sys/sys/pipe.h#3 (text+ko) ====

@@ -143,9 +143,9 @@
  * The following functions are used by FIFO,
  * see fs/fifo_vnops.c
  */
-struct pipepair *pipepair_create(void);
-fo_rdwr_t pipe_read;
-fo_rdwr_t pipe_write;
-
+struct		pipepair *pipepair_create(void);
+fo_rdwr_t	pipe_read;
+fo_rdwr_t	pipe_write;
+void		pipeclose(struct pipe *);
 
 #endif /* !_SYS_PIPE_H_ */


More information about the p4-projects mailing list