- sprinkle const

- avoid shadowed variables.
This commit is contained in:
christos 2005-05-29 21:55:33 +00:00
parent 9864c6e2cf
commit c107ef9edc
10 changed files with 108 additions and 107 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fdesc_vfsops.c,v 1.54 2005/03/29 02:41:05 thorpej Exp $ */
/* $NetBSD: fdesc_vfsops.c,v 1.55 2005/05/29 21:55:33 christos Exp $ */
/*
* Copyright (c) 1992, 1993, 1995
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fdesc_vfsops.c,v 1.54 2005/03/29 02:41:05 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: fdesc_vfsops.c,v 1.55 2005/05/29 21:55:33 christos Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@ -135,7 +135,7 @@ fdesc_unmount(mp, mntflags, p)
{
int error;
int flags = 0;
struct vnode *rootvp = VFSTOFDESC(mp)->f_root;
struct vnode *rtvp = VFSTOFDESC(mp)->f_root;
if (mntflags & MNT_FORCE)
flags |= FORCECLOSE;
@ -145,19 +145,19 @@ fdesc_unmount(mp, mntflags, p)
* ever get anything cached at this level at the
* moment, but who knows...
*/
if (rootvp->v_usecount > 1)
if (rtvp->v_usecount > 1)
return (EBUSY);
if ((error = vflush(mp, rootvp, flags)) != 0)
if ((error = vflush(mp, rtvp, flags)) != 0)
return (error);
/*
* Release reference on underlying root vnode
*/
vrele(rootvp);
vrele(rtvp);
/*
* And blow it away for future re-use
*/
vgone(rootvp);
vgone(rtvp);
/*
* Finally, throw away the fdescmount structure
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: fdesc_vnops.c,v 1.83 2005/02/26 22:59:00 perry Exp $ */
/* $NetBSD: fdesc_vnops.c,v 1.84 2005/05/29 21:55:33 christos Exp $ */
/*
* Copyright (c) 1992, 1993
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fdesc_vnops.c,v 1.83 2005/02/26 22:59:00 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: fdesc_vnops.c,v 1.84 2005/05/29 21:55:33 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -287,11 +287,11 @@ fdesc_lookup(v)
struct componentname *cnp = ap->a_cnp;
struct proc *p = cnp->cn_proc;
const char *pname = cnp->cn_nameptr;
int nfiles = p->p_fd->fd_nfiles;
int numfiles = p->p_fd->fd_nfiles;
unsigned fd = 0;
int error;
struct vnode *fvp;
char *ln;
const char *ln;
if (cnp->cn_namelen == 1 && *pname == '.') {
*vpp = dvp;
@ -355,7 +355,8 @@ fdesc_lookup(v)
error = fdesc_allocvp(Flink, fd, dvp->v_mount, &fvp);
if (error)
goto bad;
VTOFDESC(fvp)->fd_link = ln;
/* XXXUNCONST */
VTOFDESC(fvp)->fd_link = __UNCONST(ln);
*vpp = fvp;
fvp->v_type = VLNK;
goto good;
@ -386,7 +387,7 @@ fdesc_lookup(v)
fd = 0;
while (*pname >= '0' && *pname <= '9') {
fd = 10 * fd + *pname++ - '0';
if (fd >= nfiles)
if (fd >= numfiles)
break;
}
@ -395,7 +396,7 @@ fdesc_lookup(v)
goto bad;
}
if (fd >= nfiles || p->p_fd->fd_ofiles[fd] == NULL ||
if (fd >= numfiles || p->p_fd->fd_ofiles[fd] == NULL ||
FILE_IS_USABLE(p->p_fd->fd_ofiles[fd]) == 0) {
error = EBADF;
goto bad;
@ -661,7 +662,7 @@ struct fdesc_target {
ino_t ft_fileno;
u_char ft_type;
u_char ft_namlen;
char *ft_name;
const char *ft_name;
} fdesc_targets[] = {
/* NOTE: The name must be less than UIO_MX-16 chars in length */
#define N(s) sizeof(s)-1, s

View File

@ -1,4 +1,4 @@
/* $NetBSD: genfs_vnops.c,v 1.96 2005/02/26 22:59:00 perry Exp $ */
/* $NetBSD: genfs_vnops.c,v 1.97 2005/05/29 21:55:33 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.96 2005/02/26 22:59:00 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.97 2005/05/29 21:55:33 christos Exp $");
#if defined(_KERNEL_OPT)
#include "opt_nfsserver.h"
@ -603,10 +603,10 @@ genfs_getpages(void *v)
*/
for (i = 0; i < npages; i++) {
struct vm_page *pg = pgs[ridx + i];
struct vm_page *pg1 = pgs[ridx + i];
if ((pg->flags & PG_FAKE) ||
(write && (pg->flags & PG_RDONLY))) {
if ((pg1->flags & PG_FAKE) ||
(write && (pg1->flags & PG_RDONLY))) {
break;
}
}
@ -625,9 +625,9 @@ genfs_getpages(void *v)
UVMHIST_LOG(ubchist, "PGO_OVERWRITE",0,0,0,0);
for (i = 0; i < npages; i++) {
struct vm_page *pg = pgs[ridx + i];
struct vm_page *pg1 = pgs[ridx + i];
pg->flags &= ~(PG_RDONLY|PG_CLEAN);
pg1->flags &= ~(PG_RDONLY|PG_CLEAN);
}
npages += ridx;
goto out;
@ -908,13 +908,13 @@ raout:
if (!error && !async && !write && ((int)raoffset & 0xffff) == 0 &&
PAGE_SHIFT <= 16) {
off_t rasize;
int rapages, err, i, skipped;
int rapages, err, j, skipped;
/* XXXUBC temp limit, from above */
rapages = MIN(MIN(1 << (16 - PAGE_SHIFT), MAX_READ_AHEAD),
genfs_rapages);
rasize = rapages << PAGE_SHIFT;
for (i = skipped = 0; i < genfs_racount; i++) {
for (j = skipped = 0; j < genfs_racount; j++) {
if (raoffset >= memeof)
break;
@ -1079,7 +1079,7 @@ genfs_putpages(void *v)
int i, s, error, npages, nback;
int freeflag;
struct vm_page *pgs[maxpages], *pg, *nextpg, *tpg, curmp, endmp;
boolean_t wasclean, by_list, needs_clean, yield;
boolean_t wasclean, by_list, needs_clean, yld;
boolean_t async = (flags & PGO_SYNCIO) == 0;
boolean_t pagedaemon = curproc == uvm.pagedaemon_proc;
struct lwp *l = curlwp ? curlwp : &lwp0;
@ -1177,9 +1177,9 @@ genfs_putpages(void *v)
* wait for it to become unbusy.
*/
yield = (l->l_cpu->ci_schedstate.spc_flags &
yld = (l->l_cpu->ci_schedstate.spc_flags &
SPCF_SHOULDYIELD) && !pagedaemon;
if (pg->flags & PG_BUSY || yield) {
if (pg->flags & PG_BUSY || yld) {
UVMHIST_LOG(ubchist, "busy %p", pg,0,0,0);
if (flags & PGO_BUSYFAIL && pg->flags & PG_BUSY) {
UVMHIST_LOG(ubchist, "busyfail %p", pg, 0,0,0);
@ -1192,7 +1192,7 @@ genfs_putpages(void *v)
UVMHIST_LOG(ubchist, "curmp next %p",
TAILQ_NEXT(&curmp, listq), 0,0,0);
}
if (yield) {
if (yld) {
simple_unlock(slock);
preempt(1);
simple_lock(slock);

View File

@ -1,4 +1,4 @@
/* $NetBSD: kernfs_vnops.c,v 1.108 2005/05/20 13:16:54 chs Exp $ */
/* $NetBSD: kernfs_vnops.c,v 1.109 2005/05/29 21:55:33 christos Exp $ */
/*
* Copyright (c) 1992, 1993
@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.108 2005/05/20 13:16:54 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.109 2005/05/29 21:55:33 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_ipsec.h"
@ -90,8 +90,8 @@ const struct kern_target kern_targets[] = {
{ DT_DIR, N("."), 0, KFSkern, VDIR, DIR_MODE },
{ DT_DIR, N(".."), 0, KFSroot, VDIR, DIR_MODE },
{ DT_REG, N("boottime"), &boottime.tv_sec, KFSint, VREG, READ_MODE },
/* XXX cast away const */
{ DT_REG, N("copyright"), (void *)copyright,
/* XXXUNCONST */
{ DT_REG, N("copyright"), __UNCONST(copyright),
KFSstring, VREG, READ_MODE },
{ DT_REG, N("hostname"), 0, KFShostname, VREG, WRITE_MODE },
{ DT_REG, N("hz"), &hz, KFSint, VREG, READ_MODE },
@ -109,8 +109,8 @@ const struct kern_target kern_targets[] = {
{ DT_BLK, N("rootdev"), &rootdev, KFSdevice, VBLK, READ_MODE },
{ DT_CHR, N("rrootdev"), &rrootdev, KFSdevice, VCHR, READ_MODE },
{ DT_REG, N("time"), 0, KFStime, VREG, READ_MODE },
/* XXX cast away const */
{ DT_REG, N("version"), (void *)version,
/* XXXUNCONST */
{ DT_REG, N("version"), __UNCONST(version),
KFSstring, VREG, READ_MODE },
};
const struct kern_target subdir_targets[] = {
@ -325,7 +325,7 @@ kernfs_try_fileop(kfstype type, kfsfileop fileop, void *v, int error)
}
int
kernfs_try_xwrite(kfstype type, const struct kernfs_node *kfs, char *buf,
kernfs_try_xwrite(kfstype type, const struct kernfs_node *kfs, char *bf,
size_t len, int error)
{
struct kernfs_fileop *kf, skf;
@ -334,7 +334,7 @@ kernfs_try_xwrite(kfstype type, const struct kernfs_node *kfs, char *buf,
skf.kf_fileop = KERNFS_XWRITE;
if ((kf = SPLAY_FIND(kfsfileoptree, &kfsfileoptree, &skf)))
if (kf->kf_xwrite)
return kf->kf_xwrite(kfs, buf, len);
return kf->kf_xwrite(kfs, bf, len);
return error;
}
@ -528,23 +528,23 @@ kernfs_xread(kfs, off, bufp, len, wrlen)
}
static int
kernfs_xwrite(kfs, buf, len)
kernfs_xwrite(kfs, bf, len)
const struct kernfs_node *kfs;
char *buf;
char *bf;
size_t len;
{
switch (kfs->kfs_type) {
case KFShostname:
if (buf[len-1] == '\n')
if (bf[len-1] == '\n')
--len;
memcpy(hostname, buf, len);
memcpy(hostname, bf, len);
hostname[len] = '\0';
hostnamelen = (size_t) len;
return (0);
default:
return kernfs_try_xwrite(kfs->kfs_type, kfs, buf, len, EIO);
return kernfs_try_xwrite(kfs->kfs_type, kfs, bf, len, EIO);
}
}
@ -816,7 +816,7 @@ kernfs_getattr(v)
struct kernfs_subdir *ks;
struct vattr *vap = ap->a_vap;
int error = 0;
char strbuf[KSTRING], *buf;
char strbuf[KSTRING], *bf;
size_t nread, total;
VATTR_NULL(vap);
@ -878,8 +878,8 @@ kernfs_getattr(v)
vap->va_nlink = 1;
total = 0;
do {
buf = strbuf;
error = kernfs_xread(kfs, total, &buf,
bf = strbuf;
error = kernfs_xread(kfs, total, &bf,
sizeof(strbuf), &nread);
total += nread;
} while (error == 0 && nread != 0);
@ -930,7 +930,7 @@ kernfs_read(v)
} */ *ap = v;
struct uio *uio = ap->a_uio;
struct kernfs_node *kfs = VTOKERN(ap->a_vp);
char strbuf[KSTRING], *buf;
char strbuf[KSTRING], *bf;
off_t off;
size_t len;
int error;
@ -939,9 +939,9 @@ kernfs_read(v)
return (EOPNOTSUPP);
off = uio->uio_offset;
buf = strbuf;
if ((error = kernfs_xread(kfs, off, &buf, sizeof(strbuf), &len)) == 0)
error = uiomove(buf, len, uio);
bf = strbuf;
if ((error = kernfs_xread(kfs, off, &bf, sizeof(strbuf), &len)) == 0)
error = uiomove(bf, len, uio);
return (error);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: portal_vfsops.c,v 1.50 2005/03/29 02:41:05 thorpej Exp $ */
/* $NetBSD: portal_vfsops.c,v 1.51 2005/05/29 21:55:34 christos Exp $ */
/*
* Copyright (c) 1992, 1993, 1995
@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: portal_vfsops.c,v 1.50 2005/03/29 02:41:05 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: portal_vfsops.c,v 1.51 2005/05/29 21:55:34 christos Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@ -181,7 +181,7 @@ portal_unmount(mp, mntflags, p)
int mntflags;
struct proc *p;
{
struct vnode *rootvp = VFSTOPORTAL(mp)->pm_root;
struct vnode *rtvp = VFSTOPORTAL(mp)->pm_root;
int error, flags = 0;
if (mntflags & MNT_FORCE)
@ -197,19 +197,19 @@ portal_unmount(mp, mntflags, p)
if (mntinvalbuf(mp, 1))
return (EBUSY);
#endif
if (rootvp->v_usecount > 1)
if (rtvp->v_usecount > 1)
return (EBUSY);
if ((error = vflush(mp, rootvp, flags)) != 0)
if ((error = vflush(mp, rtvp, flags)) != 0)
return (error);
/*
* Release reference on underlying root vnode
*/
vrele(rootvp);
vrele(rtvp);
/*
* And blow it away for future re-use
*/
vgone(rootvp);
vgone(rtvp);
/*
* Shutdown the socket. This will cause the select in the
* daemon to wake up, and then the accept will get ECONNABORTED

View File

@ -1,4 +1,4 @@
/* $NetBSD: procfs_linux.c,v 1.22 2005/03/01 04:39:59 christos Exp $ */
/* $NetBSD: procfs_linux.c,v 1.23 2005/05/29 21:55:34 christos Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: procfs_linux.c,v 1.22 2005/03/01 04:39:59 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: procfs_linux.c,v 1.23 2005/05/29 21:55:34 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -70,10 +70,10 @@ int
procfs_domeminfo(struct proc *curp, struct proc *p, struct pfsnode *pfs,
struct uio *uio)
{
char buf[512];
char bf[512];
int len;
len = snprintf(buf, sizeof buf,
len = snprintf(bf, sizeof bf,
" total: used: free: shared: buffers: cached:\n"
"Mem: %8lu %8lu %8lu %8lu %8lu %8lu\n"
"Swap: %8lu %8lu %8lu\n"
@ -104,7 +104,7 @@ procfs_domeminfo(struct proc *curp, struct proc *p, struct pfsnode *pfs,
if (len == 0)
return 0;
return (uiomove_frombuf(buf, len, uio));
return (uiomove_frombuf(bf, len, uio));
}
/*
@ -115,7 +115,7 @@ int
procfs_do_pid_stat(struct proc *curp, struct lwp *l, struct pfsnode *pfs,
struct uio *uio)
{
char buf[512];
char bf[512];
int len;
struct proc *p = l->l_proc;
struct tty *tty = p->p_session->s_ttyp;
@ -149,7 +149,7 @@ procfs_do_pid_stat(struct proc *curp, struct lwp *l, struct pfsnode *pfs,
if (map != &curproc->p_vmspace->vm_map)
vm_map_unlock_read(map);
len = snprintf(buf, sizeof(buf),
len = snprintf(bf, sizeof(bf),
"%d (%s) %c %d %d %d %d %d "
"%u "
"%lu %lu %lu %lu %lu %lu %lu %lu "
@ -210,7 +210,7 @@ procfs_do_pid_stat(struct proc *curp, struct lwp *l, struct pfsnode *pfs,
if (len == 0)
return 0;
return (uiomove_frombuf(buf, len, uio));
return (uiomove_frombuf(bf, len, uio));
}
int
@ -218,10 +218,10 @@ procfs_docpuinfo(struct proc *curp, struct proc *p, struct pfsnode *pfs,
struct uio *uio)
{
int len = 4096;
char *buf = malloc(len, M_TEMP, M_WAITOK);
char *bf = malloc(len, M_TEMP, M_WAITOK);
int error;
if (procfs_getcpuinfstr(buf, &len) < 0) {
if (procfs_getcpuinfstr(bf, &len) < 0) {
error = ENOSPC;
goto done;
}
@ -231,9 +231,9 @@ procfs_docpuinfo(struct proc *curp, struct proc *p, struct pfsnode *pfs,
goto done;
}
error = uiomove_frombuf(buf, len, uio);
error = uiomove_frombuf(bf, len, uio);
done:
free(buf, M_TEMP);
free(bf, M_TEMP);
return error;
}
@ -241,14 +241,14 @@ int
procfs_douptime(struct proc *curp, struct proc *p, struct pfsnode *pfs,
struct uio *uio)
{
char buf[512];
char bf[512];
int len;
struct timeval runtime;
u_int64_t idle;
timersub(&curcpu()->ci_schedstate.spc_runtime, &boottime, &runtime);
idle = curcpu()->ci_schedstate.spc_cp_time[CP_IDLE];
len = snprintf(buf, sizeof(buf),
len = snprintf(bf, sizeof(bf),
"%lu.%02lu %" PRIu64 ".%02" PRIu64 "\n",
runtime.tv_sec, runtime.tv_usec / 10000,
idle / hz, (((idle % hz) * 100) / hz) % 100);
@ -256,14 +256,14 @@ procfs_douptime(struct proc *curp, struct proc *p, struct pfsnode *pfs,
if (len == 0)
return 0;
return (uiomove_frombuf(buf, len, uio));
return (uiomove_frombuf(bf, len, uio));
}
int
procfs_domounts(struct proc *curp, struct proc *p, struct pfsnode *pfs,
struct uio *uio)
{
char buf[512], *mtab = NULL;
char bf[512], *mtab = NULL;
const char *fsname;
size_t len, mtabsz = 0;
struct mount *mp, *nmp;
@ -287,7 +287,7 @@ procfs_domounts(struct proc *curp, struct proc *p, struct pfsnode *pfs,
else if (strcmp(fsname, "ext2fs") == 0)
fsname = "ext2";
len = snprintf(buf, sizeof(buf), "%s %s %s %s%s%s%s%s%s 0 0\n",
len = snprintf(bf, sizeof(bf), "%s %s %s %s%s%s%s%s%s 0 0\n",
sfs->f_mntfromname,
sfs->f_mntonname,
fsname,
@ -300,7 +300,7 @@ procfs_domounts(struct proc *curp, struct proc *p, struct pfsnode *pfs,
);
mtab = realloc(mtab, mtabsz + len, M_TEMP, M_WAITOK);
memcpy(mtab + mtabsz, buf, len);
memcpy(mtab + mtabsz, bf, len);
mtabsz += len;
simple_lock(&mountlist_slock);

View File

@ -1,4 +1,4 @@
/* $NetBSD: procfs_status.c,v 1.24 2005/02/26 22:59:00 perry Exp $ */
/* $NetBSD: procfs_status.c,v 1.25 2005/05/29 21:55:34 christos Exp $ */
/*
* Copyright (c) 1993
@ -72,7 +72,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: procfs_status.c,v 1.24 2005/02/26 22:59:00 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: procfs_status.c,v 1.25 2005/05/29 21:55:34 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -98,7 +98,7 @@ procfs_dostatus(curp, l, pfs, uio)
struct ucred *cr;
struct proc *p = l->l_proc;
char *ps;
char *sep;
const char *sep;
int pid, ppid, pgid, sid;
u_int i;
char psbuf[256+MAXHOSTNAMELEN]; /* XXX - conservative */

View File

@ -1,4 +1,4 @@
/* $NetBSD: procfs_subr.c,v 1.63 2005/02/26 22:59:00 perry Exp $ */
/* $NetBSD: procfs_subr.c,v 1.64 2005/05/29 21:55:34 christos Exp $ */
/*
* Copyright (c) 1993
@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: procfs_subr.c,v 1.63 2005/02/26 22:59:00 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: procfs_subr.c,v 1.64 2005/05/29 21:55:34 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -377,7 +377,7 @@ procfs_rw(v)
}
/*
* Get a string from userland into (buf). Strip a trailing
* Get a string from userland into (bf). Strip a trailing
* nl character (to allow easy access from the shell).
* The buffer should be *buflenp + 1 chars long. vfs_getuserstr
* will automatically add a nul char at the end.
@ -389,9 +389,9 @@ procfs_rw(v)
* EFAULT: user i/o buffer is not addressable
*/
int
vfs_getuserstr(uio, buf, buflenp)
vfs_getuserstr(uio, bf, buflenp)
struct uio *uio;
char *buf;
char *bf;
int *buflenp;
{
int xlen;
@ -407,31 +407,31 @@ vfs_getuserstr(uio, buf, buflenp)
return (EMSGSIZE);
xlen = uio->uio_resid;
if ((error = uiomove(buf, xlen, uio)) != 0)
if ((error = uiomove(bf, xlen, uio)) != 0)
return (error);
/* allow multiple writes without seeks */
uio->uio_offset = 0;
/* cleanup string and remove trailing newline */
buf[xlen] = '\0';
xlen = strlen(buf);
if (xlen > 0 && buf[xlen-1] == '\n')
buf[--xlen] = '\0';
bf[xlen] = '\0';
xlen = strlen(bf);
if (xlen > 0 && bf[xlen-1] == '\n')
bf[--xlen] = '\0';
*buflenp = xlen;
return (0);
}
const vfs_namemap_t *
vfs_findname(nm, buf, buflen)
vfs_findname(nm, bf, buflen)
const vfs_namemap_t *nm;
const char *buf;
const char *bf;
int buflen;
{
for (; nm->nm_name; nm++)
if (memcmp(buf, nm->nm_name, buflen+1) == 0)
if (memcmp(bf, nm->nm_name, buflen+1) == 0)
return (nm);
return (0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: procfs_vnops.c,v 1.122 2005/04/02 06:15:09 christos Exp $ */
/* $NetBSD: procfs_vnops.c,v 1.123 2005/05/29 21:55:34 christos Exp $ */
/*
* Copyright (c) 1993, 1995
@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.122 2005/04/02 06:15:09 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.123 2005/05/29 21:55:34 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -612,12 +612,12 @@ procfs_getattr(v)
break;
case PFScurproc: {
char buf[16]; /* should be enough */
char bf[16]; /* should be enough */
vap->va_nlink = 1;
vap->va_uid = 0;
vap->va_gid = 0;
vap->va_bytes = vap->va_size =
snprintf(buf, sizeof(buf), "%ld", (long)curproc->p_pid);
snprintf(bf, sizeof(bf), "%ld", (long)curproc->p_pid);
break;
}
@ -1325,17 +1325,17 @@ procfs_readlink(v)
void *v;
{
struct vop_readlink_args *ap = v;
char buf[16]; /* should be enough */
char *bp = buf;
char bf[16]; /* should be enough */
char *bp = bf;
char *path = NULL;
int len;
int error = 0;
struct pfsnode *pfs = VTOPFS(ap->a_vp);
if (pfs->pfs_fileno == PROCFS_FILENO(0, PFScurproc, -1))
len = snprintf(buf, sizeof(buf), "%ld", (long)curproc->p_pid);
len = snprintf(bf, sizeof(bf), "%ld", (long)curproc->p_pid);
else if (pfs->pfs_fileno == PROCFS_FILENO(0, PFSself, -1))
len = snprintf(buf, sizeof(buf), "%s", "curproc");
len = snprintf(bf, sizeof(bf), "%s", "curproc");
else {
struct file *fp;
struct proc *pown;
@ -1372,11 +1372,11 @@ procfs_readlink(v)
break;
case DTYPE_MISC:
len = snprintf(buf, sizeof(buf), "%s", "[misc]");
len = snprintf(bf, sizeof(bf), "%s", "[misc]");
break;
case DTYPE_KQUEUE:
len = snprintf(buf, sizeof(buf), "%s", "[kqueue]");
len = snprintf(bf, sizeof(bf), "%s", "[kqueue]");
break;
default:

View File

@ -1,4 +1,4 @@
/* $NetBSD: umap_vfsops.c,v 1.52 2005/03/29 02:41:05 thorpej Exp $ */
/* $NetBSD: umap_vfsops.c,v 1.53 2005/05/29 21:55:34 christos Exp $ */
/*
* Copyright (c) 1992, 1993
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: umap_vfsops.c,v 1.52 2005/03/29 02:41:05 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: umap_vfsops.c,v 1.53 2005/05/29 21:55:34 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -246,7 +246,7 @@ umapfs_unmount(mp, mntflags, p)
int mntflags;
struct proc *p;
{
struct vnode *rootvp = MOUNTTOUMAPMOUNT(mp)->umapm_rootvp;
struct vnode *rtvp = MOUNTTOUMAPMOUNT(mp)->umapm_rootvp;
int error;
int flags = 0;
@ -267,22 +267,22 @@ umapfs_unmount(mp, mntflags, p)
if (mntinvalbuf(mp, 1))
return (EBUSY);
#endif
if (rootvp->v_usecount > 1)
if (rtvp->v_usecount > 1)
return (EBUSY);
if ((error = vflush(mp, rootvp, flags)) != 0)
if ((error = vflush(mp, rtvp, flags)) != 0)
return (error);
#ifdef UMAPFS_DIAGNOSTIC
vprint("alias root of lower", rootvp);
vprint("alias root of lower", rtvp);
#endif
/*
* Release reference on underlying root vnode
*/
vrele(rootvp);
vrele(rtvp);
/*
* And blow it away for future re-use
*/
vgone(rootvp);
vgone(rtvp);
/*
* Finally, throw away the umap_mount structure
*/