Re: extending callbacks?

Andreas Dilger (adilger@clusterfs.com)
Tue, 19 Mar 2002 12:32:28 -0700


Matthias Scheidegger <mscheid@iam.unibe.ch> writes:
> I've got the following problem: I want to register a callback in a kernel
> structure, but I need to supply an additional argument to my own code. I.e. I
> need a callback
>
> int (*cb)(int u)
>
> to really call
>
> int (*real_cb)(int u, void* my_arg)
>
> At the moment, I'm only focussing on the i386 architecture.

In general, you would pass "my_arg" in a private pointer in a data
struct somewhere. What function is it that you are calling? That
may already have the possibility of passing the extra data somewhere.

Cheers, Andreas

--
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert

- 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/