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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to