From 69c9b29c29a4df762e3f815a2c1d4e343d05d8a2 Mon Sep 17 00:00:00 2001 From: des Date: Thu, 6 Jun 2002 16:59:24 +0000 Subject: Gratuitous whitespace cleanup. --- sys/fs/pseudofs/pseudofs.c | 34 +++++++------- sys/fs/pseudofs/pseudofs.h | 18 ++++---- sys/fs/pseudofs/pseudofs_fileno.c | 24 +++++----- sys/fs/pseudofs/pseudofs_vncache.c | 6 +-- sys/fs/pseudofs/pseudofs_vnops.c | 94 +++++++++++++++++++------------------- 5 files changed, 88 insertions(+), 88 deletions(-) (limited to 'sys') diff --git a/sys/fs/pseudofs/pseudofs.c b/sys/fs/pseudofs/pseudofs.c index 538b233..a940012 100644 --- a/sys/fs/pseudofs/pseudofs.c +++ b/sys/fs/pseudofs/pseudofs.c @@ -69,14 +69,14 @@ _pfs_add_node(struct pfs_node *parent, struct pfs_node *node) ("%s(): parent is not a directory", __func__)); /* XXX should check for duplicate names etc. */ - + mtx_lock(&parent->pn_info->pi_mutex); node->pn_info = parent->pn_info; node->pn_parent = parent; node->pn_next = parent->pn_nodes; parent->pn_nodes = node; mtx_unlock(&parent->pn_info->pi_mutex); - + return (0); } @@ -87,22 +87,22 @@ static int _pfs_fixup_dir(struct pfs_node *parent) { struct pfs_node *dir; - + MALLOC(dir, struct pfs_node *, sizeof *dir, M_PFSNODES, M_WAITOK|M_ZERO); dir->pn_name[0] = '.'; dir->pn_type = pfstype_this; - + if (_pfs_add_node(parent, dir) != 0) { FREE(dir, M_PFSNODES); return (-1); } - + MALLOC(dir, struct pfs_node *, sizeof *dir, M_PFSNODES, M_WAITOK|M_ZERO); dir->pn_name[0] = dir->pn_name[1] = '.'; dir->pn_type = pfstype_parent; - + if (_pfs_add_node(parent, dir) != 0) { FREE(dir, M_PFSNODES); return (-1); @@ -140,7 +140,7 @@ pfs_create_dir(struct pfs_node *parent, char *name, pfs_destroy(dir); return (NULL); } - + return (dir); } @@ -149,7 +149,7 @@ pfs_create_dir(struct pfs_node *parent, char *name, */ struct pfs_node * pfs_create_file(struct pfs_node *parent, char *name, pfs_fill_t fill, - pfs_attr_t attr, pfs_vis_t vis, int flags) + pfs_attr_t attr, pfs_vis_t vis, int flags) { struct pfs_node *node; @@ -169,7 +169,7 @@ pfs_create_file(struct pfs_node *parent, char *name, pfs_fill_t fill, FREE(node, M_PFSNODES); return (NULL); } - + return (node); } @@ -178,7 +178,7 @@ pfs_create_file(struct pfs_node *parent, char *name, pfs_fill_t fill, */ struct pfs_node * pfs_create_link(struct pfs_node *parent, char *name, pfs_fill_t fill, - pfs_attr_t attr, pfs_vis_t vis, int flags) + pfs_attr_t attr, pfs_vis_t vis, int flags) { struct pfs_node *node; @@ -196,7 +196,7 @@ int pfs_destroy(struct pfs_node *node) { struct pfs_node *parent, *rover; - + KASSERT(node != NULL, ("%s(): node is NULL", __func__)); KASSERT(node->pn_info != NULL, @@ -244,10 +244,10 @@ pfs_mount(struct pfs_info *pi, struct mount *mp, struct nameidata *ndp, struct thread *td) { struct statfs *sbp; - + if (mp->mnt_flag & MNT_UPDATE) return (EOPNOTSUPP); - + mp->mnt_flag |= MNT_LOCAL; mp->mnt_data = (qaddr_t)pi; vfs_getnewfsid(mp); @@ -277,7 +277,7 @@ pfs_unmount(struct mount *mp, int mntflags, struct thread *td) pi = (struct pfs_info *)mp->mnt_data; /* XXX do stuff with pi... */ - + error = vflush(mp, 0, (mntflags & MNT_FORCE) ? FORCECLOSE : 0); return (error); } @@ -314,7 +314,7 @@ pfs_init(struct pfs_info *pi, struct vfsconf *vfc) int error; mtx_init(&pi->pi_mutex, "pseudofs", NULL, MTX_DEF); - + /* set up the root diretory */ MALLOC(root, struct pfs_node *, sizeof *root, M_PFSNODES, M_WAITOK|M_ZERO); @@ -335,7 +335,7 @@ pfs_init(struct pfs_info *pi, struct vfsconf *vfc) mtx_destroy(&pi->pi_mutex); return (error); } - + pfs_fileno_init(pi); if (bootverbose) printf("%s registered\n", pi->pi_name); @@ -349,7 +349,7 @@ int pfs_uninit(struct pfs_info *pi, struct vfsconf *vfc) { int error; - + pfs_fileno_uninit(pi); pfs_destroy(pi->pi_root); pi->pi_root = NULL; diff --git a/sys/fs/pseudofs/pseudofs.h b/sys/fs/pseudofs/pseudofs.h index 6569e2c..69044d0 100644 --- a/sys/fs/pseudofs/pseudofs.h +++ b/sys/fs/pseudofs/pseudofs.h @@ -187,7 +187,7 @@ struct pfs_node { pfs_getextattr_t pn_getextattr; void *pn_data; int pn_flags; - + struct pfs_info *pn_info; struct pfs_node *pn_parent; struct pfs_node *pn_next; @@ -197,15 +197,15 @@ struct pfs_node { /* * VFS interface */ -int pfs_mount (struct pfs_info *pi, struct mount *mp, +int pfs_mount (struct pfs_info *pi, struct mount *mp, struct nameidata *ndp, struct thread *td); -int pfs_unmount (struct mount *mp, int mntflags, +int pfs_unmount (struct mount *mp, int mntflags, struct thread *td); int pfs_root (struct mount *mp, struct vnode **vpp); -int pfs_statfs (struct mount *mp, struct statfs *sbp, +int pfs_statfs (struct mount *mp, struct statfs *sbp, struct thread *td); -int pfs_init (struct pfs_info *pi, struct vfsconf *vfc); -int pfs_uninit (struct pfs_info *pi, struct vfsconf *vfc); +int pfs_init (struct pfs_info *pi, struct vfsconf *vfc); +int pfs_uninit (struct pfs_info *pi, struct vfsconf *vfc); /* * Directory structure construction and manipulation @@ -236,17 +236,17 @@ static struct pfs_info name##_info = { \ static int \ _##name##_mount(struct mount *mp, struct nameidata *ndp, \ struct thread *td) { \ - return pfs_mount(&name##_info, mp, ndp, td); \ + return pfs_mount(&name##_info, mp, ndp, td); \ } \ \ static int \ _##name##_init(struct vfsconf *vfc) { \ - return pfs_init(&name##_info, vfc); \ + return pfs_init(&name##_info, vfc); \ } \ \ static int \ _##name##_uninit(struct vfsconf *vfc) { \ - return pfs_uninit(&name##_info, vfc); \ + return pfs_uninit(&name##_info, vfc); \ } \ \ static struct vfsops name##_vfsops = { \ diff --git a/sys/fs/pseudofs/pseudofs_fileno.c b/sys/fs/pseudofs/pseudofs_fileno.c index 223ca9b..4341e23 100644 --- a/sys/fs/pseudofs/pseudofs_fileno.c +++ b/sys/fs/pseudofs/pseudofs_fileno.c @@ -80,12 +80,12 @@ void pfs_fileno_init(struct pfs_info *pi) { struct pfs_bitmap *pb; - + MALLOC(pb, struct pfs_bitmap *, sizeof *pb, M_PFSFILENO, M_WAITOK|M_ZERO); mtx_lock(&pi->pi_mutex); - + pb->pb_bitmap[0] = 07; pb->pb_used = 3; pi->pi_bitmap = pb; @@ -102,12 +102,12 @@ pfs_fileno_uninit(struct pfs_info *pi) { struct pfs_bitmap *pb, *npb; int used; - + mtx_lock(&pi->pi_mutex); - + pb = pi->pi_bitmap; pi->pi_bitmap = NULL; - + mtx_unlock(&pi->pi_mutex); for (used = 0; pb; pb = npb) { @@ -134,7 +134,7 @@ pfs_get_fileno(struct pfs_info *pi) int i; mtx_lock(&pi->pi_mutex); - + /* look for the first page with free bits */ for (ppb = NULL, pb = pi->pi_bitmap; pb; ppb = pb, pb = pb->pb_next) if (pb->pb_used != PFS_BITMAP_BITS) @@ -157,7 +157,7 @@ pfs_get_fileno(struct pfs_info *pi) for (i = 0; i < PFS_BITMAP_SIZE; ++i) if (pb->pb_bitmap[i] != UINT_MAX) break; - + /* find the first available bit and flip it */ fileno = pb->pb_offset + i * PFS_SLOT_BITS; p = &pb->pb_bitmap[i]; @@ -168,9 +168,9 @@ pfs_get_fileno(struct pfs_info *pi) ("slot has free bits, yet doesn't")); *p |= (unsigned int)(1 << i); ++pb->pb_used; - + mtx_unlock(&pi->pi_mutex); - + return fileno; } @@ -185,7 +185,7 @@ pfs_free_fileno(struct pfs_info *pi, u_int32_t fileno) int i; mtx_lock(&pi->pi_mutex); - + /* find the right page */ for (pb = pi->pi_bitmap; pb && fileno >= PFS_BITMAP_BITS; @@ -215,7 +215,7 @@ pfs_fileno_alloc(struct pfs_info *pi, struct pfs_node *pn) /* make sure our parent has a file number */ if (pn->pn_parent && !pn->pn_parent->pn_fileno) pfs_fileno_alloc(pi, pn->pn_parent); - + switch (pn->pn_type) { case pfstype_root: case pfstype_dir: @@ -244,7 +244,7 @@ pfs_fileno_alloc(struct pfs_info *pi, struct pfs_node *pn) KASSERT(0, ("pfs_fileno_alloc() called for pfstype_none node")); break; - } + } #if 0 printf("pfs_fileno_alloc(): %s: ", pi->pi_name); diff --git a/sys/fs/pseudofs/pseudofs_vncache.c b/sys/fs/pseudofs/pseudofs_vncache.c index 62ba7e0..5f21d67 100644 --- a/sys/fs/pseudofs/pseudofs_vncache.c +++ b/sys/fs/pseudofs/pseudofs_vncache.c @@ -108,7 +108,7 @@ pfs_vncache_alloc(struct mount *mp, struct vnode **vpp, int error; /* - * See if the vnode is in the cache. + * See if the vnode is in the cache. * XXX linear search is not very efficient. */ mtx_lock(&pfs_vncache_mutex); @@ -183,7 +183,7 @@ pfs_vncache_free(struct vnode *vp) struct pfs_vdata *pvd; cache_purge(vp); - + mtx_lock(&pfs_vncache_mutex); pvd = (struct pfs_vdata *)vp->v_data; KASSERT(pvd != NULL, ("pfs_vncache_free(): no vnode data\n")); @@ -235,7 +235,7 @@ int pfs_disable(struct pfs_node *pn) { struct pfs_vdata *pvd, *prev; - + if (pn->pn_flags & PFS_DISABLED) return (0); mtx_lock(&pfs_vncache_mutex); diff --git a/sys/fs/pseudofs/pseudofs_vnops.c b/sys/fs/pseudofs/pseudofs_vnops.c index ac49ca0..1c3c847 100644 --- a/sys/fs/pseudofs/pseudofs_vnops.c +++ b/sys/fs/pseudofs/pseudofs_vnops.c @@ -75,13 +75,13 @@ pfs_visible(struct thread *td, struct pfs_node *pn, pid_t pid) { struct proc *proc; int r; - + PFS_TRACE(("%s (pid: %d, req: %d)", pn->pn_name, pid, td->td_proc->p_pid)); if (pn->pn_flags & PFS_DISABLED) PFS_RETURN (0); - + r = 1; if (pid != NO_PID) { if ((proc = pfind(pid)) == NULL) @@ -103,9 +103,9 @@ pfs_access(struct vop_access_args *va) struct vnode *vn = va->a_vp; struct vattr vattr; int error; - + PFS_TRACE((((struct pfs_vdata *)vn->v_data)->pvd_pn->pn_name)); - + error = VOP_GETATTR(vn, &vattr, va->a_cred, va->a_td); if (error) PFS_RETURN (error); @@ -139,12 +139,12 @@ pfs_close(struct vop_close_args *va) proc = pfind(pvd->pvd_pid); else proc = NULL; - + error = (pn->pn_close)(va->a_td, proc, pn); - + if (proc != NULL) PROC_UNLOCK(proc); - + PFS_RETURN (error); } @@ -162,7 +162,7 @@ pfs_getattr(struct vop_getattr_args *va) int error = 0; PFS_TRACE((pn->pn_name)); - + VATTR_NULL(vap); vap->va_type = vn->v_type; vap->va_fileid = pn->pn_fileno; @@ -202,7 +202,7 @@ pfs_getattr(struct vop_getattr_args *va) vap->va_uid = 0; vap->va_gid = 0; } - + PFS_RETURN (error); } @@ -219,20 +219,20 @@ pfs_ioctl(struct vop_ioctl_args *va) int error; PFS_TRACE(("%s: %lx", pn->pn_name, va->a_command)); - + if (vn->v_type != VREG) PFS_RETURN (EINVAL); if (pn->pn_ioctl == NULL) PFS_RETURN (ENOTTY); - + /* * This is necessary because either process' privileges may * have changed since the open() call. */ if (!pfs_visible(curthread, pn, pvd->pvd_pid)) PFS_RETURN (EIO); - + /* XXX duplicates bits of pfs_visible() */ if (pvd->pvd_pid != NO_PID) { if ((proc = pfind(pvd->pvd_pid)) == NULL) @@ -240,12 +240,12 @@ pfs_ioctl(struct vop_ioctl_args *va) _PHOLD(proc); PROC_UNLOCK(proc); } - + error = (pn->pn_ioctl)(curthread, proc, pn, va->a_command, va->a_data); if (proc != NULL) PRELE(proc); - + PFS_RETURN (error); } @@ -265,14 +265,14 @@ pfs_getextattr(struct vop_getextattr_args *va) if (pn->pn_getextattr == NULL) PFS_RETURN (EOPNOTSUPP); - + /* * This is necessary because either process' privileges may * have changed since the open() call. */ if (!pfs_visible(curthread, pn, pvd->pvd_pid)) PFS_RETURN (EIO); - + /* XXX duplicates bits of pfs_visible() */ if (pvd->pvd_pid != NO_PID) { if ((proc = pfind(pvd->pvd_pid)) == NULL) @@ -280,13 +280,13 @@ pfs_getextattr(struct vop_getextattr_args *va) _PHOLD(proc); PROC_UNLOCK(proc); } - + error = (pn->pn_getextattr)(curthread, proc, pn, va->a_attrnamespace, va->a_name, va->a_uio, va->a_size, va->a_cred); if (proc != NULL) PRELE(proc); - + PFS_RETURN (error); } @@ -316,10 +316,10 @@ pfs_lookup(struct vop_lookup_args *va) int error, i, namelen; PFS_TRACE(("%.*s", (int)cnp->cn_namelen, cnp->cn_nameptr)); - + if (vn->v_type != VDIR) PFS_RETURN (ENOTDIR); - + /* * Don't support DELETE or RENAME. CREATE is supported so * that O_CREAT will work, but the lookup will still fail if @@ -335,7 +335,7 @@ pfs_lookup(struct vop_lookup_args *va) /* check that parent directory is visisble... */ if (!pfs_visible(curthread, pd, pvd->pvd_pid)) PFS_RETURN (ENOENT); - + /* self */ namelen = cnp->cn_namelen; pname = cnp->cn_nameptr; @@ -383,7 +383,7 @@ pfs_lookup(struct vop_lookup_args *va) if (i == cnp->cn_namelen) goto got_pnode; } - + PFS_RETURN (ENOENT); got_pnode: if (pn != pd->pn_parent && !pn->pn_parent) @@ -418,15 +418,15 @@ pfs_open(struct vop_open_args *va) * check if the file is visible to the caller * * XXX Not sure if this is necessary, as the VFS system calls - * XXX pfs_lookup() and pfs_access() first, and pfs_lookup() - * XXX calls pfs_visible(). There's a race condition here, but + * XXX pfs_lookup() and pfs_access() first, and pfs_lookup() + * XXX calls pfs_visible(). There's a race condition here, but * XXX calling pfs_visible() from here doesn't really close it, * XXX and the only consequence of that race is an EIO further * XXX down the line. */ if (!pfs_visible(va->a_td, pn, pvd->pvd_pid)) PFS_RETURN (ENOENT); - + /* check if the requested mode is permitted */ if (((mode & FREAD) && !(mode & PFS_RD)) || ((mode & FWRITE) && !(mode & PFS_WR))) @@ -435,7 +435,7 @@ pfs_open(struct vop_open_args *va) /* we don't support locking */ if ((mode & O_SHLOCK) || (mode & O_EXLOCK)) PFS_RETURN (EOPNOTSUPP); - + PFS_RETURN (0); } @@ -455,7 +455,7 @@ pfs_read(struct vop_read_args *va) int error, xlen; PFS_TRACE((pn->pn_name)); - + if (vn->v_type != VREG) PFS_RETURN (EINVAL); @@ -464,14 +464,14 @@ pfs_read(struct vop_read_args *va) if (pn->pn_func == NULL) PFS_RETURN (EIO); - + /* * This is necessary because either process' privileges may * have changed since the open() call. */ if (!pfs_visible(curthread, pn, pvd->pvd_pid)) PFS_RETURN (EIO); - + /* XXX duplicates bits of pfs_visible() */ if (pvd->pvd_pid != NO_PID) { if ((proc = pfind(pvd->pvd_pid)) == NULL) @@ -486,7 +486,7 @@ pfs_read(struct vop_read_args *va) PRELE(proc); PFS_RETURN (error); } - + sb = sbuf_new(sb, NULL, uio->uio_offset + uio->uio_resid, 0); if (sb == NULL) { if (proc != NULL) @@ -503,7 +503,7 @@ pfs_read(struct vop_read_args *va) sbuf_delete(sb); PFS_RETURN (error); } - + /* XXX we should possibly detect and handle overflows */ sbuf_finish(sb); ps = sbuf_data(sb) + uio->uio_offset; @@ -519,7 +519,7 @@ pfs_read(struct vop_read_args *va) */ static int pfs_iterate(struct thread *td, pid_t pid, struct pfs_node *pd, - struct pfs_node **pn, struct proc **p) + struct pfs_node **pn, struct proc **p) { if ((*pn) == NULL) *pn = pd->pn_nodes; @@ -527,7 +527,7 @@ pfs_iterate(struct thread *td, pid_t pid, struct pfs_node *pd, again: if ((*pn)->pn_type != pfstype_procdir) *pn = (*pn)->pn_next; - + while (*pn != NULL && (*pn)->pn_type == pfstype_procdir) { if (*p == NULL) *p = LIST_FIRST(&allproc); @@ -537,13 +537,13 @@ pfs_iterate(struct thread *td, pid_t pid, struct pfs_node *pd, break; *pn = (*pn)->pn_next; } - + if ((*pn) == NULL) return (-1); if (!pfs_visible(td, *pn, *p ? (*p)->p_pid : pid)) goto again; - + return (0); } @@ -566,7 +566,7 @@ pfs_readdir(struct vop_readdir_args *va) int error, i, resid; PFS_TRACE((pd->pn_name)); - + if (vn->v_type != VDIR) PFS_RETURN (ENOTDIR); uio = va->a_uio; @@ -574,7 +574,7 @@ pfs_readdir(struct vop_readdir_args *va) /* check if the directory is visible to the caller */ if (!pfs_visible(curthread, pd, pid)) PFS_RETURN (ENOENT); - + /* only allow reading entire entries */ offset = uio->uio_offset; resid = uio->uio_resid; @@ -589,7 +589,7 @@ pfs_readdir(struct vop_readdir_args *va) sx_sunlock(&allproc_lock); PFS_RETURN (0); } - + /* fill in entries */ entry.d_reclen = PFS_DELEN; while (pfs_iterate(curthread, pid, pd, &pn, &p) != -1 && resid > 0) { @@ -660,20 +660,20 @@ pfs_readlink(struct vop_readlink_args *va) int error, xlen; PFS_TRACE((pn->pn_name)); - + if (vn->v_type != VLNK) PFS_RETURN (EINVAL); if (pn->pn_func == NULL) PFS_RETURN (EIO); - + if (pvd->pvd_pid != NO_PID) { if ((proc = pfind(pvd->pvd_pid)) == NULL) PFS_RETURN (EIO); _PHOLD(proc); PROC_UNLOCK(proc); } - + /* sbuf_new() can't fail with a static buffer */ sbuf_new(&sb, buf, sizeof buf, 0); @@ -681,12 +681,12 @@ pfs_readlink(struct vop_readlink_args *va) if (proc != NULL) PRELE(proc); - + if (error) { sbuf_delete(&sb); PFS_RETURN (error); } - + /* XXX we should detect and handle overflows */ sbuf_finish(&sb); ps = sbuf_data(&sb) + uio->uio_offset; @@ -734,7 +734,7 @@ pfs_write(struct vop_read_args *va) int error; PFS_TRACE((pn->pn_name)); - + if (vn->v_type != VREG) PFS_RETURN (EINVAL); @@ -743,7 +743,7 @@ pfs_write(struct vop_read_args *va) if (pn->pn_func == NULL) PFS_RETURN (EIO); - + /* * This is necessary because either process' privileges may * have changed since the open() call. @@ -769,12 +769,12 @@ pfs_write(struct vop_read_args *va) sbuf_uionew(&sb, uio, &error); if (error) PFS_RETURN (error); - + error = (pn->pn_func)(curthread, proc, pn, &sb, uio); if (proc != NULL) PRELE(proc); - + sbuf_delete(&sb); PFS_RETURN (error); } -- cgit v1.1