]> git.ipfire.org Git - thirdparty/util-linux.git/commit
chmem: add helper function to sensibly detect the 'valid_zones' attribute
authorChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Mon, 25 May 2026 20:38:53 +0000 (16:38 -0400)
committerChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Tue, 26 May 2026 11:03:13 +0000 (07:03 -0400)
commit3f53e5d2d5dae65538465210da8dbb0380ede62a
tree52873c16caa122540853cb196deebf27e562174a
parent0599e6a1bc3cf622343e6df8853c5bfe79286c65
chmem: add helper function to sensibly detect the 'valid_zones' attribute

On some systems the first available memory blocks start at an index
greater than 0, and on such systems we fail to properly detect the
valid_zones attribute, because we naively checked for the presence
of the memory block directory 'memory0'. To sensibly and reliably
detect the first memory block, we can use the directory sysmem->dirs
that are sorted in numeric order, so we can assume that the first
entry is the first memory block, i.e. sysmem->dirs[0]->d_name is
the name of the first configurable memory block.

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
sys-utils/chmem.c