rename NCHNAMLEN
it's 2013. we don't have to pay extra for vowels. Index: nfs/nfs_vnops.c === RCS file: /cvs/src/sys/nfs/nfs_vnops.c,v retrieving revision 1.140 diff -u -p -r1.140 nfs_vnops.c --- nfs/nfs_vnops.c 17 Nov 2012 22:28:26 - 1.140 +++ nfs/nfs_vnops.c 26 Mar 2013 08:59:30 - @@ -2455,7 +2456,7 @@ nfs_readdirplusrpc(struct vnode *vp, str info.nmi_md = mdsav2; dp->d_type = IFTODT( VTTOIF(np->n_vattr.va_type)); - if (cnp->cn_namelen <= NCHNAMLEN) { + if (cnp->cn_namelen <= NAMECACHE_MAXLEN) { ndp->ni_vp = newvp; cache_purge(ndp->ni_dvp); nfs_cache_enter(ndp->ni_dvp, Index: kern/vfs_cache.c === RCS file: /cvs/src/sys/kern/vfs_cache.c,v retrieving revision 1.34 diff -u -p -r1.34 vfs_cache.c --- kern/vfs_cache.c4 Jan 2012 18:11:51 - 1.34 +++ kern/vfs_cache.c26 Mar 2013 08:59:59 - @@ -48,7 +48,7 @@ /* * For simplicity (and economy of storage), names longer than - * a maximum length of NCHNAMLEN are not cached; they occur + * a maximum length of NAMECACHE_MAXLEN are not cached; they occur * infrequently in any case, and are almost never of interest. * * Upon reaching the last segment of a path, if the reference @@ -148,7 +148,7 @@ cache_lookup(struct vnode *dvp, struct v cnp->cn_flags &= ~MAKEENTRY; return (-1); } - if (cnp->cn_namelen > NCHNAMLEN) { + if (cnp->cn_namelen > NAMECACHE_MAXLEN) { nchstats.ncs_long++; cnp->cn_flags &= ~MAKEENTRY; return (-1); @@ -342,7 +342,7 @@ cache_enter(struct vnode *dvp, struct vn { struct namecache *ncp, *lncp; - if (!doingcache || cnp->cn_namelen > NCHNAMLEN) + if (!doingcache || cnp->cn_namelen > NAMECACHE_MAXLEN) return; /* Index: sys/namei.h === RCS file: /cvs/src/sys/sys/namei.h,v retrieving revision 1.27 diff -u -p -r1.27 namei.h --- sys/namei.h 30 Sep 2011 03:43:27 - 1.27 +++ sys/namei.h 26 Mar 2013 08:58:58 - @@ -165,7 +165,7 @@ struct nameidata { * names looked up by namei. */ -#defineNCHNAMLEN 31 /* maximum name segment length we bother with */ +#defineNAMECACHE_MAXLEN31 /* maximum name segment length we bother with */ struct namecache { TAILQ_ENTRY(namecache) nc_lru; /* Regular Entry LRU chain */ @@ -177,7 +177,7 @@ struct namecache { struct vnode *nc_vp; /* vnode the name refers to */ u_long nc_vpid;/* capability number of nc_vp */ charnc_nlen;/* length of name */ - charnc_name[NCHNAMLEN]; /* segment name */ + charnc_name[NAMECACHE_MAXLEN]; /* segment name */ }; #ifdef _KERNEL
Re: rename NCHNAMLEN
> Date: Tue, 26 Mar 2013 05:03:59 -0400 > From: Ted Unangst > > it's 2013. we don't have to pay extra for vowels. Even in 2013, my terminals are still 80 columns wide. This makes some of the lines wrap. Not really an improvement if you ask me. > Index: nfs/nfs_vnops.c > === > RCS file: /cvs/src/sys/nfs/nfs_vnops.c,v > retrieving revision 1.140 > diff -u -p -r1.140 nfs_vnops.c > --- nfs/nfs_vnops.c 17 Nov 2012 22:28:26 - 1.140 > +++ nfs/nfs_vnops.c 26 Mar 2013 08:59:30 - > @@ -2455,7 +2456,7 @@ nfs_readdirplusrpc(struct vnode *vp, str > info.nmi_md = mdsav2; > dp->d_type = IFTODT( > VTTOIF(np->n_vattr.va_type)); > - if (cnp->cn_namelen <= NCHNAMLEN) { > + if (cnp->cn_namelen <= > NAMECACHE_MAXLEN) { > ndp->ni_vp = newvp; > cache_purge(ndp->ni_dvp); > nfs_cache_enter(ndp->ni_dvp, > Index: kern/vfs_cache.c > === > RCS file: /cvs/src/sys/kern/vfs_cache.c,v > retrieving revision 1.34 > diff -u -p -r1.34 vfs_cache.c > --- kern/vfs_cache.c 4 Jan 2012 18:11:51 - 1.34 > +++ kern/vfs_cache.c 26 Mar 2013 08:59:59 - > @@ -48,7 +48,7 @@ > > /* > * For simplicity (and economy of storage), names longer than > - * a maximum length of NCHNAMLEN are not cached; they occur > + * a maximum length of NAMECACHE_MAXLEN are not cached; they occur > * infrequently in any case, and are almost never of interest. > * > * Upon reaching the last segment of a path, if the reference > @@ -148,7 +148,7 @@ cache_lookup(struct vnode *dvp, struct v > cnp->cn_flags &= ~MAKEENTRY; > return (-1); > } > - if (cnp->cn_namelen > NCHNAMLEN) { > + if (cnp->cn_namelen > NAMECACHE_MAXLEN) { > nchstats.ncs_long++; > cnp->cn_flags &= ~MAKEENTRY; > return (-1); > @@ -342,7 +342,7 @@ cache_enter(struct vnode *dvp, struct vn > { > struct namecache *ncp, *lncp; > > - if (!doingcache || cnp->cn_namelen > NCHNAMLEN) > + if (!doingcache || cnp->cn_namelen > NAMECACHE_MAXLEN) > return; > > /* > Index: sys/namei.h > === > RCS file: /cvs/src/sys/sys/namei.h,v > retrieving revision 1.27 > diff -u -p -r1.27 namei.h > --- sys/namei.h 30 Sep 2011 03:43:27 - 1.27 > +++ sys/namei.h 26 Mar 2013 08:58:58 - > @@ -165,7 +165,7 @@ struct nameidata { > * names looked up by namei. > */ > > -#define NCHNAMLEN 31 /* maximum name segment length we > bother with */ > +#define NAMECACHE_MAXLEN31 /* maximum name segment length > we bother with */ > > struct namecache { > TAILQ_ENTRY(namecache) nc_lru; /* Regular Entry LRU chain */ > @@ -177,7 +177,7 @@ structnamecache { > struct vnode *nc_vp; /* vnode the name refers to */ > u_long nc_vpid;/* capability number of nc_vp */ > charnc_nlen;/* length of name */ > - charnc_name[NCHNAMLEN]; /* segment name */ > + charnc_name[NAMECACHE_MAXLEN]; /* segment name */ > }; > > #ifdef _KERNEL > >
Re: rename NCHNAMLEN
On Tue, Mar 26, 2013 at 10:09, Mark Kettenis wrote: >> Date: Tue, 26 Mar 2013 05:03:59 -0400 >> From: Ted Unangst >> >> it's 2013. we don't have to pay extra for vowels. > > Even in 2013, my terminals are still 80 columns wide. This makes some > of the lines wrap. Not really an improvement if you ask me. oops, sorry, mine were a little wider and i didn't notice. easy to fix. besides improving readability (imo), i find it much easier typing real words, even if they're a little longer. i can visually confirm that i'm actually grepping for the identifier used by the code and not some subtly transposed variant. Index: kern/vfs_cache.c === RCS file: /cvs/src/sys/kern/vfs_cache.c,v retrieving revision 1.34 diff -u -p -r1.34 vfs_cache.c --- kern/vfs_cache.c4 Jan 2012 18:11:51 - 1.34 +++ kern/vfs_cache.c26 Mar 2013 08:59:59 - @@ -48,7 +48,7 @@ /* * For simplicity (and economy of storage), names longer than - * a maximum length of NCHNAMLEN are not cached; they occur + * a maximum length of NAMECACHE_MAXLEN are not cached; they occur * infrequently in any case, and are almost never of interest. * * Upon reaching the last segment of a path, if the reference @@ -148,7 +148,7 @@ cache_lookup(struct vnode *dvp, struct v cnp->cn_flags &= ~MAKEENTRY; return (-1); } - if (cnp->cn_namelen > NCHNAMLEN) { + if (cnp->cn_namelen > NAMECACHE_MAXLEN) { nchstats.ncs_long++; cnp->cn_flags &= ~MAKEENTRY; return (-1); @@ -342,7 +342,7 @@ cache_enter(struct vnode *dvp, struct vn { struct namecache *ncp, *lncp; - if (!doingcache || cnp->cn_namelen > NCHNAMLEN) + if (!doingcache || cnp->cn_namelen > NAMECACHE_MAXLEN) return; /* Index: sys/namei.h === RCS file: /cvs/src/sys/sys/namei.h,v retrieving revision 1.27 diff -u -p -r1.27 namei.h --- sys/namei.h 30 Sep 2011 03:43:27 - 1.27 +++ sys/namei.h 26 Mar 2013 09:23:43 - @@ -165,7 +165,7 @@ struct nameidata { * names looked up by namei. */ -#defineNCHNAMLEN 31 /* maximum name segment length we bother with */ +#defineNAMECACHE_MAXLEN 31 /* maximum name segment length we bother with */ struct namecache { TAILQ_ENTRY(namecache) nc_lru; /* Regular Entry LRU chain */ @@ -177,7 +177,7 @@ struct namecache { struct vnode *nc_vp; /* vnode the name refers to */ u_long nc_vpid;/* capability number of nc_vp */ charnc_nlen;/* length of name */ - charnc_name[NCHNAMLEN]; /* segment name */ + charnc_name[NAMECACHE_MAXLEN]; /* segment name */ }; #ifdef _KERNEL Index: nfs/nfs_vnops.c === RCS file: /cvs/src/sys/nfs/nfs_vnops.c,v retrieving revision 1.140 diff -u -p -r1.140 nfs_vnops.c --- nfs/nfs_vnops.c 17 Nov 2012 22:28:26 - 1.140 +++ nfs/nfs_vnops.c 26 Mar 2013 09:22:26 - @@ -2455,7 +2456,8 @@ nfs_readdirplusrpc(struct vnode *vp, str info.nmi_md = mdsav2; dp->d_type = IFTODT( VTTOIF(np->n_vattr.va_type)); - if (cnp->cn_namelen <= NCHNAMLEN) { + if (cnp->cn_namelen <= + NAMECACHE_MAXLEN) { ndp->ni_vp = newvp; cache_purge(ndp->ni_dvp); nfs_cache_enter(ndp->ni_dvp,