> > typedef struct foo_s {
> >     char **prop_val;
> >     int *val_cnt
> > }foo_t; 
> > 
> > foo_t prop;
> > val_desc_t v = {NULL, &prop};
> > 
> > It creates extra indirections in the wrapper function, but
> > val_desc_t is a bit more flexible for me, because I need to pass in
> > 4 pieces of info: link_name, prop_name, prop_val, an val_cnt
> > 
> I don't quite understand the above example. As I understand, if there is 
> only val_desc_t, then val_cnt is 1.

I think we are getting mixed up between the number of prop_val elements
and the number of val_desc elements.  I thought the function prototype
you had for pd_getf_t was the former (i.e., #prop_val). Is that not
the case? 

If yes, then a call of the form

  (*pd_get)((char *)arg1, (char **)arg2, (uint_t *)arg3) 

would translate to

  (*my_pd_get)(arg1, (val_desc_t *)my_arg2, (uint_t *)my_arg3)

where
  *my_arg3 = 1, 
  my_arg2.prop_val = arg2;
  my_arg2.val_cnt = arg3;

Does that make sense? 

> That is, if you have more than one values to set:
> 
> - the pd_setf_t() function will take a val_desc_t array as the second 
> argument, and the count of the values to be the third argument.
> 
> - the pd_getf_t() function. The caller will take a pointer to a string array 
> as the second argument and a pointer to a count as the third argument. So 
> far it always take a string array size of MAX_PROP_VALS as the input to 
> decrease the complexity.

right.

thanks
Sowmini

Reply via email to