Exemplo n.º 1
0
/* returns 
 *	1 if domain already exists 
 *  0 if domain does not exist
 *  -1 if any error
 * */
int pdt_check_pd(hash_list_t *hl, str* sdomain, str *sp, str *sd)
{
	hash_t *it;
	int d;

	if(hl==NULL ||
			sd==NULL || sd->s==NULL ||
			sdomain==NULL || sdomain->s==NULL)
	{
		LM_ERR(" bad parameters\n");
		return -1;
	}
	
	lock_get(&hl->hl_lock);

	/* search the it position */
	it = hl->hash;
	while(it!=NULL && str_strcmp(&it->sdomain, sdomain)<0)
		it = it->next;

	if(it==NULL || str_strcmp(&it->sdomain, sdomain)>0)
	{
		lock_release(&hl->hl_lock);
		return 0;
	}
	
	d = check_pd(it, sp, sd);	
	lock_release(&hl->hl_lock);

	return d;		
}
static int sprd_pm_prepare(void)
{
    pr_debug("enter %s\n", __func__);
    check_ldo();
    check_pd();
    return 0;
}