]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[settings] Change "not-found" semantics of fetch_setting_copy()
authorMichael Brown <mcb30@ipxe.org>
Fri, 19 Jul 2013 13:53:38 +0000 (14:53 +0100)
committerMichael Brown <mcb30@ipxe.org>
Fri, 19 Jul 2013 14:15:28 +0000 (15:15 +0100)
commit72fb55e437474f1322ae6c748ab0df75e5eb84b6
tree92dfebcce96b3ed40dfbac43256c6d8e76527167
parent5ffcae69c03afeab1c7b17a725376b45c91d04d9
[settings] Change "not-found" semantics of fetch_setting_copy()

fetch_settings_copy() currently returns success and a NULL data
pointer to indicate a non-existent setting.  This is intended to allow
the caller to differentiate between a non-existent setting and an
error in allocating memory for the copy of the setting.

The underlying settings blocks' fetch() methods provide no way to
perform an existence check separate from an attempt to fetch the
setting.  A "non-existent setting" therefore means simply a setting
for which an error was encountered when attempting to fetch from every
settings block within the subtree.

Since any underlying error within a settings block (e.g. a GuestRPC
failure when attempting to retrieve a VMware GuestInfo setting) will
produce the effect of a "non-existent setting", it seems somewhat
meaningless to give special treatment to memory allocation errors
within fetch_setting_copy().

Remove the special treatment and simplify the semantics of
fetch_setting_copy() by directly passing through any underlying error
(including non-existence) encountered while fetching the setting.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/core/settings.c
src/crypto/clientcert.c
src/crypto/rootcert.c