Date: 21 Mar 2014 14:48:32 +0000 From: "Mark Delany" <c2h@romeo.emu.st> To: freebsd-net@freebsd.org Subject: Patch: Should netmap prototypes use const where possible? Message-ID: <20140321144832.52746.qmail@f5-external.bushwire.net>
next in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140321144832.52746.qmail>