Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • BIND BIND
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 591
    • Issues 591
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 100
    • Merge requests 100
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • ISC Open Source ProjectsISC Open Source Projects
  • BINDBIND
  • Merge requests
  • !6195

Draft: Give the rdataset->privateN fields more helpful names

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Tony Finch requested to merge 3273-refactor-rdataset-privateN into main Apr 27, 2022
  • Overview 30
  • Commits 2
  • Pipelines 15
  • Changes 10

BIND's rdataset structure is a view of some DNS records. It is polymorphic, so the details of how the records are stored can vary. For instance, the records can be held in an rdatalist, or in an rdataslab in the rbtdb.

An rdataset had a number of fields called private1 up to private7, which were used by the various rdataset implementations. It was not at all clear what these fields were for, without reading the code and working it out from context.

This change makes the rdataset inheritance hierarchy more clear. The polymorphic part of a struct dns_rdataset is now a union of structs, each of which is named after the implementation that uses it. The fields of these structs replace the old privateN fields. I called it an "inheritance hierarchy" because there are implementations (SDB and SDLZ) which inherit from the rdatalist implementation, which in turn inherits from the generic rdataset.

Most of this change is mechanical, but there are a few extras.

In keynode.c there were a number of REQUIRE()ments that were not necessary: they had already been checked by the rdataset method dispatch code. On the other hand, In ncache.c there was a public function which needed to REQUIRE() that a generic rdataset was in fact an ncache rdataset.

I have removed lots of "reset iterator state" comments, because it should now be clear from target->iter = NULL where before target->private5 = NULL could have been doing anything.

Initialization is a bit neater in a few places, using C structure literals where appropriate.

The pointer arithmetic for translating between an rdataslab header and its raw contents is now fractionally safer.

Closes #3273

Edited Sep 14, 2022 by Petr Špaček
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: 3273-refactor-rdataset-privateN