Date: Fri, 22 Jan 2010 09:50:17 +0000 (UTC) From: Luigi Rizzo <luigi@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r202795 - user/luigi/ipfw3-head/sys/netinet/ipfw Message-ID: <201001220950.o0M9oHrG028127@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: luigi Date: Fri Jan 22 09:50:17 2010 New Revision: 202795 URL: http://svn.freebsd.org/changeset/base/202795 Log: use uintptr_t for list of objects (helps with alignment, though a bit of a waste of space) Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Fri Jan 22 09:49:07 2010 (r202794) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Fri Jan 22 09:50:17 2010 (r202795) @@ -848,10 +848,9 @@ copy_fsk_list(struct copy_args *a, struc int n = 0, space = sizeof(*o); SLIST_FOREACH(fs, &s->fsk_list, sch_chain) { if (fs->fs.fs_nr < DN_MAX_ID) - n++;; + n++; } - /* XXX beware the alignment */ - space += 2*n; + space += n * sizeof(uintptr_t); D("sched %d has %d flowsets", s->sch.sched_nr, n); if (a->end - *(a->start) < space) return DNHT_SCAN_END; @@ -1322,7 +1321,7 @@ do_config(void *p, int l) struct dn_id *next, *o; int err = 0, err2 = 0; struct dn_id *arg = NULL; - uint32_t *a; + uintptr_t *a; o = p; if (o->id != DN_API_VERSION) { @@ -1349,8 +1348,8 @@ do_config(void *p, int l) break; case DN_CMD_DELETE: - /* the argument is in the first uint32 after o */ - a = (uint32_t *)(o+1); + /* the argument is in the first uintptr_t after o */ + a = (uintptr_t *)(o+1); if (o->len < sizeof(*o) + sizeof(*a)) { err = EINVAL; break;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001220950.o0M9oHrG028127>