From owner-freebsd-arch Wed Sep 18 11:26:57 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A6EFA37B406 for ; Wed, 18 Sep 2002 11:26:55 -0700 (PDT) Received: from rootlabs.com (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id BBA0843E6E for ; Wed, 18 Sep 2002 11:26:50 -0700 (PDT) (envelope-from nate@rootlabs.com) Received: (qmail 44643 invoked by uid 1000); 18 Sep 2002 18:26:51 -0000 Date: Wed, 18 Sep 2002 11:26:51 -0700 (PDT) From: Nate Lawson To: Poul-Henning Kamp Cc: arch@freebsd.org Subject: Re: Trivial mbuf patch for review. In-Reply-To: <3185.1032361630@critter.freebsd.dk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, 18 Sep 2002, Poul-Henning Kamp wrote: > This patch is a no-op which replaces local mbuf-chain counting > loops with calls to m_length() and in one case m_fixhdr(). > > Index: kern/uipc_socket2.c > =================================================================== > RCS file: /home/ncvs/src/sys/kern/uipc_socket2.c,v > retrieving revision 1.103 > diff -u -r1.103 uipc_socket2.c > --- kern/uipc_socket2.c 16 Aug 2002 18:41:48 -0000 1.103 > +++ kern/uipc_socket2.c 18 Sep 2002 14:08:34 -0000 > @@ -498,11 +498,11 @@ > #ifdef SOCKBUF_DEBUG > void > sbcheck(sb) > - register struct sockbuf *sb; > + struct sockbuf *sb; > { > - register struct mbuf *m; > - register struct mbuf *n = 0; > - register u_long len = 0, mbcnt = 0; > + struct mbuf *m; > + struct mbuf *n = 0; > + u_long len = 0, mbcnt = 0; > > for (m = sb->sb_mb; m; m = n) { > n = m->m_nextpkt; Have we agreed to remove "register" from all our code or did you have a specific reason for doing this here? Other places in the same patch you leave register in after changing the line. > Index: nfsclient/nfs_socket.c > =================================================================== > RCS file: /home/ncvs/src/sys/nfsclient/nfs_socket.c,v > retrieving revision 1.86 > diff -u -r1.86 nfs_socket.c > --- nfsclient/nfs_socket.c 8 Sep 2002 15:11:18 -0000 1.86 > +++ nfsclient/nfs_socket.c 18 Sep 2002 14:19:42 -0000 > @@ -869,13 +869,7 @@ > rep->r_vp = vp; > rep->r_td = td; > rep->r_procnum = procnum; > - i = 0; > - m = mrest; > - while (m) { > - i += m->m_len; > - m = m->m_next; > - } > - mrest_len = i; > + mrest_len = i = m_length(mrest, NULL); Is this initialization accepted style? Overall looks good and it's great to remove the redundancy. -Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message