Re: [PATCH] CKRM: 7/10 CKRM: Resource controller for number of tasks

From: Gerrit Huizenga
Date: Thu Feb 24 2005 - 04:44:43 EST



On Mon, 29 Nov 2004 15:01:48 PST, Greg KH wrote:
> On Mon, Nov 29, 2004 at 10:50:39AM -0800, Gerrit Huizenga wrote:
> > +static spinlock_t stub_lock = SPIN_LOCK_UNLOCKED;
> > +
> > +static get_ref_t real_get_ref = NULL;
> > +static put_ref_t real_put_ref = NULL;
> > +
> > +void ckrm_numtasks_register(get_ref_t gr, put_ref_t pr)
> > +{
> > + spin_lock(&stub_lock);
> > + real_get_ref = gr;
> > + real_put_ref = pr;
> > + spin_unlock(&stub_lock);
> > +}
> > +
> > +int numtasks_get_ref(void *arg, int force)
> > +{
> > + int ret = 1;
> > + spin_lock(&stub_lock);
> > + if (real_get_ref) {
> > + ret = (*real_get_ref) (arg, force);
> > + }
> > + spin_unlock(&stub_lock);
> > + return ret;
> > +}
> > +
> > +void numtasks_put_ref(void *arg)
> > +{
> > + spin_lock(&stub_lock);
> > + if (real_put_ref) {
> > + (*real_put_ref) (arg);
> > + }
> > + spin_unlock(&stub_lock);
> > +}
> > +
> > +EXPORT_SYMBOL(ckrm_numtasks_register);
> > +EXPORT_SYMBOL(numtasks_get_ref);
> > +EXPORT_SYMBOL(numtasks_put_ref);
>
> Why are these functions used instead of calling the real functions?
> They are only ever used to register a single set of functions anyway.

The real functions are dummy's by default and can be loaded by
a module.

> Oh, and void * is to be avoided at all costs...

Fixed.

thanks,

gerrit
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/