From owner-freebsd-net@FreeBSD.ORG Tue Apr 13 08:35:38 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0E1D316A4CE for ; Tue, 13 Apr 2004 08:35:38 -0700 (PDT) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id E765643D69 for ; Tue, 13 Apr 2004 08:35:37 -0700 (PDT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (IDENT:brdavis@localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.12.10/8.12.3) with ESMTP id i3DFZ9kS023502; Tue, 13 Apr 2004 08:35:09 -0700 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.12.10/8.12.3/Submit) id i3DFZ9In023496; Tue, 13 Apr 2004 08:35:09 -0700 Date: Tue, 13 Apr 2004 08:35:08 -0700 From: Brooks Davis To: Luigi Rizzo Message-ID: <20040413153508.GB20550@Odin.AC.HMC.Edu> References: <20040413014720.A57543@xorpc.icir.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ftEhullJWpWg/VHq" Content-Disposition: inline In-Reply-To: <20040413014720.A57543@xorpc.icir.org> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-milter (http://amavis.org/) on odin.ac.hmc.edu cc: net@freebsd.org Subject: Re: multiple definitions of ROUNDUP macro X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Apr 2004 15:35:38 -0000 --ftEhullJWpWg/VHq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 13, 2004 at 01:47:20AM -0700, Luigi Rizzo wrote: > The ROUNDUP macro, used to account for the space occupied by a sockaddr = =20 > when passed through a routing socket, is defined in a zillion places: >=20 > src/usr.sbin/IPXrouted/startup.c:#define ROUNDUP(a) \ > src/usr.sbin/arp/arp.c:#define ROUNDUP(a) \ > src/usr.sbin/ndp/ndp.c:#define ROUNDUP(a) \ > src/usr.sbin/ppp/defs.h:#define ROUNDUP(x) ((x) ? (1 + (((x) - 1) | (size= of(longsrc/usr.sbin/route6d/route6d.c:#define ROUNDUP(a) \ > src/usr.sbin/rwhod/rwhod.c:#define ROUNDUP(a) \ > src/sys/net/route.c.orig:#define ROUNDUP(a) (a>0 ? (1 + (((a) - 1) | (siz= eof(lonsrc/sys/net/rtsock.c:#define ROUNDUP(a) \ >=20 > A similar macro, ADVANCE, has similar problems. > This is confusing at best, and a likely source of trouble. >=20 > If there are no objections I would like to replace it with a > centralised macro (possibly with a suitable name) which takes > a sockaddr * as argument and returns the rounded-up size of the > object as a result. Sounds good. BDE suggested the roundup/roundup2 macros in sys/param.h when I was removing some macros from net/if.c. > BTW, i notice that the rounding is to multiples of "sizeof(long)", > and i wonder if this is intentional, especially on 64-bit > architectures. Our wordsize is long on all architectures so that makes sense to me. -- Brooks --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --ftEhullJWpWg/VHq Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFAfAirXY6L6fI4GtQRAiSkAJwJ2CfTBzw9Fi7f0umyc22c7g/hMQCfZnnB ne5+EeTuB3baiMLk1Of2gzs= =gRgG -----END PGP SIGNATURE----- --ftEhullJWpWg/VHq--