HomeFreeBSD

A couple of small style cleanups

Description

A couple of small style cleanups

In zpool_load_compat():

  • initialize l_features[] with a loop rather than a static initializer.
  • don't redefine system constants; use private names instead

Rationale here:

When an array is initialized using a static {foo}, only the specified
members are initialized to the provided values, the rest are
initialized to zero. While B_FALSE is of course zero, it feels
unsafe to rely on this being true forever, so I'm inclined to sacrifice
a few microseconds of runtime here and initialize using a loop.

When looking for the correct combination of system constants to use
(in open() and mmap()), I prefer to use private constants rather than
redefining system ones; due to the small chance that the system
ones might be referenced later in the file. So rather than defining
O_PATH and MAP_POPULATE, I use distinct constant names.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: Colm Buckley <colm@tuatha.org>
Closes #12156

Details

Provenance
Colm <colm@tuatha.org>Authored on Jun 3 2021, 3:13 PM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Jun 9 2021, 8:05 PM
Parents
rGb1b1faf0f1e2: zfs-module-parameters.5: remove nonexistent parameters
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rGdb9048741ba4: A couple of small style cleanups (authored by Colm <colm@tuatha.org>).Jun 9 2021, 8:05 PM