From 8482451812d6b48e65a1016447f30591099ded62 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 23 Mar 2011 11:57:29 +0000 Subject: [settings] Impose a fixed order on settings Improve the appearance of the "config" user interface by ensuring that settings appear in some kind of logical order. Signed-off-by: Michael Brown --- src/core/settings.c | 12 ++++---- src/include/ipxe/net80211.h | 2 +- src/include/ipxe/settings.h | 52 +++++++++++++++++++++++----------- src/interface/smbios/smbios_settings.c | 4 +-- src/net/80211/net80211.c | 6 ++-- src/net/ipv4.c | 6 ++-- src/net/netdev_settings.c | 4 +-- src/net/tcp/iscsi.c | 6 ++-- src/net/udp/dhcp.c | 6 ++-- src/net/udp/dns.c | 4 +-- src/net/udp/syslog.c | 2 +- src/net/udp/tftp.c | 2 +- src/usr/autoboot.c | 4 +-- 13 files changed, 64 insertions(+), 46 deletions(-) diff --git a/src/core/settings.c b/src/core/settings.c index d498db6..b9df5a7 100644 --- a/src/core/settings.c +++ b/src/core/settings.c @@ -1672,7 +1672,7 @@ char * expand_settings ( const char *string ) { */ /** Hostname setting */ -struct setting hostname_setting __setting = { +struct setting hostname_setting __setting ( SETTING_HOST ) = { .name = "hostname", .description = "Host name", .tag = DHCP_HOST_NAME, @@ -1680,7 +1680,7 @@ struct setting hostname_setting __setting = { }; /** Filename setting */ -struct setting filename_setting __setting = { +struct setting filename_setting __setting ( SETTING_BOOT ) = { .name = "filename", .description = "Boot filename", .tag = DHCP_BOOTFILE_NAME, @@ -1688,7 +1688,7 @@ struct setting filename_setting __setting = { }; /** Root path setting */ -struct setting root_path_setting __setting = { +struct setting root_path_setting __setting ( SETTING_SANBOOT ) = { .name = "root-path", .description = "iSCSI root path", .tag = DHCP_ROOT_PATH, @@ -1696,7 +1696,7 @@ struct setting root_path_setting __setting = { }; /** Username setting */ -struct setting username_setting __setting = { +struct setting username_setting __setting ( SETTING_AUTH ) = { .name = "username", .description = "User name", .tag = DHCP_EB_USERNAME, @@ -1704,7 +1704,7 @@ struct setting username_setting __setting = { }; /** Password setting */ -struct setting password_setting __setting = { +struct setting password_setting __setting ( SETTING_AUTH ) = { .name = "password", .description = "Password", .tag = DHCP_EB_PASSWORD, @@ -1712,7 +1712,7 @@ struct setting password_setting __setting = { }; /** Priority setting */ -struct setting priority_setting __setting = { +struct setting priority_setting __setting ( SETTING_MISC ) = { .name = "priority", .description = "Priority of these settings", .tag = DHCP_EB_PRIORITY, diff --git a/src/include/ipxe/net80211.h b/src/include/ipxe/net80211.h index ac844b4..3c30f06 100644 --- a/src/include/ipxe/net80211.h +++ b/src/include/ipxe/net80211.h @@ -1093,7 +1093,7 @@ struct net80211_wlan /** 802.11 encryption key setting */ -extern struct setting net80211_key_setting __setting; +extern struct setting net80211_key_setting __setting ( SETTING_NETDEV_EXTRA ); /** diff --git a/src/include/ipxe/settings.h b/src/include/ipxe/settings.h index 724877f..0f1ec5b 100644 --- a/src/include/ipxe/settings.h +++ b/src/include/ipxe/settings.h @@ -65,7 +65,27 @@ struct setting { #define SETTINGS __table ( struct setting, "settings" ) /** Declare a configuration setting */ -#define __setting __table_entry ( SETTINGS, 01 ) +#define __setting( setting_order ) __table_entry ( SETTINGS, setting_order ) + +/** @defgroup setting_order Setting ordering + * @{ + */ + +#define SETTING_NETDEV 01 /**< Network device settings */ +#define SETTING_NETDEV_EXTRA 02 /**< Network device additional settings */ +#define SETTING_IPv4 03 /**< IPv4 settings */ +#define SETTING_IPv4_EXTRA 04 /**< IPv4 additional settings */ +#define SETTING_BOOT 05 /**< Generic boot settings */ +#define SETTING_BOOT_EXTRA 06 /**< Generic boot additional settings */ +#define SETTING_SANBOOT 07 /**< SAN boot settings */ +#define SETTING_SANBOOT_EXTRA 08 /**< SAN boot additional settings */ +#define SETTING_HOST 09 /**< Host identity settings */ +#define SETTING_HOST_EXTRA 10 /**< Host identity additional settings */ +#define SETTING_AUTH 11 /**< Authentication settings */ +#define SETTING_AUTH_EXTRA 12 /**< Authentication additional settings */ +#define SETTING_MISC 13 /**< Miscellaneous settings */ + +/** @} */ /** Settings block operations */ struct settings_operations { @@ -273,22 +293,20 @@ extern struct setting_type setting_type_uint32 __setting_type; extern struct setting_type setting_type_hex __setting_type; extern struct setting_type setting_type_uuid __setting_type; -extern struct setting ip_setting __setting; -extern struct setting netmask_setting __setting; -extern struct setting gateway_setting __setting; -extern struct setting dns_setting __setting; -extern struct setting domain_setting __setting; -extern struct setting hostname_setting __setting; -extern struct setting filename_setting __setting; -extern struct setting root_path_setting __setting; -extern struct setting username_setting __setting; -extern struct setting password_setting __setting; -extern struct setting priority_setting __setting; -extern struct setting uuid_setting __setting; -extern struct setting next_server_setting __setting; -extern struct setting mac_setting __setting; -extern struct setting busid_setting __setting; -extern struct setting user_class_setting __setting; +extern struct setting ip_setting __setting ( SETTING_IPv4 ); +extern struct setting netmask_setting __setting ( SETTING_IPv4 ); +extern struct setting gateway_setting __setting ( SETTING_IPv4 ); +extern struct setting dns_setting __setting ( SETTING_IPv4_EXTRA ); +extern struct setting hostname_setting __setting ( SETTING_HOST ); +extern struct setting filename_setting __setting ( SETTING_BOOT ); +extern struct setting root_path_setting __setting ( SETTING_SANBOOT ); +extern struct setting username_setting __setting ( SETTING_AUTH ); +extern struct setting password_setting __setting ( SETTING_AUTH ); +extern struct setting priority_setting __setting ( SETTING_MISC ); +extern struct setting uuid_setting __setting ( SETTING_HOST ); +extern struct setting next_server_setting __setting ( SETTING_BOOT ); +extern struct setting mac_setting __setting ( SETTING_NETDEV ); +extern struct setting busid_setting __setting ( SETTING_NETDEV ); /** * Initialise a settings block diff --git a/src/interface/smbios/smbios_settings.c b/src/interface/smbios/smbios_settings.c index 6594c94..92dc412 100644 --- a/src/interface/smbios/smbios_settings.c +++ b/src/interface/smbios/smbios_settings.c @@ -165,7 +165,7 @@ struct init_fn smbios_init_fn __init_fn ( INIT_NORMAL ) = { }; /** UUID setting obtained via SMBIOS */ -struct setting uuid_setting __setting = { +struct setting uuid_setting __setting ( SETTING_HOST ) = { .name = "uuid", .description = "UUID", .tag = SMBIOS_RAW_TAG ( SMBIOS_TYPE_SYSTEM_INFORMATION, @@ -174,7 +174,7 @@ struct setting uuid_setting __setting = { }; /** Other SMBIOS named settings */ -struct setting smbios_named_settings[] __setting = { +struct setting smbios_named_settings[] __setting ( SETTING_HOST_EXTRA ) = { { .name = "manufacturer", .description = "Manufacturer", diff --git a/src/net/80211/net80211.c b/src/net/80211/net80211.c index c42928e..3bbca19 100644 --- a/src/net/80211/net80211.c +++ b/src/net/80211/net80211.c @@ -202,7 +202,7 @@ struct settings_applicator net80211_applicator __settings_applicator = { * If this is blank, we scan for all networks and use the one with the * greatest signal strength. */ -struct setting net80211_ssid_setting __setting = { +struct setting net80211_ssid_setting __setting ( SETTING_NETDEV_EXTRA ) = { .name = "ssid", .description = "802.11 SSID (network name)", .type = &setting_type_string, @@ -215,7 +215,7 @@ struct setting net80211_ssid_setting __setting = { * active scan (send probe packets). If this setting is nonzero, an * active scan on the 2.4GHz band will be used to associate. */ -struct setting net80211_active_setting __setting = { +struct setting net80211_active_setting __setting ( SETTING_NETDEV_EXTRA ) = { .name = "active-scan", .description = "Use an active scan during 802.11 association", .type = &setting_type_int8, @@ -228,7 +228,7 @@ struct setting net80211_active_setting __setting = { * normal iPXE method for entering hex settings; an ASCII string of * hex characters will not behave as expected. */ -struct setting net80211_key_setting __setting = { +struct setting net80211_key_setting __setting ( SETTING_NETDEV_EXTRA ) = { .name = "key", .description = "Encryption key for protected 802.11 networks", .type = &setting_type_string, diff --git a/src/net/ipv4.c b/src/net/ipv4.c index f6a1e6e..3d6d738 100644 --- a/src/net/ipv4.c +++ b/src/net/ipv4.c @@ -554,7 +554,7 @@ struct arp_net_protocol ipv4_arp_protocol __arp_net_protocol = { */ /** IPv4 address setting */ -struct setting ip_setting __setting = { +struct setting ip_setting __setting ( SETTING_IPv4 ) = { .name = "ip", .description = "IPv4 address", .tag = DHCP_EB_YIADDR, @@ -562,7 +562,7 @@ struct setting ip_setting __setting = { }; /** IPv4 subnet mask setting */ -struct setting netmask_setting __setting = { +struct setting netmask_setting __setting ( SETTING_IPv4 ) = { .name = "netmask", .description = "IPv4 subnet mask", .tag = DHCP_SUBNET_MASK, @@ -570,7 +570,7 @@ struct setting netmask_setting __setting = { }; /** Default gateway setting */ -struct setting gateway_setting __setting = { +struct setting gateway_setting __setting ( SETTING_IPv4 ) = { .name = "gateway", .description = "Default gateway", .tag = DHCP_ROUTERS, diff --git a/src/net/netdev_settings.c b/src/net/netdev_settings.c index 220ffa9..2ef3984 100644 --- a/src/net/netdev_settings.c +++ b/src/net/netdev_settings.c @@ -34,13 +34,13 @@ FILE_LICENCE ( GPL2_OR_LATER ); */ /** Network device named settings */ -struct setting mac_setting __setting = { +struct setting mac_setting __setting ( SETTING_NETDEV ) = { .name = "mac", .description = "MAC address", .type = &setting_type_hex, .tag = NETDEV_SETTING_TAG_MAC, }; -struct setting busid_setting __setting = { +struct setting busid_setting __setting ( SETTING_NETDEV ) = { .name = "busid", .description = "Bus ID", .type = &setting_type_hex, diff --git a/src/net/tcp/iscsi.c b/src/net/tcp/iscsi.c index 6ae0eab..cde3ed6 100644 --- a/src/net/tcp/iscsi.c +++ b/src/net/tcp/iscsi.c @@ -1820,7 +1820,7 @@ enum iscsi_root_path_component { }; /** iSCSI initiator IQN setting */ -struct setting initiator_iqn_setting __setting = { +struct setting initiator_iqn_setting __setting ( SETTING_SANBOOT_EXTRA ) = { .name = "initiator-iqn", .description = "iSCSI initiator name", .tag = DHCP_ISCSI_INITIATOR_IQN, @@ -1828,7 +1828,7 @@ struct setting initiator_iqn_setting __setting = { }; /** iSCSI reverse username setting */ -struct setting reverse_username_setting __setting = { +struct setting reverse_username_setting __setting ( SETTING_AUTH_EXTRA ) = { .name = "reverse-username", .description = "Reverse user name", .tag = DHCP_EB_REVERSE_USERNAME, @@ -1836,7 +1836,7 @@ struct setting reverse_username_setting __setting = { }; /** iSCSI reverse password setting */ -struct setting reverse_password_setting __setting = { +struct setting reverse_password_setting __setting ( SETTING_AUTH_EXTRA ) = { .name = "reverse-password", .description = "Reverse password", .tag = DHCP_EB_REVERSE_PASSWORD, diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c index e6d127a..d4f4ede 100644 --- a/src/net/udp/dhcp.c +++ b/src/net/udp/dhcp.c @@ -93,7 +93,7 @@ static uint8_t dhcp_request_options_data[] = { FEATURE_VERSION ( VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH ); /** DHCP server address setting */ -struct setting dhcp_server_setting __setting = { +struct setting dhcp_server_setting __setting ( SETTING_MISC ) = { .name = "dhcp-server", .description = "DHCP server address", .tag = DHCP_SERVER_IDENTIFIER, @@ -101,7 +101,7 @@ struct setting dhcp_server_setting __setting = { }; /** DHCP user class setting */ -struct setting user_class_setting __setting = { +struct setting user_class_setting __setting ( SETTING_HOST_EXTRA ) = { .name = "user-class", .description = "User class identifier", .tag = DHCP_USER_CLASS_ID, @@ -109,7 +109,7 @@ struct setting user_class_setting __setting = { }; /** Use cached network settings */ -struct setting use_cached_setting __setting = { +struct setting use_cached_setting __setting ( SETTING_MISC ) = { .name = "use-cached", .description = "Use cached network settings", .tag = DHCP_EB_USE_CACHED, diff --git a/src/net/udp/dns.c b/src/net/udp/dns.c index 2326284..31a355f 100644 --- a/src/net/udp/dns.c +++ b/src/net/udp/dns.c @@ -587,7 +587,7 @@ struct resolver dns_resolver __resolver ( RESOLV_NORMAL ) = { */ /** DNS server setting */ -struct setting dns_setting __setting = { +struct setting dns_setting __setting ( SETTING_IPv4_EXTRA ) = { .name = "dns", .description = "DNS server", .tag = DHCP_DNS_SERVERS, @@ -595,7 +595,7 @@ struct setting dns_setting __setting = { }; /** Domain name setting */ -struct setting domain_setting __setting = { +struct setting domain_setting __setting ( SETTING_IPv4_EXTRA ) = { .name = "domain", .description = "Local domain", .tag = DHCP_DOMAIN_NAME, diff --git a/src/net/udp/syslog.c b/src/net/udp/syslog.c index f81ba2f..6d9fc21 100644 --- a/src/net/udp/syslog.c +++ b/src/net/udp/syslog.c @@ -146,7 +146,7 @@ struct console_driver syslog_console __console_driver = { */ /** Syslog server setting */ -struct setting syslog_setting __setting = { +struct setting syslog_setting __setting ( SETTING_MISC ) = { .name = "syslog", .description = "Syslog server", .tag = DHCP_LOG_SERVERS, diff --git a/src/net/udp/tftp.c b/src/net/udp/tftp.c index 777632e..f4e9f4c 100644 --- a/src/net/udp/tftp.c +++ b/src/net/udp/tftp.c @@ -1215,7 +1215,7 @@ struct uri_opener mtftp_uri_opener __uri_opener = { */ /** TFTP server setting */ -struct setting next_server_setting __setting = { +struct setting next_server_setting __setting ( SETTING_BOOT ) = { .name = "next-server", .description = "TFTP server", .tag = DHCP_EB_SIADDR, diff --git a/src/usr/autoboot.c b/src/usr/autoboot.c index f8eb71c..760e91c 100644 --- a/src/usr/autoboot.c +++ b/src/usr/autoboot.c @@ -99,7 +99,7 @@ static struct uri * parse_next_server_and_filename ( struct in_addr next_server, } /** The "keep-san" setting */ -struct setting keep_san_setting __setting = { +struct setting keep_san_setting __setting ( SETTING_SANBOOT_EXTRA ) = { .name = "keep-san", .description = "Preserve SAN connection", .tag = DHCP_EB_KEEP_SAN, @@ -107,7 +107,7 @@ struct setting keep_san_setting __setting = { }; /** The "skip-san-boot" setting */ -struct setting skip_san_boot_setting __setting = { +struct setting skip_san_boot_setting __setting ( SETTING_SANBOOT_EXTRA ) = { .name = "skip-san-boot", .description = "Do not boot the SAN drive after connecting", .tag = DHCP_EB_SKIP_SAN_BOOT, -- cgit v1.1