Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1290005
| From | Al Viro <viro@ZenIV.linux.org.uk> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode |
| Date | 2015-12-12 00:20 +0100 |
| Message-ID | <qEF8J-2zj-3@gated-at.bofh.it> (permalink) |
| References | (3 earlier) <qDRF0-3u6-3@gated-at.bofh.it> <qDX7I-73a-7@gated-at.bofh.it> <qDZsR-8qg-3@gated-at.bofh.it> <qEla2-5TY-15@gated-at.bofh.it> <qEqCJ-167-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Dec 11, 2015 at 08:49:24AM +0100, Rasmus Villemoes wrote:
> union delayed_call_fn {
> void (*fn)(void *);
> void (*kfree_like)(const void *);
> } __attribute__((__transparent_union__));
>
> void
> set_delayed_call(struct delayed_call *call, union delayed_call_fn u, void *arg)
> {
> call->fn = u.fn;
> call->arg = arg;
> }
Yecchhhh... If we are into that kind of gccisms, I'd rather use
__builtin_choose_expr/__builtin_types_compatible_p. At least that is
used elsewhere in the kernel; __transparent_union__ kludge isn't. Sure, it
means having set_delayed_call() a macro, but IMO it's less nasty that way...
FWIW, another possibility is to have
#define CLOSURE_CALLBACK(f,type) \
static inline void __closure_##f(void *p) {return f((type)p);}
#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?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCHSET v2] ->follow_link() without dropping from RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
[PATCH v2 02/11] logfs: don't duplicate page_symlink_inode_operations Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
[PATCH v2 08/11] teach page_get_link() to work in RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
[PATCH v2 10/11] teach proc_self_get_link()/proc_thread_self_get_link() to work in RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
[PATCH v2 11/11] teach nfs_get_link() to work in RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
[PATCH v2 06/11] don't put symlink bodies in pagecache into highmem Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
[PATCH v2 01/11] switch befs long symlinks to page_symlink_operations Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
[PATCH v2 03/11] udf: don't duplicate page_symlink_inode_operations Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
[PATCH v2 09/11] teach shmem_get_link() to work in RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
[PATCH v2 04/11] ufs: get rid of ->setattr() for symlinks Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Linus Torvalds <torvalds@linux-foundation.org> - 2015-12-09 18:30 +0100
Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 19:30 +0100
Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-10 01:20 +0100
Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-10 03:50 +0100
Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-12-11 08:50 +0100
Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-12 00:20 +0100
Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-12 03:10 +0100
Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-12-13 19:50 +0100
Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-13 04:50 +0100
Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode NeilBrown <neilb@suse.com> - 2015-12-09 23:00 +0100
csiph-web