Skip to content

DMF: define a common dmfstdlib with conversion methods that can be used by "static" and DMF builds alike - #3615

Open
jimklimov wants to merge 9 commits into
networkupstools:FTYfrom
jimklimov:FTY-revise-20260901
Open

DMF: define a common dmfstdlib with conversion methods that can be used by "static" and DMF builds alike#3615
jimklimov wants to merge 9 commits into
networkupstools:FTYfrom
jimklimov:FTY-revise-20260901

Conversation

@jimklimov

@jimklimov jimklimov commented Sep 2, 2026

Copy link
Copy Markdown
Member

After some analysis, a lot of active data manipulations can be done by relatively few methods predefined in C and used in classic mappings same as in DMF variants -- to the point that many use-cases would not employ LUA at all.

This PR reshuffles related code and recipes to aid in this effort (there would be more work to actually benefit from this in XML DMF handling). Burned through a month's allowance in CoPilot already in the first couple of days, and another in the last day of August, so maybe will follow up much later or find another provider to pick up the torch. Still, thanks to GitHub for sponsoring maintainers to have an allowance at all.

This PR also fixes a couple of potential memory errors in older DMF code, found while CoPilot read through the feature code.

Parts not done (flagging as follow-up, not silently skipped):
- `dmfcore_parse_finish_cb`-level "reject whole file" behavior
  for the strict policy isn't wired yet - today the policy only
  changes logging verbosity at the existing call sites, not the
  control flow.
- DMF XML keyword for referencing `dmf_stdlib` methods by name
  (e.g. `conversion="scale_format"`) isn't parsed by `dmfsnmp.c`
  yet - the registry exists, but nothing in the XML grammar consumes it.
- old functions in `snmp-ups-helpers.c` moved up to `dmf_stdlib.c`,
  but not yet removed from the former file, to avoid breaking existing
  code until the new functions are fully wired in.
- probably more mapping subdrivers can be converted to use the new
  `dmf_stdlib` functions, but that is left for follow-up work.

Co-authored-by: Claude Sonnet
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…allocating based on it

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…rop)

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov jimklimov added enhancement DMF NUT Data/Dynamic Mapping File/Format/Functionality feature C-str Issues and PRs about C/C++ methods, headers and data types dealing with strings and memory blocks AI For good or bad, machine tools are upon us. Humans are still the responsible ones. labels Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

A ZIP file with standard source tarball and another tarball with pre-built docs for commit ec31276 is temporarily available: NUT-tarballs-PR-3615.zip.

Comment thread common/dmf_stdlib.c Dismissed
Comment thread common/dmf_stdlib.c Dismissed
Comment thread drivers/snmp-ups.c Dismissed
@AppVeyorBot

Copy link
Copy Markdown

@AppVeyorBot

Copy link
Copy Markdown

Build nut 2.8.5.5204-FTY failed (commit e0f5257639 by @jimklimov)

@AppVeyorBot

Copy link
Copy Markdown

@AppVeyorBot

Copy link
Copy Markdown

@AppVeyorBot

Copy link
Copy Markdown

@AppVeyorBot

Copy link
Copy Markdown

Build nut 2.8.5.5208-FTY failed (commit 8ad6d77e0a by @jimklimov)

jimklimov added a commit to jimklimov/nut that referenced this pull request Sep 3, 2026
…ls#3615]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@AppVeyorBot

Copy link
Copy Markdown

jimklimov added a commit to jimklimov/nut that referenced this pull request Sep 3, 2026
…ls#3615]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@AppVeyorBot

Copy link
Copy Markdown

@AppVeyorBot

Copy link
Copy Markdown

Build nut 2.8.5.5211-FTY failed (commit f8eae88877 by @jimklimov)

jimklimov added a commit to jimklimov/nut that referenced this pull request Sep 3, 2026
…ls#3615]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@AppVeyorBot

Copy link
Copy Markdown

jimklimov added a commit to jimklimov/nut that referenced this pull request Sep 3, 2026
…ls#3615]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@AppVeyorBot

Copy link
Copy Markdown

…ls#3615]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@AppVeyorBot

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI For good or bad, machine tools are upon us. Humans are still the responsible ones. C-str Issues and PRs about C/C++ methods, headers and data types dealing with strings and memory blocks DMF NUT Data/Dynamic Mapping File/Format/Functionality feature enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants