summaryrefslogtreecommitdiffstats
path: root/src/net/netdev_settings.c
diff options
context:
space:
mode:
authorMichael Brown2013-12-03 17:48:56 +0100
committerMichael Brown2013-12-05 01:37:02 +0100
commit22001cb206c1320aee27f679a63d2171d35e99c5 (patch)
treea972bb914371a68d4925dcc007238dcb836546ba /src/net/netdev_settings.c
parent[fbcon] Add support for displaying a cursor (diff)
downloadipxe-22001cb206c1320aee27f679a63d2171d35e99c5.tar.gz
ipxe-22001cb206c1320aee27f679a63d2171d35e99c5.tar.xz
ipxe-22001cb206c1320aee27f679a63d2171d35e99c5.zip
[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>
Diffstat (limited to 'src/net/netdev_settings.c')
-rw-r--r--src/net/netdev_settings.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/net/netdev_settings.c b/src/net/netdev_settings.c
index 994e0506..cfadd9e4 100644
--- a/src/net/netdev_settings.c
+++ b/src/net/netdev_settings.c
@@ -36,27 +36,27 @@ FILE_LICENCE ( GPL2_OR_LATER );
*/
/** Network device predefined settings */
-struct setting mac_setting __setting ( SETTING_NETDEV ) = {
+const struct setting mac_setting __setting ( SETTING_NETDEV ) = {
.name = "mac",
.description = "MAC address",
.type = &setting_type_hex,
};
-struct setting bustype_setting __setting ( SETTING_NETDEV ) = {
+const struct setting bustype_setting __setting ( SETTING_NETDEV ) = {
.name = "bustype",
.description = "Bus type",
.type = &setting_type_string,
};
-struct setting busloc_setting __setting ( SETTING_NETDEV ) = {
+const struct setting busloc_setting __setting ( SETTING_NETDEV ) = {
.name = "busloc",
.description = "Bus location",
.type = &setting_type_uint32,
};
-struct setting busid_setting __setting ( SETTING_NETDEV ) = {
+const struct setting busid_setting __setting ( SETTING_NETDEV ) = {
.name = "busid",
.description = "Bus ID",
.type = &setting_type_hex,
};
-struct setting chip_setting __setting ( SETTING_NETDEV ) = {
+const struct setting chip_setting __setting ( SETTING_NETDEV ) = {
.name = "chip",
.description = "Chip",
.type = &setting_type_string,
@@ -194,7 +194,7 @@ static int netdev_fetch_chip ( struct net_device *netdev, void *data,
/** A network device setting operation */
struct netdev_setting_operation {
/** Setting */
- struct setting *setting;
+ const struct setting *setting;
/** Store setting (or NULL if not supported)
*
* @v netdev Network device
@@ -232,7 +232,8 @@ static struct netdev_setting_operation netdev_setting_operations[] = {
* @v len Length of setting data
* @ret rc Return status code
*/
-static int netdev_store ( struct settings *settings, struct setting *setting,
+static int netdev_store ( struct settings *settings,
+ const struct setting *setting,
const void *data, size_t len ) {
struct net_device *netdev = container_of ( settings, struct net_device,
settings.settings );