[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 12 Dec 2015 02:00:27 +0000
From: Al Viro <viro@...IV.linux.org.uk>
To: Rasmus Villemoes <linux@...musvillemoes.dk>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Neil Brown <neilb@...e.com>
Subject: Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode
On Fri, Dec 11, 2015 at 11:16:24PM +0000, Al Viro wrote:
> #define set_delayed_type(call, f, arg) \
> sizeof(f(arg),0), \
> __set_delayed_type(call, __closure_##f, (void *)arg)
>
> That could be reused for timers with typechecking - we have a lot of timer
> callbacks that start with casting the argument (unsigned long, not void *,
> but that's not a big deal) to whatever it is that callback really wants,
> with setup_timer() callers explicitly casting that whatever the callback
> really wants to unsigned long. Which, of course, defeats the typechecking
> by both cc(1) and sparse(1)...
>
> I still hope for better solution, though... Comments?
Hmm...
#define set_delayed_type(call, f, arg) \
(sizeof(f(arg),0), \
__set_delayed_type(call, ({ \
void _(void *__) {f((typeof(arg))(unsigned long)__);} \
_;}), (void *)arg))
woult do nicely, but it's a gccism, and the one clang doesn't support ;-/
gcc support goes back at least to 4.1, not sure about the earlier branches
(and not at all sure how flaky it was/is, obviously).
But this thing works for e.g. f being void(char) and arg being char,
and AFAICS generates correct code - we end up with a stub like
_.1765:
movsbl %dil, %edi
jmp f
and its address gets stored in call->fn, which should DTRT on call...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists