Date: Wed, 18 Sep 2002 11:26:51 -0700 (PDT) From: Nate Lawson <nate@root.org> To: Poul-Henning Kamp <phk@freebsd.org> Cc: arch@freebsd.org Subject: Re: Trivial mbuf patch for review. Message-ID: <Pine.BSF.4.21.0209181119420.44463-100000@root.org> In-Reply-To: <3185.1032361630@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0209181119420.44463-100000>
