mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zdev: add functionality to read site-specific settings
Modify the dev_get_setting_list function to get the site-specific attributes of the device. The new site_id parameter for this function must be less than SITE_FALLBACK to read the site-specific attributes. As SITE_FALLBACK setting is same as persistent setting, we do not need a separate read function for it. Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com> Signed-off-by: Vineeth Vijayan <vneethv@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
2e89722ef0
commit
d66ace8121
@@ -883,12 +883,13 @@ static char *dev_table_get_modules(struct device *dev)
|
||||
return str;
|
||||
}
|
||||
|
||||
static char *get_attr(struct device *dev, const char *name, config_t config)
|
||||
static char *get_attr(struct device *dev, const char *name, config_t config,
|
||||
int site_id)
|
||||
{
|
||||
struct setting_list *list;
|
||||
struct setting *s;
|
||||
|
||||
list = device_get_setting_list(dev, config);
|
||||
list = device_get_setting_list(dev, config, site_id);
|
||||
if (!list)
|
||||
return NULL;
|
||||
s = setting_list_find(list, name);
|
||||
@@ -915,12 +916,17 @@ static char *dev_table_get_attr(struct device *dev, const char *attr,
|
||||
return NULL;
|
||||
name++;
|
||||
|
||||
/* To get the default settings on any configuration, make sure that
|
||||
* the site_id is specified as SITE_FALLBACK. Any value of site_id
|
||||
* less than SITE_FALLBACK will endup providing site-specific attribute
|
||||
* settings.
|
||||
*/
|
||||
if (SCOPE_ACTIVE(config))
|
||||
act = get_attr(dev, name, config_active);
|
||||
act = get_attr(dev, name, config_active, SITE_FALLBACK);
|
||||
if (SCOPE_PERSISTENT(config))
|
||||
pers = get_attr(dev, name, config_persistent);
|
||||
pers = get_attr(dev, name, config_persistent, SITE_FALLBACK);
|
||||
if (SCOPE_AUTOCONF(config))
|
||||
ac = get_attr(dev, name, config_autoconf);
|
||||
ac = get_attr(dev, name, config_autoconf, SITE_FALLBACK);
|
||||
|
||||
str = merge_str(act, pers, ac, config);
|
||||
free(act);
|
||||
|
||||
Reference in New Issue
Block a user