mirror of
https://github.com/ipxe/ipxe
synced 2025-12-22 13:00:39 +03:00
[settings] Formalise notion of setting applicability
Expose a function setting_applies() to allow a caller to determine whether or not a particular setting is applicable to a particular settings block. Restrict DHCP-backed settings blocks to accepting only DHCP-based settings. Restrict network device settings blocks to accepting only DHCP-based settings and network device-specific settings such as "mac". Inspired-by: Glenn Brown <glenn@myri.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -184,6 +184,19 @@ static int nvo_save ( struct nvo_block *nvo ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check applicability of NVO setting
|
||||
*
|
||||
* @v settings Settings block
|
||||
* @v setting Setting
|
||||
* @ret applies Setting applies within this settings block
|
||||
*/
|
||||
static int nvo_applies ( struct settings *settings __unused,
|
||||
struct setting *setting ) {
|
||||
|
||||
return dhcpopt_applies ( setting->tag );
|
||||
}
|
||||
|
||||
/**
|
||||
* Store value of NVO setting
|
||||
*
|
||||
@@ -236,6 +249,7 @@ static int nvo_fetch ( struct settings *settings, struct setting *setting,
|
||||
|
||||
/** NVO settings operations */
|
||||
static struct settings_operations nvo_settings_operations = {
|
||||
.applies = nvo_applies,
|
||||
.store = nvo_store,
|
||||
.fetch = nvo_fetch,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user