On 04/02/09 10:25, James Carlson wrote:
> Girish Moodalbail writes:
>> On 04/02/09 09:37, Sowmini.Varadhan at Sun.COM wrote:
>>> so a full-fledged solution for extracting "POSSIBLE" for a general property
>>> should be able to handle an enumerated return value, right?
>>
>> Well then I will have a 'void **';
>>
>> -------------
>> typedef struct mac_propval_limit {
>>      uint32_t range_min;
>>      uint32_t range_max;
>> } mac_propval_limit_t;
>>
>> typedef struct mac_propval_range {
>>      uint32_t range_num;
>>      void **range_lim;
>> } mac_propval_range_t;
>> ------------
>>
>> for MTU and CPU values you could typecast it to "mac_propval_limit_t".
> 
> I happen to like type checking, so I'd suggest using a union of types
> instead of a 'void **'.  Perhaps something like:
> 
> typedef struct mac_propval_int_range_s {
>       uint32_t range_min;
>       uint32_t range_max;
> } mac_propval_int_range_t;
> 
> typedef enum mac_propval_rtype_e {
>       pvlInteger
> } mac_propval_rtype_t;
> 
> typedef struct mac_propval_range_s {
>       uint_t range_num;
>       mac_propval_rtype_t range_type;
>       union {
>               mac_propval_int_range_t **pvl_ir;
>       } u;
> } mac_propval_range_t;
> 
> #define       range_int       u.pvl_ir


I like this, too.

And also as Sowmini suggests, we could use MAC_PROP_RANGE flag (just 
like MAC_PROP_DEFAULT), to avoid explosion of properties (read: 
MAC_PROP_YYYY & MAC_PROP_YYYY_RANGE).

thanks guys!

~Girish

> 
> ... but it's probably not a big issue.
> 


Reply via email to