Add "name" field to struct device to allow human-readable hardware device

names.

Add "dev" pointer in struct net_device to tie network interfaces back to a
hardware device.

Force natural alignment of data types in __table() macros.  This seems to
prevent gcc from taking the unilateral decision to occasionally increase
their alignment (which screws up the table packing).
This commit is contained in:
Michael Brown
2007-01-10 04:22:09 +00:00
parent cc9b32c405
commit dad5274522
51 changed files with 184 additions and 135 deletions

View File

@@ -1,7 +1,9 @@
#include "background.h"
static struct background backgrounds[0] __table_start ( background );
static struct background backgrounds_end[0] __table_end ( background );
static struct background backgrounds[0]
__table_start ( struct background, background );
static struct background backgrounds_end[0]
__table_end ( struct background, background );
/** @file */

View File

@@ -6,8 +6,10 @@
#include "bios.h"
static struct console_driver console_drivers[0] __table_start ( console );
static struct console_driver console_drivers_end[0] __table_end ( console );
static struct console_driver console_drivers[0]
__table_start ( struct console_driver, console );
static struct console_driver console_drivers_end[0]
__table_end ( struct console_driver, console );
/**
* Write a single character to each console device.

View File

@@ -10,10 +10,14 @@
*/
/* Linker symbols for the various tables */
static struct bus_driver bus_drivers[0] __table_start ( bus_driver );
static struct bus_driver bus_drivers_end[0] __table_end ( bus_driver );
static struct device_driver device_drivers[0] __table_start ( device_driver );
static struct device_driver device_drivers_end[0] __table_end (device_driver );
static struct bus_driver bus_drivers[0]
__table_start ( struct bus_driver, bus_driver );
static struct bus_driver bus_drivers_end[0]
__table_end ( struct bus_driver, bus_driver );
static struct device_driver device_drivers[0]
__table_start ( struct device_driver, device_driver );
static struct device_driver device_drivers_end[0]
__table_end ( struct device_driver, device_driver );
/* Current attempted boot device */
struct dev dev = {

View File

@@ -28,8 +28,10 @@
*
*/
static struct root_device root_devices[0] __table_start ( root_devices );
static struct root_device root_devices_end[0] __table_end ( root_devices );
static struct root_device root_devices[0]
__table_start ( struct root_device, root_devices );
static struct root_device root_devices_end[0]
__table_end ( struct root_device, root_devices );
/** Registered root devices */
static LIST_HEAD ( devices );
@@ -43,10 +45,10 @@ static LIST_HEAD ( devices );
static int rootdev_probe ( struct root_device *rootdev ) {
int rc;
DBG ( "Adding %s root bus\n", rootdev->name );
DBG ( "Adding %s root bus\n", rootdev->dev.name );
if ( ( rc = rootdev->driver->probe ( rootdev ) ) != 0 ) {
DBG ( "Failed to add %s root bus: %s\n",
rootdev->name, strerror ( rc ) );
rootdev->dev.name, strerror ( rc ) );
return rc;
}
@@ -60,7 +62,7 @@ static int rootdev_probe ( struct root_device *rootdev ) {
*/
static void rootdev_remove ( struct root_device *rootdev ) {
rootdev->driver->remove ( rootdev );
DBG ( "Removed %s root bus\n", rootdev->name );
DBG ( "Removed %s root bus\n", rootdev->dev.name );
}
/**

View File

@@ -33,8 +33,10 @@
*
*/
static struct command commands[0] __table_start ( commands );
static struct command commands_end[0] __table_end ( commands );
static struct command commands[0]
__table_start ( struct command, commands );
static struct command commands_end[0]
__table_end ( struct command, commands );
/* Avoid dragging in getopt.o unless a command really uses it */
int optind;

View File

@@ -9,8 +9,10 @@
#include <gpxe/init.h>
static struct init_fn init_fns[0] __table_start(init_fn);
static struct init_fn init_fns_end[0] __table_end(init_fn);
static struct init_fn init_fns[0]
__table_start ( struct init_fn, init_fn );
static struct init_fn init_fns_end[0]
__table_end ( struct init_fn, init_fn );
void call_init_fns ( void ) {
struct init_fn *init_fn;

View File

@@ -1,7 +1,9 @@
#include "resolv.h"
static struct resolver resolvers[0] __table_start(resolver);
static struct resolver resolvers_end[0] __table_end(resolver);
static struct resolver resolvers[0]
__table_start ( struct resolver, resolver );
static struct resolver resolvers_end[0]
__table_end ( struct resolver, resolver );
/*
* Resolve a name (which may be just a dotted quad IP address) to an

View File

@@ -34,16 +34,16 @@
*/
/** Registered configuration setting types */
static struct config_setting_type
config_setting_types[0] __table_start ( config_setting_types );
static struct config_setting_type
config_setting_types_end[0] __table_end ( config_setting_types );
static struct config_setting_type config_setting_types[0]
__table_start ( struct config_setting_type, config_setting_types );
static struct config_setting_type config_setting_types_end[0]
__table_end ( struct config_setting_type, config_setting_types );
/** Registered configuration settings */
static struct config_setting
config_settings[0] __table_start ( config_settings );
static struct config_setting
config_settings_end[0] __table_end ( config_settings );
static struct config_setting config_settings[0]
__table_start ( struct config_setting, config_settings );
static struct config_setting config_settings_end[0]
__table_end ( struct config_setting, config_settings );
/**
* Find configuration setting type