Re: extending callbacks?

From: Andreas Dilger (adilger@clusterfs.com)
Date: Tue Mar 19 2002 - 14:32:28 EST


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/



This archive was generated by hypermail 2b29 : Sat Mar 23 2002 - 22:00:19 EST