>> Right. I will make the following logic to be general : >> >> a) compare the value with the possible list of values (if there is such >> list) >> b) get the default value (if there is the list) >> c) fail if setting a read-only property. >> d) get the list of possible values. >> >> Maybe more... and this is the reason I started the whole discussion. >> >> I would think no matter how the type of properties would be, these >> should be generic. > > > I agree that the compare, get, ... semantics are generic, > but the actual comparison, checking, ... is type specific. > So if you want to make the logic general, I guess you need > to provide the mechanism for adding new types, without the > need to change the generic code. > The comparison will be most based on "char *", and the real value will be change from uint_t to void *. Note that what I inclined to do now is to make the current do_set_prop() function to be a libdladm() API which can be called by each library. Using this model, different library can define its own table of property table, and each property can define its own xxx_check(), xxx_set(), xxx_get(), xxx_getmod() callback functions.
Does this sound workable? Like I mentioned in another mail, that the main effort I found if we go with this approach is to change the signature of the do_set_prop() function. Thanks - Cathy
