[settings] Allow for arbitrarily-named settings
This provides a mechanism for using arbitrarily-named variables within gPXE, using the existing syntax for settings.
This commit is contained in:
@@ -269,7 +269,7 @@ struct net_device {
|
||||
struct net_device_stats rx_stats;
|
||||
|
||||
/** Configuration settings applicable to this device */
|
||||
struct simple_settings settings;
|
||||
struct generic_settings settings;
|
||||
|
||||
/** Driver private data */
|
||||
void *priv;
|
||||
@@ -295,6 +295,7 @@ struct net_device {
|
||||
|
||||
extern struct list_head net_devices;
|
||||
extern struct net_device_operations null_netdev_operations;
|
||||
extern struct settings_operations netdev_settings_operations;
|
||||
|
||||
/**
|
||||
* Initialise a network device
|
||||
@@ -385,6 +386,20 @@ netdev_settings ( struct net_device *netdev ) {
|
||||
return &netdev->settings.settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise a per-netdevice configuration settings block
|
||||
*
|
||||
* @v generics Generic settings block
|
||||
* @v refcnt Containing object reference counter, or NULL
|
||||
* @v name Settings block name
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
netdev_settings_init ( struct net_device *netdev ) {
|
||||
generic_settings_init ( &netdev->settings,
|
||||
&netdev->refcnt, netdev->name );
|
||||
netdev->settings.settings.op = &netdev_settings_operations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark network device as having link up
|
||||
*
|
||||
@@ -440,8 +455,6 @@ extern int net_tx ( struct io_buffer *iobuf, struct net_device *netdev,
|
||||
extern int net_rx ( struct io_buffer *iobuf, struct net_device *netdev,
|
||||
uint16_t net_proto, const void *ll_source );
|
||||
|
||||
extern struct settings_operations netdev_settings_operations;
|
||||
|
||||
/**
|
||||
* Complete network transmission
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user