[Nut-upsdev] [PATCH 29/36] Configuration variable "sdtype" is as yet unused.

Arnaud Quette aquette.dev at gmail.com
Tue May 15 14:47:38 UTC 2012


2012/3/9 Greg A. Woods <woods at planix.com>:
> From: "Greg A. Woods" <woods at planix.com>
>
> also remark on the weirdness of pollfreq.
> ---
>  drivers/snmp-ups.c |   15 ++++++++++++++-
>  drivers/snmp-ups.h |    2 +-
>  2 files changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/snmp-ups.c b/drivers/snmp-ups.c
> index a68c1c5..3d31f9c 100644
> --- a/drivers/snmp-ups.c
> +++ b/drivers/snmp-ups.c
> @@ -166,7 +166,14 @@ void upsdrv_updateinfo(void)
>
>        /* only update every pollfreq */
>        /* FIXME: only update status (SU_STATUS_*), à la usbhid-ups, in between */
> -       if (time(NULL) > (lastpoll + pollfreq)) {
> +       /*
> +        * XXX there should be a *_POLL flag for values that should be checked
> +        * with every call, and then a full snmp_ups_walk() would only happen
> +        * every pollfreq seconds.
> +        *
> +        * XXX also, pollfreq is redundant with generic nutupsdrv '-i' flag!
> +        */
> +       if (time(NULL) > (lastpoll + pollfreq)) { /* XXX maybe should use difftime()??? */

agreed and tracked:
https://alioth.debian.org/tracker/index.php?func=detail&aid=313634&group_id=30602&atid=411542

>                status_init();
>
> @@ -249,6 +256,10 @@ void upsdrv_makevartable(void)
>                "Set the authentication protocol (MD5 or SHA) used for authenticated SNMPv3 messages (default=MD5)");
>        addvar(VAR_VALUE, SU_VAR_PRIVPROT,
>                "Set the privacy protocol (DES or AES) used for encrypted SNMPv3 messages (default=DES)");
> +#if 0 /* XXX unused */
> +       addvar(VAR_VALUE, SU_VAR_SDTYPE,
> +              "Set the shutdown mode (3 or 2, default=3)");
> +#endif
>        addvar(VAR_FLAG, SU_VAR_MAGIC, "Run the secret magic header dumper");
>  }
>
> @@ -1626,6 +1637,7 @@ int su_instcmd(const char *cmdname, const char *extradata)
>        return retval;
>  }
>
> +#if 0 /* XXX not yet used -- see upsdrv_shutdown() */
>  /* TODO: complete rewrite */
>  void su_shutdown_ups(void)
>  {
> @@ -1673,6 +1685,7 @@ void su_shutdown_ups(void)
>                break;
>        }
>  }
> +#endif
>
>  static void dump_nutscanner_snmp()
>  {
> diff --git a/drivers/snmp-ups.h b/drivers/snmp-ups.h
> index 802da9e..2fd0400 100644
> --- a/drivers/snmp-ups.h
> +++ b/drivers/snmp-ups.h
> @@ -171,7 +171,7 @@ typedef struct {
>  #define SU_VAR_VERSION         "snmp_version"
>  #define SU_VAR_MIBS                    "mibs"
>  #define SU_VAR_POLLFREQ                "pollfreq"
> -#define SU_VAR_SDTYPE          "sdtype"
> +#define SU_VAR_SDTYPE          "sdtype"        /* XXX unused */
>  /* SNMP v3 related parameters */
>  #define SU_VAR_SECLEVEL                "secLevel"
>  #define SU_VAR_SECNAME         "secName"

I'm partly discarding (or applied) this one, for the following reasons:
- snmp-ups has a rewrite planned, mapped on what has been done in usbhid-ups:
https://alioth.debian.org/pm/task.php?func=detailtask&project_task_id=198&group_id=30602&group_project_id=31
- usbhid-ups has the differential polling notion, ie:
  * poll status variables every pollinterval (from ups.conf, the
actual equivalent to "nutupsdrv -i")
  * poll all other data every pollfreq
  * listen for notification (USB interrupt, equivalent to SNMP traps)
in the meantime,
  * get the new value of any data changed through upsrw (Ie setvar())
- the shutdown type was part of some preliminary work for APC support.
when I first developed this driver, I only had visibility on MGE units
(back in 2002).
but I've removed everything around SDTYPE.
- the shutdown type option is something that should be made generic,
to be able to configure shutdown.return or .stayoff or (...) from
ups.conf
there is a feature request logged for that one:
https://alioth.debian.org/tracker/index.php?func=detail&aid=313473&group_id=30602&atid=411545

all in all, I've removed the dead shutdown code.
see r3601 for more information...

cheers,
Arnaud
-- 
Linux / Unix Expert R&D - Eaton - http://powerquality.eaton.com
Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org/
Debian Developer - http://www.debian.org
Free Software Developer - http://arnaud.quette.free.fr/



More information about the Nut-upsdev mailing list