mirror of
https://github.com/ipxe/ipxe
synced 2025-12-26 17:42:47 +03:00
[settings] Explicitly separate the concept of a completed fetched setting
The fetch_setting() family of functions may currently modify the definition of the specified setting (e.g. to add missing type information). Clean up this interface by requiring callers to provide an explicit buffer to contain the completed definition of the fetched setting, if required. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -204,7 +204,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 ( SETTING_NETDEV_EXTRA ) = {
|
||||
const struct setting net80211_ssid_setting __setting ( SETTING_NETDEV_EXTRA ) = {
|
||||
.name = "ssid",
|
||||
.description = "Wireless SSID",
|
||||
.type = &setting_type_string,
|
||||
@@ -216,7 +216,7 @@ struct setting net80211_ssid_setting __setting ( SETTING_NETDEV_EXTRA ) = {
|
||||
* 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 ( SETTING_NETDEV_EXTRA ) = {
|
||||
const struct setting net80211_active_setting __setting ( SETTING_NETDEV_EXTRA ) = {
|
||||
.name = "active-scan",
|
||||
.description = "Actively scan for wireless networks",
|
||||
.type = &setting_type_int8,
|
||||
@@ -228,7 +228,7 @@ struct setting net80211_active_setting __setting ( SETTING_NETDEV_EXTRA ) = {
|
||||
* normal iPXE method for entering hex settings; an ASCII string of
|
||||
* hex characters will not behave as expected.
|
||||
*/
|
||||
struct setting net80211_key_setting __setting ( SETTING_NETDEV_EXTRA ) = {
|
||||
const struct setting net80211_key_setting __setting ( SETTING_NETDEV_EXTRA ) = {
|
||||
.name = "key",
|
||||
.description = "Wireless encryption key",
|
||||
.type = &setting_type_string,
|
||||
|
||||
@@ -236,8 +236,8 @@ static int trivial_init ( struct net80211_device *dev )
|
||||
dev->associating->crypto == NET80211_CRYPT_NONE )
|
||||
return 0; /* no crypto? OK. */
|
||||
|
||||
len = fetch_setting ( netdev_settings ( dev->netdev ),
|
||||
&net80211_key_setting, key, WEP_MAX_KEY );
|
||||
len = fetch_raw_setting ( netdev_settings ( dev->netdev ),
|
||||
&net80211_key_setting, key, WEP_MAX_KEY );
|
||||
|
||||
if ( len <= 0 ) {
|
||||
DBGC ( dev, "802.11 %p cannot do WEP without a key\n", dev );
|
||||
@@ -278,8 +278,8 @@ static int trivial_change_key ( struct net80211_device *dev )
|
||||
if ( ! dev->crypto || ( dev->crypto->init != wep_init ) )
|
||||
change ^= 1;
|
||||
|
||||
len = fetch_setting ( netdev_settings ( dev->netdev ),
|
||||
&net80211_key_setting, key, WEP_MAX_KEY );
|
||||
len = fetch_raw_setting ( netdev_settings ( dev->netdev ),
|
||||
&net80211_key_setting, key, WEP_MAX_KEY );
|
||||
if ( len <= 0 )
|
||||
change ^= 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user