lkml.org 
[lkml]   [2004]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] CKRM: 7/10 CKRM: Resource controller for number of tasks
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.

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

thanks,

greg k-h
-
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/

\
 
 \ /
  Last update: 2005-03-22 14:08    [W:0.046 / U:1.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site