From owner-freebsd-net@FreeBSD.ORG Fri Mar 21 14:48:41 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 504FD240 for ; Fri, 21 Mar 2014 14:48:41 +0000 (UTC) Received: from smtp1.bushwire.net (f5.bushwire.net [199.48.133.46]) by mx1.freebsd.org (Postfix) with SMTP id 23A6230B for ; Fri, 21 Mar 2014 14:48:40 +0000 (UTC) Received: (qmail 52764 invoked by uid 1001); 21 Mar 2014 14:48:33 -0000 Delivered-To: qmda-intercept-freebsd-net@freebsd.org DomainKey-Signature: a=rsa-sha1; q=dns; c=simple; s=s384; d=romeo.emu.st; b=1x1XyopHoh+9agItEx2jCAd1cil/IT8j8zeO8ZdBcgiIwfyHBCrf5an2xKnfQNad; Comments: DomainKeys? See http://en.wikipedia.org/wiki/DomainKeys DomainKey-Trace-MD: h=10; b=67; l=C18R71D32M65F38T27S66M17C58C27; Comments: QMDA 0.3 Received: (qmail 52747 invoked by uid 1001); 21 Mar 2014 14:48:32 -0000 Date: 21 Mar 2014 14:48:32 +0000 Message-ID: <20140321144832.52746.qmail@f5-external.bushwire.net> From: "Mark Delany" To: freebsd-net@freebsd.org Subject: Patch: Should netmap prototypes use const where possible? MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="5vNYLRcllDrimb99" Content-Disposition: inline X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Mar 2014 14:48:41 -0000 --5vNYLRcllDrimb99 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Subject line says it all. I don't know what the convention is, but I presume everything should be declared const whenever possible, thus the appended patch. Mark. --5vNYLRcllDrimb99 Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="diff.txt" *** /usr/include/net/netmap_user.h Sun Mar 16 12:01:36 2014 --- /tmp/./netmap_user.h Fri Mar 21 07:39:16 2014 *************** *** 97,103 **** static inline uint32_t ! nm_ring_next(struct netmap_ring *r, uint32_t i) { return ( unlikely(i + 1 == r->num_slots) ? 0 : i + 1); } --- 97,103 ---- static inline uint32_t ! nm_ring_next(const struct netmap_ring *r, uint32_t i) { return ( unlikely(i + 1 == r->num_slots) ? 0 : i + 1); } *************** *** 108,121 **** * When everything is complete ring->head = ring->tail + 1 (modulo ring size) */ static inline int ! nm_tx_pending(struct netmap_ring *r) { return nm_ring_next(r, r->tail) != r->head; } static inline uint32_t ! nm_ring_space(struct netmap_ring *ring) { int ret = ring->tail - ring->cur; if (ret < 0) --- 108,121 ---- * When everything is complete ring->head = ring->tail + 1 (modulo ring size) */ static inline int ! nm_tx_pending(const struct netmap_ring *r) { return nm_ring_next(r, r->tail) != r->head; } static inline uint32_t ! nm_ring_space(const struct netmap_ring *ring) { int ret = ring->tail - ring->cur; if (ret < 0) --5vNYLRcllDrimb99--