summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1996-06-21 12:49:57 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1996-06-21 12:49:57 +0000
commit2b0fa1e8763048fedcabf1ab01ab53ae49e8e1b3 (patch)
tree6f6b80e871fef9607cc2919d1e8893defa0afe2c
parentdd8213bee95d29c39197672abd0dcae47e562a6c (diff)
use <sys/queue.h> for pfsnode list.
$OpenBSD$ additions.
-rw-r--r--sys/miscfs/procfs/procfs.h4
-rw-r--r--sys/miscfs/procfs/procfs_fpregs.c1
-rw-r--r--sys/miscfs/procfs/procfs_note.c1
-rw-r--r--sys/miscfs/procfs/procfs_regs.c1
-rw-r--r--sys/miscfs/procfs/procfs_subr.c25
-rw-r--r--sys/miscfs/procfs/procfs_vfsops.c7
6 files changed, 17 insertions, 22 deletions
diff --git a/sys/miscfs/procfs/procfs.h b/sys/miscfs/procfs/procfs.h
index 2c48bb225ec..3a69cf3fd25 100644
--- a/sys/miscfs/procfs/procfs.h
+++ b/sys/miscfs/procfs/procfs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: procfs.h,v 1.2 1996/02/27 08:03:34 niklas Exp $ */
+/* $OpenBSD: procfs.h,v 1.3 1996/06/21 12:49:54 mickey Exp $ */
/* $NetBSD: procfs.h,v 1.17 1996/02/12 15:01:41 christos Exp $ */
/*
@@ -61,7 +61,7 @@ typedef enum {
* control data for the proc file system.
*/
struct pfsnode {
- struct pfsnode *pfs_next; /* next on list */
+ TAILQ_ENTRY(pfsnode) list;
struct vnode *pfs_vnode; /* vnode associated with this pfsnode */
pfstype pfs_type; /* type of procfs node */
pid_t pfs_pid; /* associated process */
diff --git a/sys/miscfs/procfs/procfs_fpregs.c b/sys/miscfs/procfs/procfs_fpregs.c
index 2ec7f0a5f97..18fcef4885c 100644
--- a/sys/miscfs/procfs/procfs_fpregs.c
+++ b/sys/miscfs/procfs/procfs_fpregs.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: procfs_fpregs.c,v 1.2 1996/06/21 12:49:54 mickey Exp $ */
/* $NetBSD: procfs_fpregs.c,v 1.4 1995/08/13 09:06:05 mycroft Exp $ */
/*
diff --git a/sys/miscfs/procfs/procfs_note.c b/sys/miscfs/procfs/procfs_note.c
index a57dda9ae56..2ad53939b03 100644
--- a/sys/miscfs/procfs/procfs_note.c
+++ b/sys/miscfs/procfs/procfs_note.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: procfs_note.c,v 1.2 1996/06/21 12:49:55 mickey Exp $ */
/* $NetBSD: procfs_note.c,v 1.8 1994/06/29 06:34:53 cgd Exp $ */
/*
diff --git a/sys/miscfs/procfs/procfs_regs.c b/sys/miscfs/procfs/procfs_regs.c
index 5d6f8929787..fcf8a90ed48 100644
--- a/sys/miscfs/procfs/procfs_regs.c
+++ b/sys/miscfs/procfs/procfs_regs.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: procfs_regs.c,v 1.2 1996/06/21 12:49:55 mickey Exp $ */
/* $NetBSD: procfs_regs.c,v 1.9 1995/08/13 09:06:07 mycroft Exp $ */
/*
diff --git a/sys/miscfs/procfs/procfs_subr.c b/sys/miscfs/procfs/procfs_subr.c
index a1eb3e48039..26484b7584c 100644
--- a/sys/miscfs/procfs/procfs_subr.c
+++ b/sys/miscfs/procfs/procfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: procfs_subr.c,v 1.2 1996/02/27 08:03:37 niklas Exp $ */
+/* $OpenBSD: procfs_subr.c,v 1.3 1996/06/21 12:49:56 mickey Exp $ */
/* $NetBSD: procfs_subr.c,v 1.15 1996/02/12 15:01:42 christos Exp $ */
/*
@@ -49,9 +49,15 @@
#include <sys/malloc.h>
#include <miscfs/procfs/procfs.h>
-static struct pfsnode *pfshead;
+static TAILQ_HEAD(, pfsnode) pfshead;
static int pfsvplock;
+void
+procfs_init(void)
+{
+ TAILQ_INIT(&pfshead);
+}
+
/*
* allocate a pfsnode/vnode pair. the vnode is
* referenced, but not locked.
@@ -91,7 +97,7 @@ procfs_allocvp(mp, vpp, pid, pfs_type)
int error;
loop:
- for (pfs = pfshead; pfs != 0; pfs = pfs->pfs_next) {
+ for (pfs = pfshead.tqh_first; pfs != NULL; pfs = pfs->list.tqe_next) {
vp = PFSTOV(pfs);
if (pfs->pfs_pid == pid &&
pfs->pfs_type == pfs_type &&
@@ -121,7 +127,6 @@ loop:
MALLOC(pfs, void *, sizeof(struct pfsnode), M_TEMP, M_WAITOK);
vp->v_data = pfs;
- pfs->pfs_next = 0;
pfs->pfs_pid = (pid_t) pid;
pfs->pfs_type = pfs_type;
pfs->pfs_vnode = vp;
@@ -178,9 +183,7 @@ loop:
}
/* add to procfs vnode list */
- for (pp = &pfshead; *pp; pp = &(*pp)->pfs_next)
- continue;
- *pp = pfs;
+ TAILQ_INSERT_TAIL(&pfshead, pfs, list);
out:
pfsvplock &= ~PROCFS_LOCKED;
@@ -200,13 +203,7 @@ procfs_freevp(vp)
struct pfsnode **pfspp;
struct pfsnode *pfs = VTOPFS(vp);
- for (pfspp = &pfshead; *pfspp != 0; pfspp = &(*pfspp)->pfs_next) {
- if (*pfspp == pfs) {
- *pfspp = pfs->pfs_next;
- break;
- }
- }
-
+ TAILQ_REMOVE(&pfshead, pfs, list);
FREE(vp->v_data, M_TEMP);
vp->v_data = 0;
return (0);
diff --git a/sys/miscfs/procfs/procfs_vfsops.c b/sys/miscfs/procfs/procfs_vfsops.c
index c2856901ab5..bc8af044c41 100644
--- a/sys/miscfs/procfs/procfs_vfsops.c
+++ b/sys/miscfs/procfs/procfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: procfs_vfsops.c,v 1.3 1996/06/20 15:12:57 mickey Exp $ */
+/* $OpenBSD: procfs_vfsops.c,v 1.4 1996/06/21 12:49:56 mickey Exp $ */
/* $NetBSD: procfs_vfsops.c,v 1.25 1996/02/09 22:40:53 christos Exp $ */
/*
@@ -243,11 +243,6 @@ procfs_vptofh(vp, fhp)
return (EINVAL);
}
-void
-procfs_init()
-{
-}
-
struct vfsops procfs_vfsops = {
MOUNT_PROCFS,
procfs_mount,