Переглянути джерело

[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 <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 роки тому
джерело
коміт
8482451812

+ 6
- 6
src/core/settings.c Переглянути файл

@@ -1672,7 +1672,7 @@ char * expand_settings ( const char *string ) {
1672 1672
  */
1673 1673
 
1674 1674
 /** Hostname setting */
1675
-struct setting hostname_setting __setting = {
1675
+struct setting hostname_setting __setting ( SETTING_HOST ) = {
1676 1676
 	.name = "hostname",
1677 1677
 	.description = "Host name",
1678 1678
 	.tag = DHCP_HOST_NAME,
@@ -1680,7 +1680,7 @@ struct setting hostname_setting __setting = {
1680 1680
 };
1681 1681
 
1682 1682
 /** Filename setting */
1683
-struct setting filename_setting __setting = {
1683
+struct setting filename_setting __setting ( SETTING_BOOT ) = {
1684 1684
 	.name = "filename",
1685 1685
 	.description = "Boot filename",
1686 1686
 	.tag = DHCP_BOOTFILE_NAME,
@@ -1688,7 +1688,7 @@ struct setting filename_setting __setting = {
1688 1688
 };
1689 1689
 
1690 1690
 /** Root path setting */
1691
-struct setting root_path_setting __setting = {
1691
+struct setting root_path_setting __setting ( SETTING_SANBOOT ) = {
1692 1692
 	.name = "root-path",
1693 1693
 	.description = "iSCSI root path",
1694 1694
 	.tag = DHCP_ROOT_PATH,
@@ -1696,7 +1696,7 @@ struct setting root_path_setting __setting = {
1696 1696
 };
1697 1697
 
1698 1698
 /** Username setting */
1699
-struct setting username_setting __setting = {
1699
+struct setting username_setting __setting ( SETTING_AUTH ) = {
1700 1700
 	.name = "username",
1701 1701
 	.description = "User name",
1702 1702
 	.tag = DHCP_EB_USERNAME,
@@ -1704,7 +1704,7 @@ struct setting username_setting __setting = {
1704 1704
 };
1705 1705
 
1706 1706
 /** Password setting */
1707
-struct setting password_setting __setting = {
1707
+struct setting password_setting __setting ( SETTING_AUTH ) = {
1708 1708
 	.name = "password",
1709 1709
 	.description = "Password",
1710 1710
 	.tag = DHCP_EB_PASSWORD,
@@ -1712,7 +1712,7 @@ struct setting password_setting __setting = {
1712 1712
 };
1713 1713
 
1714 1714
 /** Priority setting */
1715
-struct setting priority_setting __setting = {
1715
+struct setting priority_setting __setting ( SETTING_MISC ) = {
1716 1716
 	.name = "priority",
1717 1717
 	.description = "Priority of these settings",
1718 1718
 	.tag = DHCP_EB_PRIORITY,

+ 1
- 1
src/include/ipxe/net80211.h Переглянути файл

@@ -1093,7 +1093,7 @@ struct net80211_wlan
1093 1093
 
1094 1094
 
1095 1095
 /** 802.11 encryption key setting */
1096
-extern struct setting net80211_key_setting __setting;
1096
+extern struct setting net80211_key_setting __setting ( SETTING_NETDEV_EXTRA );
1097 1097
 
1098 1098
 
1099 1099
 /**

+ 35
- 17
src/include/ipxe/settings.h Переглянути файл

@@ -65,7 +65,27 @@ struct setting {
65 65
 #define SETTINGS __table ( struct setting, "settings" )
66 66
 
67 67
 /** Declare a configuration setting */
68
-#define __setting __table_entry ( SETTINGS, 01 )
68
+#define __setting( setting_order ) __table_entry ( SETTINGS, setting_order )
69
+
70
+/** @defgroup setting_order Setting ordering
71
+ * @{
72
+ */
73
+
74
+#define SETTING_NETDEV		01 /**< Network device settings */
75
+#define SETTING_NETDEV_EXTRA	02 /**< Network device additional settings */
76
+#define SETTING_IPv4		03 /**< IPv4 settings */
77
+#define SETTING_IPv4_EXTRA	04 /**< IPv4 additional settings */
78
+#define SETTING_BOOT		05 /**< Generic boot settings */
79
+#define SETTING_BOOT_EXTRA	06 /**< Generic boot additional settings */
80
+#define SETTING_SANBOOT		07 /**< SAN boot settings */
81
+#define SETTING_SANBOOT_EXTRA	08 /**< SAN boot additional settings */
82
+#define SETTING_HOST		09 /**< Host identity settings */
83
+#define SETTING_HOST_EXTRA	10 /**< Host identity additional settings */
84
+#define SETTING_AUTH		11 /**< Authentication settings */
85
+#define SETTING_AUTH_EXTRA	12 /**< Authentication additional settings */
86
+#define SETTING_MISC		13 /**< Miscellaneous settings */
87
+
88
+/** @} */
69 89
 
70 90
 /** Settings block operations */
71 91
 struct settings_operations {
@@ -273,22 +293,20 @@ extern struct setting_type setting_type_uint32 __setting_type;
273 293
 extern struct setting_type setting_type_hex __setting_type;
274 294
 extern struct setting_type setting_type_uuid __setting_type;
275 295
 
276
-extern struct setting ip_setting __setting;
277
-extern struct setting netmask_setting __setting;
278
-extern struct setting gateway_setting __setting;
279
-extern struct setting dns_setting __setting;
280
-extern struct setting domain_setting __setting;
281
-extern struct setting hostname_setting __setting;
282
-extern struct setting filename_setting __setting;
283
-extern struct setting root_path_setting __setting;
284
-extern struct setting username_setting __setting;
285
-extern struct setting password_setting __setting;
286
-extern struct setting priority_setting __setting;
287
-extern struct setting uuid_setting __setting;
288
-extern struct setting next_server_setting __setting;
289
-extern struct setting mac_setting __setting;
290
-extern struct setting busid_setting __setting;
291
-extern struct setting user_class_setting __setting;
296
+extern struct setting ip_setting __setting ( SETTING_IPv4 );
297
+extern struct setting netmask_setting __setting ( SETTING_IPv4 );
298
+extern struct setting gateway_setting __setting ( SETTING_IPv4 );
299
+extern struct setting dns_setting __setting ( SETTING_IPv4_EXTRA );
300
+extern struct setting hostname_setting __setting ( SETTING_HOST );
301
+extern struct setting filename_setting __setting ( SETTING_BOOT );
302
+extern struct setting root_path_setting __setting ( SETTING_SANBOOT );
303
+extern struct setting username_setting __setting ( SETTING_AUTH );
304
+extern struct setting password_setting __setting ( SETTING_AUTH );
305
+extern struct setting priority_setting __setting ( SETTING_MISC );
306
+extern struct setting uuid_setting __setting ( SETTING_HOST );
307
+extern struct setting next_server_setting __setting ( SETTING_BOOT );
308
+extern struct setting mac_setting __setting ( SETTING_NETDEV );
309
+extern struct setting busid_setting __setting ( SETTING_NETDEV );
292 310
 
293 311
 /**
294 312
  * Initialise a settings block

+ 2
- 2
src/interface/smbios/smbios_settings.c Переглянути файл

@@ -165,7 +165,7 @@ struct init_fn smbios_init_fn __init_fn ( INIT_NORMAL ) = {
165 165
 };
166 166
 
167 167
 /** UUID setting obtained via SMBIOS */
168
-struct setting uuid_setting __setting = {
168
+struct setting uuid_setting __setting ( SETTING_HOST ) = {
169 169
 	.name = "uuid",
170 170
 	.description = "UUID",
171 171
 	.tag = SMBIOS_RAW_TAG ( SMBIOS_TYPE_SYSTEM_INFORMATION,
@@ -174,7 +174,7 @@ struct setting uuid_setting __setting = {
174 174
 };
175 175
 
176 176
 /** Other SMBIOS named settings */
177
-struct setting smbios_named_settings[] __setting = {
177
+struct setting smbios_named_settings[] __setting ( SETTING_HOST_EXTRA ) = {
178 178
 	{
179 179
 		.name = "manufacturer",
180 180
 		.description = "Manufacturer",

+ 3
- 3
src/net/80211/net80211.c Переглянути файл

@@ -202,7 +202,7 @@ struct settings_applicator net80211_applicator __settings_applicator = {
202 202
  * If this is blank, we scan for all networks and use the one with the
203 203
  * greatest signal strength.
204 204
  */
205
-struct setting net80211_ssid_setting __setting = {
205
+struct setting net80211_ssid_setting __setting ( SETTING_NETDEV_EXTRA ) = {
206 206
 	.name = "ssid",
207 207
 	.description = "802.11 SSID (network name)",
208 208
 	.type = &setting_type_string,
@@ -215,7 +215,7 @@ struct setting net80211_ssid_setting __setting = {
215 215
  * active scan (send probe packets). If this setting is nonzero, an
216 216
  * active scan on the 2.4GHz band will be used to associate.
217 217
  */
218
-struct setting net80211_active_setting __setting = {
218
+struct setting net80211_active_setting __setting ( SETTING_NETDEV_EXTRA ) = {
219 219
 	.name = "active-scan",
220 220
 	.description = "Use an active scan during 802.11 association",
221 221
 	.type = &setting_type_int8,
@@ -228,7 +228,7 @@ struct setting net80211_active_setting __setting = {
228 228
  * normal iPXE method for entering hex settings; an ASCII string of
229 229
  * hex characters will not behave as expected.
230 230
  */
231
-struct setting net80211_key_setting __setting = {
231
+struct setting net80211_key_setting __setting ( SETTING_NETDEV_EXTRA ) = {
232 232
 	.name = "key",
233 233
 	.description = "Encryption key for protected 802.11 networks",
234 234
 	.type = &setting_type_string,

+ 3
- 3
src/net/ipv4.c Переглянути файл

@@ -554,7 +554,7 @@ struct arp_net_protocol ipv4_arp_protocol __arp_net_protocol = {
554 554
  */
555 555
 
556 556
 /** IPv4 address setting */
557
-struct setting ip_setting __setting = {
557
+struct setting ip_setting __setting ( SETTING_IPv4 ) = {
558 558
 	.name = "ip",
559 559
 	.description = "IPv4 address",
560 560
 	.tag = DHCP_EB_YIADDR,
@@ -562,7 +562,7 @@ struct setting ip_setting __setting = {
562 562
 };
563 563
 
564 564
 /** IPv4 subnet mask setting */
565
-struct setting netmask_setting __setting = {
565
+struct setting netmask_setting __setting ( SETTING_IPv4 ) = {
566 566
 	.name = "netmask",
567 567
 	.description = "IPv4 subnet mask",
568 568
 	.tag = DHCP_SUBNET_MASK,
@@ -570,7 +570,7 @@ struct setting netmask_setting __setting = {
570 570
 };
571 571
 
572 572
 /** Default gateway setting */
573
-struct setting gateway_setting __setting = {
573
+struct setting gateway_setting __setting ( SETTING_IPv4 ) = {
574 574
 	.name = "gateway",
575 575
 	.description = "Default gateway",
576 576
 	.tag = DHCP_ROUTERS,

+ 2
- 2
src/net/netdev_settings.c Переглянути файл

@@ -34,13 +34,13 @@ FILE_LICENCE ( GPL2_OR_LATER );
34 34
  */
35 35
 
36 36
 /** Network device named settings */
37
-struct setting mac_setting __setting = {
37
+struct setting mac_setting __setting ( SETTING_NETDEV ) = {
38 38
 	.name = "mac",
39 39
 	.description = "MAC address",
40 40
 	.type = &setting_type_hex,
41 41
 	.tag = NETDEV_SETTING_TAG_MAC,
42 42
 };
43
-struct setting busid_setting __setting = {
43
+struct setting busid_setting __setting ( SETTING_NETDEV ) = {
44 44
 	.name = "busid",
45 45
 	.description = "Bus ID",
46 46
 	.type = &setting_type_hex,

+ 3
- 3
src/net/tcp/iscsi.c Переглянути файл

@@ -1820,7 +1820,7 @@ enum iscsi_root_path_component {
1820 1820
 };
1821 1821
 
1822 1822
 /** iSCSI initiator IQN setting */
1823
-struct setting initiator_iqn_setting __setting = {
1823
+struct setting initiator_iqn_setting __setting ( SETTING_SANBOOT_EXTRA ) = {
1824 1824
 	.name = "initiator-iqn",
1825 1825
 	.description = "iSCSI initiator name",
1826 1826
 	.tag = DHCP_ISCSI_INITIATOR_IQN,
@@ -1828,7 +1828,7 @@ struct setting initiator_iqn_setting __setting = {
1828 1828
 };
1829 1829
 
1830 1830
 /** iSCSI reverse username setting */
1831
-struct setting reverse_username_setting __setting = {
1831
+struct setting reverse_username_setting __setting ( SETTING_AUTH_EXTRA ) = {
1832 1832
 	.name = "reverse-username",
1833 1833
 	.description = "Reverse user name",
1834 1834
 	.tag = DHCP_EB_REVERSE_USERNAME,
@@ -1836,7 +1836,7 @@ struct setting reverse_username_setting __setting = {
1836 1836
 };
1837 1837
 
1838 1838
 /** iSCSI reverse password setting */
1839
-struct setting reverse_password_setting __setting = {
1839
+struct setting reverse_password_setting __setting ( SETTING_AUTH_EXTRA ) = {
1840 1840
 	.name = "reverse-password",
1841 1841
 	.description = "Reverse password",
1842 1842
 	.tag = DHCP_EB_REVERSE_PASSWORD,

+ 3
- 3
src/net/udp/dhcp.c Переглянути файл

@@ -93,7 +93,7 @@ static uint8_t dhcp_request_options_data[] = {
93 93
 FEATURE_VERSION ( VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH );
94 94
 
95 95
 /** DHCP server address setting */
96
-struct setting dhcp_server_setting __setting = {
96
+struct setting dhcp_server_setting __setting ( SETTING_MISC ) = {
97 97
 	.name = "dhcp-server",
98 98
 	.description = "DHCP server address",
99 99
 	.tag = DHCP_SERVER_IDENTIFIER,
@@ -101,7 +101,7 @@ struct setting dhcp_server_setting __setting = {
101 101
 };
102 102
 
103 103
 /** DHCP user class setting */
104
-struct setting user_class_setting __setting = {
104
+struct setting user_class_setting __setting ( SETTING_HOST_EXTRA ) = {
105 105
 	.name = "user-class",
106 106
 	.description = "User class identifier",
107 107
 	.tag = DHCP_USER_CLASS_ID,
@@ -109,7 +109,7 @@ struct setting user_class_setting __setting = {
109 109
 };
110 110
 
111 111
 /** Use cached network settings */
112
-struct setting use_cached_setting __setting = {
112
+struct setting use_cached_setting __setting ( SETTING_MISC ) = {
113 113
 	.name = "use-cached",
114 114
 	.description = "Use cached network settings",
115 115
 	.tag = DHCP_EB_USE_CACHED,

+ 2
- 2
src/net/udp/dns.c Переглянути файл

@@ -587,7 +587,7 @@ struct resolver dns_resolver __resolver ( RESOLV_NORMAL ) = {
587 587
  */
588 588
 
589 589
 /** DNS server setting */
590
-struct setting dns_setting __setting = {
590
+struct setting dns_setting __setting ( SETTING_IPv4_EXTRA ) = {
591 591
 	.name = "dns",
592 592
 	.description = "DNS server",
593 593
 	.tag = DHCP_DNS_SERVERS,
@@ -595,7 +595,7 @@ struct setting dns_setting __setting = {
595 595
 };
596 596
 
597 597
 /** Domain name setting */
598
-struct setting domain_setting __setting = {
598
+struct setting domain_setting __setting ( SETTING_IPv4_EXTRA ) = {
599 599
 	.name = "domain",
600 600
 	.description = "Local domain",
601 601
 	.tag = DHCP_DOMAIN_NAME,

+ 1
- 1
src/net/udp/syslog.c Переглянути файл

@@ -146,7 +146,7 @@ struct console_driver syslog_console __console_driver = {
146 146
  */
147 147
 
148 148
 /** Syslog server setting */
149
-struct setting syslog_setting __setting = {
149
+struct setting syslog_setting __setting ( SETTING_MISC ) = {
150 150
 	.name = "syslog",
151 151
 	.description = "Syslog server",
152 152
 	.tag = DHCP_LOG_SERVERS,

+ 1
- 1
src/net/udp/tftp.c Переглянути файл

@@ -1215,7 +1215,7 @@ struct uri_opener mtftp_uri_opener __uri_opener = {
1215 1215
  */
1216 1216
 
1217 1217
 /** TFTP server setting */
1218
-struct setting next_server_setting __setting = {
1218
+struct setting next_server_setting __setting ( SETTING_BOOT ) = {
1219 1219
 	.name = "next-server",
1220 1220
 	.description = "TFTP server",
1221 1221
 	.tag = DHCP_EB_SIADDR,

+ 2
- 2
src/usr/autoboot.c Переглянути файл

@@ -99,7 +99,7 @@ static struct uri * parse_next_server_and_filename ( struct in_addr next_server,
99 99
 }
100 100
 
101 101
 /** The "keep-san" setting */
102
-struct setting keep_san_setting __setting = {
102
+struct setting keep_san_setting __setting ( SETTING_SANBOOT_EXTRA ) = {
103 103
 	.name = "keep-san",
104 104
 	.description = "Preserve SAN connection",
105 105
 	.tag = DHCP_EB_KEEP_SAN,
@@ -107,7 +107,7 @@ struct setting keep_san_setting __setting = {
107 107
 };
108 108
 
109 109
 /** The "skip-san-boot" setting */
110
-struct setting skip_san_boot_setting __setting = {
110
+struct setting skip_san_boot_setting __setting ( SETTING_SANBOOT_EXTRA ) = {
111 111
 	.name = "skip-san-boot",
112 112
 	.description = "Do not boot the SAN drive after connecting",
113 113
 	.tag = DHCP_EB_SKIP_SAN_BOOT,

Завантаження…
Відмінити
Зберегти