Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Dec 2019 09:26:17 +0000
From:      Alexey Dokuchaev <danfe@freebsd.org>
To:        Hans Petter Selasky <hps@selasky.org>
Cc:        John Baldwin <jhb@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r355600 - in head: share/man/man9 sys/kern sys/sys
Message-ID:  <20191211092617.GA10000@FreeBSD.org>
In-Reply-To: <3cc78418-6692-058c-eba5-1edc5286aeab@selasky.org>
References:  <201912102158.xBALwUF9075354@repo.freebsd.org> <3cc78418-6692-058c-eba5-1edc5286aeab@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Dec 10, 2019 at 11:09:41PM +0100, Hans Petter Selasky wrote:
> On 2019-12-10 22:58, John Baldwin wrote:
> >   While here, add <sys/callout.h> to the manpage.
> 
> FYI:
> 
> Linux guys eliminated the "void *c_arg" in their timer implementation by
> using container_of() to get callback argument. We could possibly do the
> same!

#define container_of(ptr, type, member) ({                              \
        void *__mptr = (void *)(ptr);                                   \
        BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                         !__same_type(*(ptr), void),                    \
                         "pointer type mismatch in container_of()");    \
        ((type *)(__mptr - offsetof(type, member))); })

That's one of those things that make Linux so unpleasant to work with.
Frankly, I don't think we want that for FreeBSD.

./danfe



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20191211092617.GA10000>