Module Name: src Committed By: matt Date: Fri Sep 5 05:57:21 UTC 2014
Modified Files: src/sys/kern: kern_descrip.c kern_event.c kern_lwp.c kern_module.c kern_mutex.c kern_rndsink.c kern_rwlock.c kern_sleepq.c subr_autoconf.c subr_devsw.c sys_descrip.c sys_pipe.c uipc_sem.c uipc_socket2.c uipc_usrreq.c vfs_bio.c vfs_dirhash.c vfs_subr.c vfs_trans.c vfs_vnode.c vfs_wapbl.c vfs_xattr.c Log Message: Don't next structure and enum definitions. Don't use C++ keywords new, try, class, private, etc. To generate a diff of this commit: cvs rdiff -u -r1.225 -r1.226 src/sys/kern/kern_descrip.c cvs rdiff -u -r1.80 -r1.81 src/sys/kern/kern_event.c cvs rdiff -u -r1.177 -r1.178 src/sys/kern/kern_lwp.c cvs rdiff -u -r1.99 -r1.100 src/sys/kern/kern_module.c cvs rdiff -u -r1.58 -r1.59 src/sys/kern/kern_mutex.c cvs rdiff -u -r1.8 -r1.9 src/sys/kern/kern_rndsink.c cvs rdiff -u -r1.43 -r1.44 src/sys/kern/kern_rwlock.c cvs rdiff -u -r1.49 -r1.50 src/sys/kern/kern_sleepq.c cvs rdiff -u -r1.231 -r1.232 src/sys/kern/subr_autoconf.c cvs rdiff -u -r1.32 -r1.33 src/sys/kern/subr_devsw.c cvs rdiff -u -r1.28 -r1.29 src/sys/kern/sys_descrip.c cvs rdiff -u -r1.138 -r1.139 src/sys/kern/sys_pipe.c cvs rdiff -u -r1.40 -r1.41 src/sys/kern/uipc_sem.c cvs rdiff -u -r1.120 -r1.121 src/sys/kern/uipc_socket2.c cvs rdiff -u -r1.169 -r1.170 src/sys/kern/uipc_usrreq.c cvs rdiff -u -r1.250 -r1.251 src/sys/kern/vfs_bio.c cvs rdiff -u -r1.11 -r1.12 src/sys/kern/vfs_dirhash.c cvs rdiff -u -r1.444 -r1.445 src/sys/kern/vfs_subr.c cvs rdiff -u -r1.30 -r1.31 src/sys/kern/vfs_trans.c cvs rdiff -u -r1.37 -r1.38 src/sys/kern/vfs_vnode.c cvs rdiff -u -r1.59 -r1.60 src/sys/kern/vfs_wapbl.c cvs rdiff -u -r1.31 -r1.32 src/sys/kern/vfs_xattr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/kern_descrip.c diff -u src/sys/kern/kern_descrip.c:1.225 src/sys/kern/kern_descrip.c:1.226 --- src/sys/kern/kern_descrip.c:1.225 Fri Jul 25 08:10:40 2014 +++ src/sys/kern/kern_descrip.c Fri Sep 5 05:57:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_descrip.c,v 1.225 2014/07/25 08:10:40 dholland Exp $ */ +/* $NetBSD: kern_descrip.c,v 1.226 2014/09/05 05:57:21 matt Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.225 2014/07/25 08:10:40 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.226 2014/09/05 05:57:21 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -741,7 +741,7 @@ fd_dup(file_t *fp, int minfd, int *newp, * dup2 operation. */ int -fd_dup2(file_t *fp, unsigned new, int flags) +fd_dup2(file_t *fp, unsigned newfd, int flags) { filedesc_t *fdp = curlwp->l_fd; fdfile_t *ff; @@ -753,7 +753,7 @@ fd_dup2(file_t *fp, unsigned new, int fl * Ensure there are enough slots in the descriptor table, * and allocate an fdfile_t up front in case we need it. */ - while (new >= fdp->fd_dt->dt_nfiles) { + while (newfd >= fdp->fd_dt->dt_nfiles) { fd_tryexpand(curproc); } ff = pool_cache_get(fdfile_cache, PR_WAITOK); @@ -764,10 +764,10 @@ fd_dup2(file_t *fp, unsigned new, int fl * XXX Potential for deadlock here? */ mutex_enter(&fdp->fd_lock); - while (fd_isused(fdp, new)) { + while (fd_isused(fdp, newfd)) { mutex_exit(&fdp->fd_lock); - if (fd_getfile(new) != NULL) { - (void)fd_close(new); + if (fd_getfile(newfd) != NULL) { + (void)fd_close(newfd); } else { /* * Crummy, but unlikely to happen. @@ -779,18 +779,18 @@ fd_dup2(file_t *fp, unsigned new, int fl mutex_enter(&fdp->fd_lock); } dt = fdp->fd_dt; - if (dt->dt_ff[new] == NULL) { - KASSERT(new >= NDFDFILE); - dt->dt_ff[new] = ff; + if (dt->dt_ff[newfd] == NULL) { + KASSERT(newfd >= NDFDFILE); + dt->dt_ff[newfd] = ff; ff = NULL; } - fd_used(fdp, new); + fd_used(fdp, newfd); mutex_exit(&fdp->fd_lock); - dt->dt_ff[new]->ff_exclose = (flags & O_CLOEXEC) != 0; + dt->dt_ff[newfd]->ff_exclose = (flags & O_CLOEXEC) != 0; fp->f_flag |= flags & FNONBLOCK; /* Slot is now allocated. Insert copy of the file. */ - fd_affix(curproc, fp, new); + fd_affix(curproc, fp, newfd); if (ff != NULL) { pool_cache_put(fdfile_cache, ff); } @@ -846,8 +846,8 @@ int fd_alloc(proc_t *p, int want, int *result) { filedesc_t *fdp = p->p_fd; - int i, lim, last, error; - u_int off, new; + int i, lim, last, error, hi; + u_int off; fdtab_t *dt; KASSERT(p == curproc || p == &proc0); @@ -866,21 +866,21 @@ fd_alloc(proc_t *p, int want, int *resul if ((i = want) < fdp->fd_freefile) i = fdp->fd_freefile; off = i >> NDENTRYSHIFT; - new = fd_next_zero(fdp, fdp->fd_himap, off, + hi = fd_next_zero(fdp, fdp->fd_himap, off, (last + NDENTRIES - 1) >> NDENTRYSHIFT); - if (new == -1) + if (hi == -1) break; - i = fd_next_zero(fdp, &fdp->fd_lomap[new], - new > off ? 0 : i & NDENTRYMASK, NDENTRIES); + i = fd_next_zero(fdp, &fdp->fd_lomap[hi], + hi > off ? 0 : i & NDENTRYMASK, NDENTRIES); if (i == -1) { /* * Free file descriptor in this block was * below want, try again with higher want. */ - want = (new + 1) << NDENTRYSHIFT; + want = (hi + 1) << NDENTRYSHIFT; continue; } - i += (new << NDENTRYSHIFT); + i += (hi << NDENTRYSHIFT); if (i >= last) { break; } @@ -1644,7 +1644,7 @@ filedescopen(dev_t dev, int mode, int ty * Duplicate the specified descriptor to a free descriptor. */ int -fd_dupopen(int old, int *new, int mode, int error) +fd_dupopen(int old, int *newp, int mode, int error) { filedesc_t *fdp; fdfile_t *ff; @@ -1682,12 +1682,12 @@ fd_dupopen(int old, int *new, int mode, } /* Copy it. */ - error = fd_dup(fp, 0, new, ff->ff_exclose); + error = fd_dup(fp, 0, newp, ff->ff_exclose); break; case EMOVEFD: /* Copy it. */ - error = fd_dup(fp, 0, new, ff->ff_exclose); + error = fd_dup(fp, 0, newp, ff->ff_exclose); if (error != 0) { break; } Index: src/sys/kern/kern_event.c diff -u src/sys/kern/kern_event.c:1.80 src/sys/kern/kern_event.c:1.81 --- src/sys/kern/kern_event.c:1.80 Tue Jun 24 14:42:43 2014 +++ src/sys/kern/kern_event.c Fri Sep 5 05:57:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_event.c,v 1.80 2014/06/24 14:42:43 maxv Exp $ */ +/* $NetBSD: kern_event.c,v 1.81 2014/09/05 05:57:21 matt Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -58,7 +58,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.80 2014/06/24 14:42:43 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.81 2014/09/05 05:57:21 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -775,7 +775,7 @@ sys_kqueue1(struct lwp *l, const struct * kevent(2) system call. */ int -kevent_fetch_changes(void *private, const struct kevent *changelist, +kevent_fetch_changes(void *ctx, const struct kevent *changelist, struct kevent *changes, size_t index, int n) { @@ -783,7 +783,7 @@ kevent_fetch_changes(void *private, cons } int -kevent_put_events(void *private, struct kevent *events, +kevent_put_events(void *ctx, struct kevent *events, struct kevent *eventlist, size_t index, int n) { Index: src/sys/kern/kern_lwp.c diff -u src/sys/kern/kern_lwp.c:1.177 src/sys/kern/kern_lwp.c:1.178 --- src/sys/kern/kern_lwp.c:1.177 Mon Nov 25 16:29:25 2013 +++ src/sys/kern/kern_lwp.c Fri Sep 5 05:57:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_lwp.c,v 1.177 2013/11/25 16:29:25 christos Exp $ */ +/* $NetBSD: kern_lwp.c,v 1.178 2014/09/05 05:57:21 matt Exp $ */ /*- * Copyright (c) 2001, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -211,7 +211,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.177 2013/11/25 16:29:25 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.178 2014/09/05 05:57:21 matt Exp $"); #include "opt_ddb.h" #include "opt_lockdebug.h" @@ -981,11 +981,11 @@ lwp_create(lwp_t *l1, proc_t *p2, vaddr_ * previous LWP, at splsched. */ void -lwp_startup(struct lwp *prev, struct lwp *new) +lwp_startup(struct lwp *prev, struct lwp *new_lwp) { - KASSERTMSG(new == curlwp, "l %p curlwp %p prevlwp %p", new, curlwp, prev); + KASSERTMSG(new_lwp == curlwp, "l %p curlwp %p prevlwp %p", new_lwp, curlwp, prev); - SDT_PROBE(proc,,,lwp_start, new, 0,0,0,0); + SDT_PROBE(proc,,,lwp_start, new_lwp, 0,0,0,0); KASSERT(kpreempt_disabled()); if (prev != NULL) { @@ -998,18 +998,18 @@ lwp_startup(struct lwp *prev, struct lwp membar_exit(); prev->l_ctxswtch = 0; } - KPREEMPT_DISABLE(new); + KPREEMPT_DISABLE(new_lwp); spl0(); - if (__predict_true(new->l_proc->p_vmspace)) - pmap_activate(new); + if (__predict_true(new_lwp->l_proc->p_vmspace)) + pmap_activate(new_lwp); /* Note trip through cpu_switchto(). */ pserialize_switchpoint(); LOCKDEBUG_BARRIER(NULL, 0); - KPREEMPT_ENABLE(new); - if ((new->l_pflag & LP_MPSAFE) == 0) { - KERNEL_LOCK(1, new); + KPREEMPT_ENABLE(new_lwp); + if ((new_lwp->l_pflag & LP_MPSAFE) == 0) { + KERNEL_LOCK(1, new_lwp); } } @@ -1446,13 +1446,13 @@ lwp_locked(struct lwp *l, kmutex_t *mtx) * Lend a new mutex to an LWP. The old mutex must be held. */ void -lwp_setlock(struct lwp *l, kmutex_t *new) +lwp_setlock(struct lwp *l, kmutex_t *mtx) { KASSERT(mutex_owned(l->l_mutex)); membar_exit(); - l->l_mutex = new; + l->l_mutex = mtx; } /* @@ -1460,7 +1460,7 @@ lwp_setlock(struct lwp *l, kmutex_t *new * must be held. */ void -lwp_unlock_to(struct lwp *l, kmutex_t *new) +lwp_unlock_to(struct lwp *l, kmutex_t *mtx) { kmutex_t *old; @@ -1468,7 +1468,7 @@ lwp_unlock_to(struct lwp *l, kmutex_t *n old = l->l_mutex; membar_exit(); - l->l_mutex = new; + l->l_mutex = mtx; mutex_spin_exit(old); } Index: src/sys/kern/kern_module.c diff -u src/sys/kern/kern_module.c:1.99 src/sys/kern/kern_module.c:1.100 --- src/sys/kern/kern_module.c:1.99 Sun Aug 24 11:36:11 2014 +++ src/sys/kern/kern_module.c Fri Sep 5 05:57:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_module.c,v 1.99 2014/08/24 11:36:11 nonaka Exp $ */ +/* $NetBSD: kern_module.c,v 1.100 2014/09/05 05:57:21 matt Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.99 2014/08/24 11:36:11 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.100 2014/09/05 05:57:21 matt Exp $"); #define _MODULE_INTERNAL @@ -91,7 +91,7 @@ __link_set_add_rodata(modules, module_du static module_t *module_newmodule(modsrc_t); static void module_require_force(module_t *); static int module_do_load(const char *, bool, int, prop_dictionary_t, - module_t **, modclass_t class, bool); + module_t **, modclass_t modclass, bool); static int module_do_unload(const char *, bool); static int module_do_builtin(const char *, module_t **, prop_dictionary_t); static int module_fetch_info(module_t *); @@ -105,14 +105,14 @@ static bool module_merge_dicts(prop_dict static void sysctl_module_setup(void); static int sysctl_module_autotime(SYSCTLFN_PROTO); -#define MODULE_CLASS_MATCH(mi, class) \ - ((class) == MODULE_CLASS_ANY || (class) == (mi)->mi_class) +#define MODULE_CLASS_MATCH(mi, modclass) \ + ((modclass) == MODULE_CLASS_ANY || (modclass) == (mi)->mi_class) static void -module_incompat(const modinfo_t *mi, int class) +module_incompat(const modinfo_t *mi, int modclass) { module_error("incompatible module class for `%s' (%d != %d)", - mi->mi_name, class, mi->mi_class); + mi->mi_name, modclass, mi->mi_class); } /* @@ -481,7 +481,7 @@ sysctl_module_setup(void) * specified class. */ void -module_init_class(modclass_t class) +module_init_class(modclass_t modclass) { TAILQ_HEAD(, module) bi_fail = TAILQ_HEAD_INITIALIZER(bi_fail); module_t *mod; @@ -495,7 +495,7 @@ module_init_class(modclass_t class) do { TAILQ_FOREACH(mod, &module_builtins, mod_chain) { mi = mod->mod_info; - if (!MODULE_CLASS_MATCH(mi, class)) + if (!MODULE_CLASS_MATCH(mi, modclass)) continue; /* * If initializing a builtin module fails, don't try @@ -506,7 +506,7 @@ module_init_class(modclass_t class) * (If the module has previously been set to * MODFLG_MUST_FORCE, don't try to override that!) */ - if (mod->mod_flags & MODFLG_MUST_FORCE || + if ((mod->mod_flags & MODFLG_MUST_FORCE) || module_do_builtin(mi->mi_name, NULL, NULL) != 0) { TAILQ_REMOVE(&module_builtins, mod, mod_chain); TAILQ_INSERT_TAIL(&bi_fail, mod, mod_chain); @@ -522,10 +522,10 @@ module_init_class(modclass_t class) do { TAILQ_FOREACH(mod, &module_bootlist, mod_chain) { mi = mod->mod_info; - if (!MODULE_CLASS_MATCH(mi, class)) + if (!MODULE_CLASS_MATCH(mi, modclass)) continue; module_do_load(mi->mi_name, false, 0, NULL, NULL, - class, false); + modclass, false); break; } } while (mod != NULL); @@ -566,7 +566,7 @@ module_compatible(int v1, int v2) */ int module_load(const char *filename, int flags, prop_dictionary_t props, - modclass_t class) + modclass_t modclass) { int error; @@ -578,7 +578,7 @@ module_load(const char *filename, int fl } kernconfig_lock(); - error = module_do_load(filename, false, flags, props, NULL, class, + error = module_do_load(filename, false, flags, props, NULL, modclass, false); kernconfig_unlock(); @@ -591,7 +591,7 @@ module_load(const char *filename, int fl * Load a single module from the file system, system initiated. */ int -module_autoload(const char *filename, modclass_t class) +module_autoload(const char *filename, modclass_t modclass) { int error; @@ -615,7 +615,7 @@ module_autoload(const char *filename, mo 0, (void *)(uintptr_t)MODCTL_LOAD, (void *)(uintptr_t)1, NULL); if (error == 0) - error = module_do_load(filename, false, 0, NULL, NULL, class, + error = module_do_load(filename, false, 0, NULL, NULL, modclass, true); kernconfig_unlock(); @@ -853,7 +853,7 @@ module_do_builtin(const char *name, modu */ static int module_do_load(const char *name, bool isdep, int flags, - prop_dictionary_t props, module_t **modp, modclass_t class, + prop_dictionary_t props, module_t **modp, modclass_t modclass, bool autoload) { #define MODULE_MAX_DEPTH 6 @@ -1010,8 +1010,8 @@ module_do_load(const char *name, bool is * If a specific kind of module was requested, ensure that we have * a match. */ - if (!MODULE_CLASS_MATCH(mi, class)) { - module_incompat(mi, class); + if (!MODULE_CLASS_MATCH(mi, modclass)) { + module_incompat(mi, modclass); error = ENOENT; goto fail; } Index: src/sys/kern/kern_mutex.c diff -u src/sys/kern/kern_mutex.c:1.58 src/sys/kern/kern_mutex.c:1.59 --- src/sys/kern/kern_mutex.c:1.58 Sat Oct 19 21:01:39 2013 +++ src/sys/kern/kern_mutex.c Fri Sep 5 05:57:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_mutex.c,v 1.58 2013/10/19 21:01:39 mrg Exp $ */ +/* $NetBSD: kern_mutex.c,v 1.59 2014/09/05 05:57:21 matt Exp $ */ /*- * Copyright (c) 2002, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ #define __MUTEX_PRIVATE #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.58 2013/10/19 21:01:39 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.59 2014/09/05 05:57:21 matt Exp $"); #include <sys/param.h> #include <sys/atomic.h> @@ -179,22 +179,22 @@ do { \ #define MUTEX_DEBUG_P(mtx) (((mtx)->mtx_owner & MUTEX_BIT_NODEBUG) == 0) #if defined(LOCKDEBUG) #define MUTEX_OWNED(owner) (((owner) & ~MUTEX_BIT_NODEBUG) != 0) -#define MUTEX_INHERITDEBUG(new, old) (new) |= (old) & MUTEX_BIT_NODEBUG +#define MUTEX_INHERITDEBUG(n, o) (n) |= (o) & MUTEX_BIT_NODEBUG #else /* defined(LOCKDEBUG) */ #define MUTEX_OWNED(owner) ((owner) != 0) -#define MUTEX_INHERITDEBUG(new, old) /* nothing */ +#define MUTEX_INHERITDEBUG(n, o) /* nothing */ #endif /* defined(LOCKDEBUG) */ static inline int MUTEX_ACQUIRE(kmutex_t *mtx, uintptr_t curthread) { int rv; - uintptr_t old = 0; - uintptr_t new = curthread; + uintptr_t oldown = 0; + uintptr_t newown = curthread; - MUTEX_INHERITDEBUG(old, mtx->mtx_owner); - MUTEX_INHERITDEBUG(new, old); - rv = MUTEX_CAS(&mtx->mtx_owner, old, new); + MUTEX_INHERITDEBUG(oldown, mtx->mtx_owner); + MUTEX_INHERITDEBUG(newown, oldown); + rv = MUTEX_CAS(&mtx->mtx_owner, oldown, newown); MUTEX_RECEIVE(mtx); return rv; } @@ -211,12 +211,12 @@ MUTEX_SET_WAITERS(kmutex_t *mtx, uintptr static inline void MUTEX_RELEASE(kmutex_t *mtx) { - uintptr_t new; + uintptr_t newown; MUTEX_GIVE(mtx); - new = 0; - MUTEX_INHERITDEBUG(new, mtx->mtx_owner); - mtx->mtx_owner = new; + newown = 0; + MUTEX_INHERITDEBUG(newown, mtx->mtx_owner); + mtx->mtx_owner = newown; } #endif /* __HAVE_SIMPLE_MUTEXES */ Index: src/sys/kern/kern_rndsink.c diff -u src/sys/kern/kern_rndsink.c:1.8 src/sys/kern/kern_rndsink.c:1.9 --- src/sys/kern/kern_rndsink.c:1.8 Sat Mar 1 14:15:15 2014 +++ src/sys/kern/kern_rndsink.c Fri Sep 5 05:57:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_rndsink.c,v 1.8 2014/03/01 14:15:15 riastradh Exp $ */ +/* $NetBSD: kern_rndsink.c,v 1.9 2014/09/05 05:57:21 matt Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_rndsink.c,v 1.8 2014/03/01 14:15:15 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_rndsink.c,v 1.9 2014/09/05 05:57:21 matt Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -43,15 +43,17 @@ __KERNEL_RCSID(0, "$NetBSD: kern_rndsink #include <dev/rnd_private.h> /* XXX provisional, for rnd_extract_data */ +enum rsink_state { + RNDSINK_IDLE, /* no callback in progress */ + RNDSINK_QUEUED, /* queued for callback */ + RNDSINK_IN_FLIGHT, /* callback called */ + RNDSINK_REQUEUED, /* queued again before callback done */ + RNDSINK_DEAD, /* destroyed */ +}; + struct rndsink { /* Callback state. */ - enum { - RNDSINK_IDLE, /* no callback in progress */ - RNDSINK_QUEUED, /* queued for callback */ - RNDSINK_IN_FLIGHT, /* callback called */ - RNDSINK_REQUEUED, /* queued again before callback done */ - RNDSINK_DEAD, /* destroyed */ - } rsink_state; + enum rsink_state rsink_state; /* Entry on the queue of rndsinks, iff in the RNDSINK_QUEUED state. */ TAILQ_ENTRY(rndsink) rsink_entry; Index: src/sys/kern/kern_rwlock.c diff -u src/sys/kern/kern_rwlock.c:1.43 src/sys/kern/kern_rwlock.c:1.44 --- src/sys/kern/kern_rwlock.c:1.43 Wed Jul 30 07:44:00 2014 +++ src/sys/kern/kern_rwlock.c Fri Sep 5 05:57:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_rwlock.c,v 1.43 2014/07/30 07:44:00 ozaki-r Exp $ */ +/* $NetBSD: kern_rwlock.c,v 1.44 2014/09/05 05:57:21 matt Exp $ */ /*- * Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.43 2014/07/30 07:44:00 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.44 2014/09/05 05:57:21 matt Exp $"); #define __RWLOCK_PRIVATE @@ -106,9 +106,9 @@ do { \ #define RW_SETDEBUG(rw, on) ((rw)->rw_owner |= (on) ? 0 : RW_NODEBUG) #define RW_DEBUG_P(rw) (((rw)->rw_owner & RW_NODEBUG) == 0) #if defined(LOCKDEBUG) -#define RW_INHERITDEBUG(new, old) (new) |= (old) & RW_NODEBUG +#define RW_INHERITDEBUG(n, o) (n) |= (o) & RW_NODEBUG #else /* defined(LOCKDEBUG) */ -#define RW_INHERITDEBUG(new, old) /* nothing */ +#define RW_INHERITDEBUG(n, o) /* nothing */ #endif /* defined(LOCKDEBUG) */ static void rw_abort(krwlock_t *, const char *, const char *); @@ -417,7 +417,7 @@ rw_vector_enter(krwlock_t *rw, const krw void rw_vector_exit(krwlock_t *rw) { - uintptr_t curthread, owner, decr, new, next; + uintptr_t curthread, owner, decr, newown, next; turnstile_t *ts; int rcnt, wcnt; lwp_t *l; @@ -452,10 +452,10 @@ rw_vector_exit(krwlock_t *rw) */ membar_exit(); for (;;) { - new = (owner - decr); - if ((new & (RW_THREAD | RW_HAS_WAITERS)) == RW_HAS_WAITERS) + newown = (owner - decr); + if ((newown & (RW_THREAD | RW_HAS_WAITERS)) == RW_HAS_WAITERS) break; - next = rw_cas(rw, owner, new); + next = rw_cas(rw, owner, newown); if (__predict_true(next == owner)) return; owner = next; @@ -492,10 +492,10 @@ rw_vector_exit(krwlock_t *rw) if (rcnt != 0) { /* Give the lock to the longest waiting writer. */ l = TS_FIRST(ts, TS_WRITER_Q); - new = (uintptr_t)l | RW_WRITE_LOCKED | RW_HAS_WAITERS; + newown = (uintptr_t)l | RW_WRITE_LOCKED | RW_HAS_WAITERS; if (wcnt > 1) - new |= RW_WRITE_WANTED; - rw_swap(rw, owner, new); + newown |= RW_WRITE_WANTED; + rw_swap(rw, owner, newown); turnstile_wakeup(ts, TS_WRITER_Q, 1, l); } else { /* Wake all writers and let them fight it out. */ @@ -510,12 +510,12 @@ rw_vector_exit(krwlock_t *rw) * is a writer waiting, new readers that arrive * after the release will be blocked out. */ - new = rcnt << RW_READ_COUNT_SHIFT; + newown = rcnt << RW_READ_COUNT_SHIFT; if (wcnt != 0) - new |= RW_HAS_WAITERS | RW_WRITE_WANTED; + newown |= RW_HAS_WAITERS | RW_WRITE_WANTED; /* Wake up all sleeping readers. */ - rw_swap(rw, owner, new); + rw_swap(rw, owner, newown); turnstile_wakeup(ts, TS_READER_Q, rcnt, NULL); } } @@ -571,7 +571,7 @@ rw_vector_tryenter(krwlock_t *rw, const void rw_downgrade(krwlock_t *rw) { - uintptr_t owner, curthread, new, next; + uintptr_t owner, curthread, newown, next; turnstile_t *ts; int rcnt, wcnt; @@ -625,8 +625,8 @@ rw_downgrade(krwlock_t *rw) RW_DASSERT(rw, (rw->rw_owner & RW_WRITE_WANTED) != 0); RW_DASSERT(rw, (rw->rw_owner & RW_HAS_WAITERS) != 0); - new = RW_READ_INCR | RW_HAS_WAITERS | RW_WRITE_WANTED; - next = rw_cas(rw, owner, new); + newown = RW_READ_INCR | RW_HAS_WAITERS | RW_WRITE_WANTED; + next = rw_cas(rw, owner, newown); turnstile_exit(rw); if (__predict_true(next == owner)) break; @@ -637,11 +637,11 @@ rw_downgrade(krwlock_t *rw) * is a writer waiting, new readers will be blocked * out. */ - new = (rcnt << RW_READ_COUNT_SHIFT) + RW_READ_INCR; + newown = (rcnt << RW_READ_COUNT_SHIFT) + RW_READ_INCR; if (wcnt != 0) - new |= RW_HAS_WAITERS | RW_WRITE_WANTED; + newown |= RW_HAS_WAITERS | RW_WRITE_WANTED; - next = rw_cas(rw, owner, new); + next = rw_cas(rw, owner, newown); if (__predict_true(next == owner)) { /* Wake up all sleeping readers. */ turnstile_wakeup(ts, TS_READER_Q, rcnt, NULL); @@ -666,7 +666,7 @@ rw_downgrade(krwlock_t *rw) int rw_tryupgrade(krwlock_t *rw) { - uintptr_t owner, curthread, new, next; + uintptr_t owner, curthread, newown, next; curthread = (uintptr_t)curlwp; RW_ASSERT(rw, curthread != 0); @@ -678,8 +678,8 @@ rw_tryupgrade(krwlock_t *rw) RW_ASSERT(rw, (owner & RW_THREAD) != 0); return 0; } - new = curthread | RW_WRITE_LOCKED | (owner & ~RW_THREAD); - next = rw_cas(rw, owner, new); + newown = curthread | RW_WRITE_LOCKED | (owner & ~RW_THREAD); + next = rw_cas(rw, owner, newown); if (__predict_true(next == owner)) { membar_producer(); break; Index: src/sys/kern/kern_sleepq.c diff -u src/sys/kern/kern_sleepq.c:1.49 src/sys/kern/kern_sleepq.c:1.50 --- src/sys/kern/kern_sleepq.c:1.49 Thu Apr 24 12:04:28 2014 +++ src/sys/kern/kern_sleepq.c Fri Sep 5 05:57:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_sleepq.c,v 1.49 2014/04/24 12:04:28 pooka Exp $ */ +/* $NetBSD: kern_sleepq.c,v 1.50 2014/09/05 05:57:21 matt Exp $ */ /*- * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_sleepq.c,v 1.49 2014/04/24 12:04:28 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_sleepq.c,v 1.50 2014/09/05 05:57:21 matt Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -230,7 +230,7 @@ sleepq_enqueue(sleepq_t *sq, wchan_t wch * timo is a timeout in ticks. timo = 0 specifies an infinite timeout. */ int -sleepq_block(int timo, bool catch) +sleepq_block(int timo, bool catch_p) { int error = 0, sig; struct proc *p; @@ -244,7 +244,7 @@ sleepq_block(int timo, bool catch) * If sleeping interruptably, check for pending signals, exits or * core dump events. */ - if (catch) { + if (catch_p) { l->l_flag |= LW_SINTR; if ((l->l_flag & (LW_CANCELLED|LW_WEXIT|LW_WCORE)) != 0) { l->l_flag &= ~LW_CANCELLED; @@ -274,7 +274,7 @@ sleepq_block(int timo, bool catch) } } - if (catch && error == 0) { + if (catch_p && error == 0) { p = l->l_proc; if ((l->l_flag & (LW_CANCELLED | LW_WEXIT | LW_WCORE)) != 0) error = EINTR; Index: src/sys/kern/subr_autoconf.c diff -u src/sys/kern/subr_autoconf.c:1.231 src/sys/kern/subr_autoconf.c:1.232 --- src/sys/kern/subr_autoconf.c:1.231 Sun Aug 10 16:44:36 2014 +++ src/sys/kern/subr_autoconf.c Fri Sep 5 05:57:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_autoconf.c,v 1.231 2014/08/10 16:44:36 tls Exp $ */ +/* $NetBSD: subr_autoconf.c,v 1.232 2014/09/05 05:57:21 matt Exp $ */ /* * Copyright (c) 1996, 2000 Christopher G. Demetriou @@ -77,7 +77,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.231 2014/08/10 16:44:36 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.232 2014/09/05 05:57:21 matt Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1123,26 +1123,26 @@ number(char *ep, int n) static void config_makeroom(int n, struct cfdriver *cd) { - int old, new; + int ondevs, nndevs; device_t *osp, *nsp; alldevs_nwrite++; - for (new = MAX(4, cd->cd_ndevs); new <= n; new += new) + for (nndevs = MAX(4, cd->cd_ndevs); nndevs <= n; nndevs += nndevs) ; while (n >= cd->cd_ndevs) { /* * Need to expand the array. */ - old = cd->cd_ndevs; + ondevs = cd->cd_ndevs; osp = cd->cd_devs; /* Release alldevs_mtx around allocation, which may * sleep. */ mutex_exit(&alldevs_mtx); - nsp = kmem_alloc(sizeof(device_t[new]), KM_SLEEP); + nsp = kmem_alloc(sizeof(device_t[nndevs]), KM_SLEEP); if (nsp == NULL) panic("%s: could not expand cd_devs", __func__); mutex_enter(&alldevs_mtx); @@ -1152,20 +1152,20 @@ config_makeroom(int n, struct cfdriver * */ if (cd->cd_devs != osp) { mutex_exit(&alldevs_mtx); - kmem_free(nsp, sizeof(device_t[new])); + kmem_free(nsp, sizeof(device_t[nndevs])); mutex_enter(&alldevs_mtx); continue; } - memset(nsp + old, 0, sizeof(device_t[new - old])); - if (old != 0) - memcpy(nsp, cd->cd_devs, sizeof(device_t[old])); + memset(nsp + ondevs, 0, sizeof(device_t[nndevs - ondevs])); + if (ondevs != 0) + memcpy(nsp, cd->cd_devs, sizeof(device_t[ondevs])); - cd->cd_ndevs = new; + cd->cd_ndevs = nndevs; cd->cd_devs = nsp; - if (old != 0) { + if (ondevs != 0) { mutex_exit(&alldevs_mtx); - kmem_free(osp, sizeof(device_t[old])); + kmem_free(osp, sizeof(device_t[ondevs])); mutex_enter(&alldevs_mtx); } } Index: src/sys/kern/subr_devsw.c diff -u src/sys/kern/subr_devsw.c:1.32 src/sys/kern/subr_devsw.c:1.33 --- src/sys/kern/subr_devsw.c:1.32 Fri Jul 25 07:56:14 2014 +++ src/sys/kern/subr_devsw.c Fri Sep 5 05:57:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_devsw.c,v 1.32 2014/07/25 07:56:14 dholland Exp $ */ +/* $NetBSD: subr_devsw.c,v 1.33 2014/09/05 05:57:21 matt Exp $ */ /*- * Copyright (c) 2001, 2002, 2007, 2008 The NetBSD Foundation, Inc. @@ -69,7 +69,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.32 2014/07/25 07:56:14 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.33 2014/09/05 05:57:21 matt Exp $"); #include <sys/param.h> #include <sys/conf.h> @@ -178,25 +178,25 @@ devsw_attach(const char *devname, } if (i == max_devsw_convs) { struct devsw_conv *newptr; - int old, new; + int old_convs, new_convs; - old = max_devsw_convs; - new = old + 1; + old_convs = max_devsw_convs; + new_convs = old_convs + 1; - newptr = kmem_zalloc(new * DEVSWCONV_SIZE, KM_NOSLEEP); + newptr = kmem_zalloc(new_convs * DEVSWCONV_SIZE, KM_NOSLEEP); if (newptr == NULL) { devsw_detach_locked(bdev, cdev); error = ENOMEM; goto fail; } - newptr[old].d_name = NULL; - newptr[old].d_bmajor = -1; - newptr[old].d_cmajor = -1; - memcpy(newptr, devsw_conv, old * DEVSWCONV_SIZE); + newptr[old_convs].d_name = NULL; + newptr[old_convs].d_bmajor = -1; + newptr[old_convs].d_cmajor = -1; + memcpy(newptr, devsw_conv, old_convs * DEVSWCONV_SIZE); if (devsw_conv != devsw_conv0) - kmem_free(devsw_conv, old * DEVSWCONV_SIZE); + kmem_free(devsw_conv, old_convs * DEVSWCONV_SIZE); devsw_conv = newptr; - max_devsw_convs = new; + max_devsw_convs = new_convs; } len = strlen(devname) + 1; Index: src/sys/kern/sys_descrip.c diff -u src/sys/kern/sys_descrip.c:1.28 src/sys/kern/sys_descrip.c:1.29 --- src/sys/kern/sys_descrip.c:1.28 Mon Apr 8 21:12:33 2013 +++ src/sys/kern/sys_descrip.c Fri Sep 5 05:57:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_descrip.c,v 1.28 2013/04/08 21:12:33 skrll Exp $ */ +/* $NetBSD: sys_descrip.c,v 1.29 2014/09/05 05:57:21 matt Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sys_descrip.c,v 1.28 2013/04/08 21:12:33 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_descrip.c,v 1.29 2014/09/05 05:57:21 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -105,17 +105,17 @@ sys_dup(struct lwp *l, const struct sys_ /* { syscallarg(int) fd; } */ - int new, error, old; + int error, newfd, oldfd; file_t *fp; - old = SCARG(uap, fd); + oldfd = SCARG(uap, fd); - if ((fp = fd_getfile(old)) == NULL) { + if ((fp = fd_getfile(oldfd)) == NULL) { return EBADF; } - error = fd_dup(fp, 0, &new, false); - fd_putfile(old); - *retval = new; + error = fd_dup(fp, 0, &newfd, false); + fd_putfile(oldfd); + *retval = newfd; return error; } Index: src/sys/kern/sys_pipe.c diff -u src/sys/kern/sys_pipe.c:1.138 src/sys/kern/sys_pipe.c:1.139 --- src/sys/kern/sys_pipe.c:1.138 Tue Feb 25 18:30:11 2014 +++ src/sys/kern/sys_pipe.c Fri Sep 5 05:57:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_pipe.c,v 1.138 2014/02/25 18:30:11 pooka Exp $ */ +/* $NetBSD: sys_pipe.c,v 1.139 2014/09/05 05:57:21 matt Exp $ */ /*- * Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.138 2014/02/25 18:30:11 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.139 2014/09/05 05:57:21 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -161,7 +161,7 @@ static u_int amountpipekva = 0; static void pipeclose(struct pipe *); static void pipe_free_kmem(struct pipe *); static int pipe_create(struct pipe **, pool_cache_t); -static int pipelock(struct pipe *, int); +static int pipelock(struct pipe *, bool); static inline void pipeunlock(struct pipe *); static void pipeselwakeup(struct pipe *, struct pipe *, int); #ifndef PIPE_NODIRECT @@ -368,7 +368,7 @@ pipe_create(struct pipe **pipep, pool_ca * Called with pipe spin lock held. */ static int -pipelock(struct pipe *pipe, int catch) +pipelock(struct pipe *pipe, bool catch_p) { int error; @@ -376,7 +376,7 @@ pipelock(struct pipe *pipe, int catch) while (pipe->pipe_state & PIPE_LOCKFL) { pipe->pipe_state |= PIPE_LWANT; - if (catch) { + if (catch_p) { error = cv_wait_sig(&pipe->pipe_lkcv, pipe->pipe_lock); if (error != 0) return error; @@ -461,7 +461,7 @@ pipe_read(file_t *fp, off_t *offset, str ocnt = bp->cnt; again: - error = pipelock(rpipe, 1); + error = pipelock(rpipe, true); if (error) goto unlocked_error; @@ -785,7 +785,7 @@ pipe_direct_write(file_t *fp, struct pip wpipe->pipe_state &= ~(PIPE_DIRECTW | PIPE_DIRECTR); /* Acquire the pipe lock and cleanup */ - (void)pipelock(wpipe, 0); + (void)pipelock(wpipe, false); mutex_exit(lock); if (pgs != NULL) { @@ -856,7 +856,7 @@ pipe_write(file_t *fp, off_t *offset, st ++wpipe->pipe_busy; /* Aquire the long-term pipe lock */ - if ((error = pipelock(wpipe, 1)) != 0) { + if ((error = pipelock(wpipe, true)) != 0) { --wpipe->pipe_busy; if (wpipe->pipe_busy == 0) { wpipe->pipe_state &= ~PIPE_RESTART; @@ -898,7 +898,7 @@ pipe_write(file_t *fp, off_t *offset, st cv_broadcast(&wpipe->pipe_rcv); pipeunlock(wpipe); error = cv_wait_sig(&wpipe->pipe_wcv, lock); - (void)pipelock(wpipe, 0); + (void)pipelock(wpipe, false); if (wpipe->pipe_state & PIPE_EOF) error = EPIPE; } @@ -1019,7 +1019,7 @@ pipe_write(file_t *fp, off_t *offset, st pipeunlock(wpipe); error = cv_wait_sig(&wpipe->pipe_wcv, lock); - (void)pipelock(wpipe, 0); + (void)pipelock(wpipe, false); if (error != 0) break; /* Index: src/sys/kern/uipc_sem.c diff -u src/sys/kern/uipc_sem.c:1.40 src/sys/kern/uipc_sem.c:1.41 --- src/sys/kern/uipc_sem.c:1.40 Fri Mar 29 01:08:17 2013 +++ src/sys/kern/uipc_sem.c Fri Sep 5 05:57:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_sem.c,v 1.40 2013/03/29 01:08:17 christos Exp $ */ +/* $NetBSD: uipc_sem.c,v 1.41 2014/09/05 05:57:21 matt Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v 1.40 2013/03/29 01:08:17 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v 1.41 2014/09/05 05:57:21 matt Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -673,7 +673,7 @@ out: } int -do_ksem_wait(lwp_t *l, intptr_t id, bool try, struct timespec *abstime) +do_ksem_wait(lwp_t *l, intptr_t id, bool try_p, struct timespec *abstime) { int fd = (int)id, error, timeo; ksem_t *ks; @@ -685,7 +685,7 @@ do_ksem_wait(lwp_t *l, intptr_t id, bool KASSERT(mutex_owned(&ks->ks_lock)); while (ks->ks_value == 0) { ks->ks_waiters++; - if (!try && abstime != NULL) { + if (!try_p && abstime != NULL) { error = ts2timo(CLOCK_REALTIME, TIMER_ABSTIME, abstime, &timeo, NULL); if (error != 0) @@ -693,7 +693,7 @@ do_ksem_wait(lwp_t *l, intptr_t id, bool } else { timeo = 0; } - error = try ? EAGAIN : cv_timedwait_sig(&ks->ks_cv, + error = try_p ? EAGAIN : cv_timedwait_sig(&ks->ks_cv, &ks->ks_lock, timeo); ks->ks_waiters--; if (error) Index: src/sys/kern/uipc_socket2.c diff -u src/sys/kern/uipc_socket2.c:1.120 src/sys/kern/uipc_socket2.c:1.121 --- src/sys/kern/uipc_socket2.c:1.120 Thu Jul 31 03:39:35 2014 +++ src/sys/kern/uipc_socket2.c Fri Sep 5 05:57:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_socket2.c,v 1.120 2014/07/31 03:39:35 rtr Exp $ */ +/* $NetBSD: uipc_socket2.c,v 1.121 2014/09/05 05:57:21 matt Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -58,7 +58,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uipc_socket2.c,v 1.120 2014/07/31 03:39:35 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_socket2.c,v 1.121 2014/09/05 05:57:21 matt Exp $"); #include "opt_mbuftrace.h" #include "opt_sb_max.h" @@ -1481,16 +1481,16 @@ sbunlock(struct sockbuf *sb) } int -sowait(struct socket *so, bool catch, int timo) +sowait(struct socket *so, bool catch_p, int timo) { kmutex_t *lock; int error; KASSERT(solocked(so)); - KASSERT(catch || timo != 0); + KASSERT(catch_p || timo != 0); lock = so->so_lock; - if (catch) + if (catch_p) error = cv_timedwait_sig(&so->so_cv, lock, timo); else error = cv_timedwait(&so->so_cv, lock, timo); Index: src/sys/kern/uipc_usrreq.c diff -u src/sys/kern/uipc_usrreq.c:1.169 src/sys/kern/uipc_usrreq.c:1.170 --- src/sys/kern/uipc_usrreq.c:1.169 Sat Aug 9 05:33:00 2014 +++ src/sys/kern/uipc_usrreq.c Fri Sep 5 05:57:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_usrreq.c,v 1.169 2014/08/09 05:33:00 rtr Exp $ */ +/* $NetBSD: uipc_usrreq.c,v 1.170 2014/09/05 05:57:21 matt Exp $ */ /*- * Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc. @@ -96,7 +96,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.169 2014/08/09 05:33:00 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.170 2014/09/05 05:57:21 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1645,7 +1645,7 @@ unp_gc(file_t *dp) extern struct domain unixdomain; file_t *fp, *np; struct socket *so, *so1; - u_int i, old, new; + u_int i, oflags, rflags; bool didwork; KASSERT(curlwp == unp_thread_lwp); @@ -1679,10 +1679,10 @@ unp_gc(file_t *dp) */ unp_defer = 0; LIST_FOREACH(fp, &filehead, f_list) { - for (old = fp->f_flag;; old = new) { - new = atomic_cas_uint(&fp->f_flag, old, - (old | FSCAN) & ~(FMARK|FDEFER)); - if (__predict_true(old == new)) { + for (oflags = fp->f_flag;; oflags = rflags) { + rflags = atomic_cas_uint(&fp->f_flag, oflags, + (oflags | FSCAN) & ~(FMARK|FDEFER)); + if (__predict_true(oflags == rflags)) { break; } } Index: src/sys/kern/vfs_bio.c diff -u src/sys/kern/vfs_bio.c:1.250 src/sys/kern/vfs_bio.c:1.251 --- src/sys/kern/vfs_bio.c:1.250 Sun May 25 16:31:51 2014 +++ src/sys/kern/vfs_bio.c Fri Sep 5 05:57:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_bio.c,v 1.250 2014/05/25 16:31:51 pooka Exp $ */ +/* $NetBSD: vfs_bio.c,v 1.251 2014/09/05 05:57:21 matt Exp $ */ /*- * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -123,7 +123,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.250 2014/05/25 16:31:51 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.251 2014/09/05 05:57:21 matt Exp $"); #include "opt_bufcache.h" @@ -532,7 +532,7 @@ bufinit2(void) static int buf_lotsfree(void) { - int try, thresh; + int guess, thresh; /* Always allocate if less than the low water mark. */ if (bufmem < bufmem_lowater) @@ -551,13 +551,13 @@ buf_lotsfree(void) * proportional to the current size of the cache, using * a granularity of 16 steps. */ - try = random() & 0x0000000fL; + guess = random() & 0x0000000fL; /* Don't use "16 * bufmem" here to avoid a 32-bit overflow. */ thresh = (bufmem - bufmem_lowater) / ((bufmem_hiwater - bufmem_lowater) / 16); - if (try >= thresh) + if (guess >= thresh) return 1; /* Otherwise don't allocate. */ Index: src/sys/kern/vfs_dirhash.c diff -u src/sys/kern/vfs_dirhash.c:1.11 src/sys/kern/vfs_dirhash.c:1.12 --- src/sys/kern/vfs_dirhash.c:1.11 Sun Jul 7 19:31:26 2013 +++ src/sys/kern/vfs_dirhash.c Fri Sep 5 05:57:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_dirhash.c,v 1.11 2013/07/07 19:31:26 reinoud Exp $ */ +/* $NetBSD: vfs_dirhash.c,v 1.12 2014/09/05 05:57:21 matt Exp $ */ /* * Copyright (c) 2008 Reinoud Zandijk @@ -28,7 +28,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_dirhash.c,v 1.11 2013/07/07 19:31:26 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_dirhash.c,v 1.12 2014/09/05 05:57:21 matt Exp $"); /* CLEAN UP! */ #include <sys/param.h> @@ -235,7 +235,7 @@ dirhash_put(struct dirhash *dirh) void dirhash_enter(struct dirhash *dirh, - struct dirent *dirent, uint64_t offset, uint32_t entry_size, int new) + struct dirent *dirent, uint64_t offset, uint32_t entry_size, int new_p) { struct dirhash *del_dirh, *prev_dirh; struct dirhash_entry *dirh_e; @@ -247,7 +247,7 @@ dirhash_enter(struct dirhash *dirh, KASSERT(dirh->refcnt > 0); /* are we trying to re-enter an entry? */ - if (!new && (dirh->flags & DIRH_COMPLETE)) + if (!new_p && (dirh->flags & DIRH_COMPLETE)) return; /* calculate our hash */ Index: src/sys/kern/vfs_subr.c diff -u src/sys/kern/vfs_subr.c:1.444 src/sys/kern/vfs_subr.c:1.445 --- src/sys/kern/vfs_subr.c:1.444 Sat May 24 16:34:04 2014 +++ src/sys/kern/vfs_subr.c Fri Sep 5 05:57:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_subr.c,v 1.444 2014/05/24 16:34:04 christos Exp $ */ +/* $NetBSD: vfs_subr.c,v 1.445 2014/09/05 05:57:21 matt Exp $ */ /*- * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.444 2014/05/24 16:34:04 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.445 2014/09/05 05:57:21 matt Exp $"); #include "opt_ddb.h" #include "opt_compat_netbsd.h" @@ -142,7 +142,7 @@ vntblinit(void) */ int vinvalbuf(struct vnode *vp, int flags, kauth_cred_t cred, struct lwp *l, - bool catch, int slptimeo) + bool catch_p, int slptimeo) { struct buf *bp, *nbp; int error; @@ -168,7 +168,7 @@ restart: for (bp = LIST_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) { KASSERT(bp->b_vp == vp); nbp = LIST_NEXT(bp, b_vnbufs); - error = bbusy(bp, catch, slptimeo, NULL); + error = bbusy(bp, catch_p, slptimeo, NULL); if (error != 0) { if (error == EPASSTHROUGH) goto restart; @@ -181,7 +181,7 @@ restart: for (bp = LIST_FIRST(&vp->v_cleanblkhd); bp; bp = nbp) { KASSERT(bp->b_vp == vp); nbp = LIST_NEXT(bp, b_vnbufs); - error = bbusy(bp, catch, slptimeo, NULL); + error = bbusy(bp, catch_p, slptimeo, NULL); if (error != 0) { if (error == EPASSTHROUGH) goto restart; @@ -222,7 +222,7 @@ restart: * buffers from being queued. */ int -vtruncbuf(struct vnode *vp, daddr_t lbn, bool catch, int slptimeo) +vtruncbuf(struct vnode *vp, daddr_t lbn, bool catch_p, int slptimeo) { struct buf *bp, *nbp; int error; @@ -242,7 +242,7 @@ restart: nbp = LIST_NEXT(bp, b_vnbufs); if (bp->b_lblkno < lbn) continue; - error = bbusy(bp, catch, slptimeo, NULL); + error = bbusy(bp, catch_p, slptimeo, NULL); if (error != 0) { if (error == EPASSTHROUGH) goto restart; @@ -257,7 +257,7 @@ restart: nbp = LIST_NEXT(bp, b_vnbufs); if (bp->b_lblkno < lbn) continue; - error = bbusy(bp, catch, slptimeo, NULL); + error = bbusy(bp, catch_p, slptimeo, NULL); if (error != 0) { if (error == EPASSTHROUGH) goto restart; Index: src/sys/kern/vfs_trans.c diff -u src/sys/kern/vfs_trans.c:1.30 src/sys/kern/vfs_trans.c:1.31 --- src/sys/kern/vfs_trans.c:1.30 Tue Apr 15 09:50:45 2014 +++ src/sys/kern/vfs_trans.c Fri Sep 5 05:57:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_trans.c,v 1.30 2014/04/15 09:50:45 hannken Exp $ */ +/* $NetBSD: vfs_trans.c,v 1.31 2014/09/05 05:57:21 matt Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.30 2014/04/15 09:50:45 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.31 2014/09/05 05:57:21 matt Exp $"); /* * File system transaction operations. @@ -160,19 +160,19 @@ int fstrans_mount(struct mount *mp) { int error; - struct fstrans_mount_info *new; + struct fstrans_mount_info *newfmi; error = vfs_busy(mp, NULL); if (error) return error; - if ((new = kmem_alloc(sizeof(*new), KM_SLEEP)) == NULL) + if ((newfmi = kmem_alloc(sizeof(*newfmi), KM_SLEEP)) == NULL) return ENOMEM; - new->fmi_state = FSTRANS_NORMAL; - new->fmi_ref_cnt = 1; - LIST_INIT(&new->fmi_cow_handler); - new->fmi_cow_change = false; + newfmi->fmi_state = FSTRANS_NORMAL; + newfmi->fmi_ref_cnt = 1; + LIST_INIT(&newfmi->fmi_cow_handler); + newfmi->fmi_cow_change = false; - mp->mnt_transinfo = new; + mp->mnt_transinfo = newfmi; mp->mnt_iflag |= IMNT_HAS_TRANS; vfs_unbusy(mp, true, NULL); @@ -596,7 +596,7 @@ fscow_establish(struct mount *mp, int (* void *arg) { struct fstrans_mount_info *fmi; - struct fscow_handler *new; + struct fscow_handler *newch; if ((mp->mnt_iflag & IMNT_HAS_TRANS) == 0) return EINVAL; @@ -604,13 +604,13 @@ fscow_establish(struct mount *mp, int (* fmi = mp->mnt_transinfo; KASSERT(fmi != NULL); - if ((new = kmem_alloc(sizeof(*new), KM_SLEEP)) == NULL) + if ((newch = kmem_alloc(sizeof(*newch), KM_SLEEP)) == NULL) return ENOMEM; - new->ch_func = func; - new->ch_arg = arg; + newch->ch_func = func; + newch->ch_arg = arg; cow_change_enter(mp); - LIST_INSERT_HEAD(&fmi->fmi_cow_handler, new, ch_list); + LIST_INSERT_HEAD(&fmi->fmi_cow_handler, newch, ch_list); cow_change_done(mp); return 0; Index: src/sys/kern/vfs_vnode.c diff -u src/sys/kern/vfs_vnode.c:1.37 src/sys/kern/vfs_vnode.c:1.38 --- src/sys/kern/vfs_vnode.c:1.37 Sat Jul 5 09:33:15 2014 +++ src/sys/kern/vfs_vnode.c Fri Sep 5 05:57:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_vnode.c,v 1.37 2014/07/05 09:33:15 hannken Exp $ */ +/* $NetBSD: vfs_vnode.c,v 1.38 2014/09/05 05:57:21 matt Exp $ */ /*- * Copyright (c) 1997-2011 The NetBSD Foundation, Inc. @@ -116,7 +116,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.37 2014/07/05 09:33:15 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.38 2014/09/05 05:57:21 matt Exp $"); #define _VFS_VNODE_PRIVATE @@ -181,10 +181,11 @@ static lwp_t * vrele_lwp __cacheline_a static int vrele_pending __cacheline_aligned; static int vrele_gen __cacheline_aligned; +SLIST_HEAD(hashhead, vcache_node); static struct { kmutex_t lock; u_long hashmask; - SLIST_HEAD(hashhead, vcache_node) *hashtab; + struct hashhead *hashtab; pool_cache_t pool; } vcache __cacheline_aligned; Index: src/sys/kern/vfs_wapbl.c diff -u src/sys/kern/vfs_wapbl.c:1.59 src/sys/kern/vfs_wapbl.c:1.60 --- src/sys/kern/vfs_wapbl.c:1.59 Tue Feb 25 18:30:11 2014 +++ src/sys/kern/vfs_wapbl.c Fri Sep 5 05:57:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_wapbl.c,v 1.59 2014/02/25 18:30:11 pooka Exp $ */ +/* $NetBSD: vfs_wapbl.c,v 1.60 2014/09/05 05:57:21 matt Exp $ */ /*- * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ #define WAPBL_INTERNAL #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.59 2014/02/25 18:30:11 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.60 2014/09/05 05:57:21 matt Exp $"); #include <sys/param.h> #include <sys/bitops.h> @@ -107,6 +107,7 @@ static inline size_t wapbl_space_free(si * u = unlocked access ok * b = bufcache_lock held */ +LIST_HEAD(wapbl_ino_head, wapbl_ino); struct wapbl { struct vnode *wl_logvp; /* r: log here */ struct vnode *wl_devvp; /* r: log on this device */ @@ -180,7 +181,7 @@ struct wapbl { /* hashtable of inode numbers for allocated but unlinked inodes */ /* synch ??? */ - LIST_HEAD(wapbl_ino_head, wapbl_ino) *wl_inohash; + struct wapbl_ino_head *wl_inohash; u_long wl_inohashmask; int wl_inohashcnt; @@ -1127,31 +1128,31 @@ wapbl_space_used(size_t avail, off_t hea #ifdef _KERNEL /* This is used to advance the pointer at old to new value at old+delta */ static inline off_t -wapbl_advance(size_t size, size_t off, off_t old, size_t delta) +wapbl_advance(size_t size, size_t off, off_t oldoff, size_t delta) { - off_t new; + off_t newoff; /* Define acceptable ranges for inputs. */ KASSERT(delta <= (size_t)size); - KASSERT((old == 0) || ((size_t)old >= off)); - KASSERT(old < (off_t)(size + off)); + KASSERT((oldoff == 0) || ((size_t)oldoff >= off)); + KASSERT(oldoff < (off_t)(size + off)); - if ((old == 0) && (delta != 0)) - new = off + delta; - else if ((old + delta) < (size + off)) - new = old + delta; + if ((oldoff == 0) && (delta != 0)) + newoff = off + delta; + else if ((oldoff + delta) < (size + off)) + newoff = oldoff + delta; else - new = (old + delta) - size; + newoff = (oldoff + delta) - size; /* Note some interesting axioms */ - KASSERT((delta != 0) || (new == old)); - KASSERT((delta == 0) || (new != 0)); - KASSERT((delta != (size)) || (new == old)); + KASSERT((delta != 0) || (newoff == oldoff)); + KASSERT((delta == 0) || (newoff != 0)); + KASSERT((delta != (size)) || (newoff == oldoff)); /* Define acceptable ranges for output. */ - KASSERT((new == 0) || ((size_t)new >= off)); - KASSERT((size_t)new < (size + off)); - return new; + KASSERT((newoff == 0) || ((size_t)newoff >= off)); + KASSERT((size_t)newoff < (size + off)); + return newoff; } static inline size_t Index: src/sys/kern/vfs_xattr.c diff -u src/sys/kern/vfs_xattr.c:1.31 src/sys/kern/vfs_xattr.c:1.32 --- src/sys/kern/vfs_xattr.c:1.31 Tue May 1 07:48:25 2012 +++ src/sys/kern/vfs_xattr.c Fri Sep 5 05:57:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_xattr.c,v 1.31 2012/05/01 07:48:25 manu Exp $ */ +/* $NetBSD: vfs_xattr.c,v 1.32 2014/09/05 05:57:21 matt Exp $ */ /*- * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_xattr.c,v 1.31 2012/05/01 07:48:25 manu Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_xattr.c,v 1.32 2014/09/05 05:57:21 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -789,7 +789,7 @@ sys_setxattr(struct lwp *l, const struct } */ struct vnode *vp; char attrname[XATTR_NAME_MAX]; - int namespace; + int attrnamespace; register_t attrlen; int error; @@ -803,9 +803,9 @@ sys_setxattr(struct lwp *l, const struct if (error) goto out; - namespace = xattr_native(attrname); + attrnamespace = xattr_native(attrname); - error = extattr_set_vp(vp, namespace, + error = extattr_set_vp(vp, attrnamespace, attrname, SCARG(uap, value), SCARG(uap, size), l, &attrlen, SCARG(uap, flags)); @@ -827,7 +827,7 @@ sys_lsetxattr(struct lwp *l, const struc } */ struct vnode *vp; char attrname[XATTR_NAME_MAX]; - int namespace; + int attrnamespace; register_t attrlen; int error; @@ -841,9 +841,9 @@ sys_lsetxattr(struct lwp *l, const struc if (error) goto out; - namespace = xattr_native(attrname); + attrnamespace = xattr_native(attrname); - error = extattr_set_vp(vp, namespace, + error = extattr_set_vp(vp, attrnamespace, attrname, SCARG(uap, value), SCARG(uap, size), l, &attrlen, SCARG(uap, flags)); @@ -866,7 +866,7 @@ sys_fsetxattr(struct lwp *l, const struc struct file *fp; struct vnode *vp; char attrname[XATTR_NAME_MAX]; - int namespace; + int attrnamespace; register_t attrlen; int error; @@ -880,9 +880,9 @@ sys_fsetxattr(struct lwp *l, const struc goto out; vp = (struct vnode *) fp->f_data; - namespace = xattr_native(attrname); + attrnamespace = xattr_native(attrname); - error = extattr_set_vp(vp, namespace, + error = extattr_set_vp(vp, attrnamespace, attrname, SCARG(uap, value), SCARG(uap, size), l, &attrlen, SCARG(uap, flags)); @@ -903,7 +903,7 @@ sys_getxattr(struct lwp *l, const struct } */ struct vnode *vp; char attrname[XATTR_NAME_MAX]; - int namespace; + int attrnamespace; int error; error = copyinstr(SCARG(uap, name), attrname, sizeof(attrname), @@ -916,9 +916,9 @@ sys_getxattr(struct lwp *l, const struct if (error) return (error); - namespace = xattr_native(attrname); + attrnamespace = xattr_native(attrname); - error = extattr_get_vp(vp, namespace, + error = extattr_get_vp(vp, attrnamespace, attrname, SCARG(uap, value), SCARG(uap, size), l, retval); vrele(vp); @@ -936,7 +936,7 @@ sys_lgetxattr(struct lwp *l, const struc } */ struct vnode *vp; char attrname[XATTR_NAME_MAX]; - int namespace; + int attrnamespace; int error; error = copyinstr(SCARG(uap, name), attrname, sizeof(attrname), @@ -949,9 +949,9 @@ sys_lgetxattr(struct lwp *l, const struc if (error) return (error); - namespace = xattr_native(attrname); + attrnamespace = xattr_native(attrname); - error = extattr_get_vp(vp, namespace, + error = extattr_get_vp(vp, attrnamespace, attrname, SCARG(uap, value), SCARG(uap, size), l, retval); vrele(vp); @@ -970,7 +970,7 @@ sys_fgetxattr(struct lwp *l, const struc struct file *fp; struct vnode *vp; char attrname[XATTR_NAME_MAX]; - int namespace; + int attrnamespace; int error; error = copyinstr(SCARG(uap, name), attrname, sizeof(attrname), @@ -983,9 +983,9 @@ sys_fgetxattr(struct lwp *l, const struc return (error); vp = (struct vnode *) fp->f_data; - namespace = xattr_native(attrname); + attrnamespace = xattr_native(attrname); - error = extattr_get_vp(vp, namespace, + error = extattr_get_vp(vp, attrnamespace, attrname, SCARG(uap, value), SCARG(uap, size), l, retval); fd_putfile(SCARG(uap, fd)); @@ -1159,7 +1159,7 @@ sys_removexattr(struct lwp *l, const str } */ struct vnode *vp; char attrname[XATTR_NAME_MAX]; - int namespace; + int attrnamespace; int error; error = copyinstr(SCARG(uap, name), attrname, sizeof(attrname), @@ -1172,9 +1172,9 @@ sys_removexattr(struct lwp *l, const str if (error) return (error); - namespace = xattr_native(attrname); + attrnamespace = xattr_native(attrname); - error = extattr_delete_vp(vp, namespace, attrname, l); + error = extattr_delete_vp(vp, attrnamespace, attrname, l); vrele(vp); return (XATTR_ERRNO(error)); @@ -1189,7 +1189,7 @@ sys_lremovexattr(struct lwp *l, const st } */ struct vnode *vp; char attrname[XATTR_NAME_MAX]; - int namespace; + int attrnamespace; int error; error = copyinstr(SCARG(uap, name), attrname, sizeof(attrname), @@ -1202,9 +1202,9 @@ sys_lremovexattr(struct lwp *l, const st if (error) return (error); - namespace = xattr_native(attrname); + attrnamespace = xattr_native(attrname); - error = extattr_delete_vp(vp, namespace, attrname, l); + error = extattr_delete_vp(vp, attrnamespace, attrname, l); vrele(vp); return (XATTR_ERRNO(error)); @@ -1220,7 +1220,7 @@ sys_fremovexattr(struct lwp *l, const st struct file *fp; struct vnode *vp; char attrname[XATTR_NAME_MAX]; - int namespace; + int attrnamespace; int error; error = copyinstr(SCARG(uap, name), attrname, sizeof(attrname), @@ -1233,9 +1233,9 @@ sys_fremovexattr(struct lwp *l, const st return (error); vp = (struct vnode *) fp->f_data; - namespace = xattr_native(attrname); + attrnamespace = xattr_native(attrname); - error = extattr_delete_vp(vp, namespace, attrname, l); + error = extattr_delete_vp(vp, attrnamespace, attrname, l); fd_putfile(SCARG(uap, fd)); return (XATTR_ERRNO(error));