[Nut-upsdev] [RFC apcsmart V3 08/18] drivers/dstate: add dstate_getflags()

Michal Soltys soltys at ziu.info
Sun Mar 6 19:59:09 UTC 2011

On 11-03-06 18:10, Arjen de Korte wrote:
> Citeren Michal Soltys <soltys at ziu.info>:
>> In cases such as immutable flag over readable value, we have
>> to be able to acquire this info at driver level (to e.g. avoid
>> polling, if user defined a variable with 'override' prefix).
> I'm not sure I like this. While it may seem a waste of effort to poll
> for a variable and ignore the value later on, I'd prefer to do this in
> one location (the dstate_*() functions) and not in the driver as well.
> Best regards, Arjen

Well, driver has following scenarios to handle:

1) variable exists and .conf file has default.*
2) variable doesn't exist and .conf file has default.*
3) variable exists and .conf file has override.*
4) variable doesn't exist and .conf file has override.*

The only "problematic" case is #3, and the only way I see currently is 
through checking the flag - as checking if the variable already exists 
(which implies being present in .conf file) is not enough. And if I poll 
such variable either way, user's override is lost - so even if 
dstate_*() would handle it, the user provided values would have to be 
stored somewhere else.

More information about the Nut-upsdev mailing list