summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/osdnet.c
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2011-09-09 14:45:13 +0000
committer Miodrag Milanovic <mmicko@gmail.com>2011-09-09 14:45:13 +0000
commit8831b63c0461c7080b16ef37ef021a3f4432ba53 (patch)
tree62e51fb976ba0e89949545bd4bef9702f31f5127 /src/osd/osdnet.c
parentf679bbfe7006004ebc3b7a78a209639549472698 (diff)
Made network device selection to be per id, which makes it simpler, and doesn't need hardcoded values (no whatsnew)
Diffstat (limited to 'src/osd/osdnet.c')
-rw-r--r--src/osd/osdnet.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/osd/osdnet.c b/src/osd/osdnet.c
index 6a2fbbaac2f..b91dea82722 100644
--- a/src/osd/osdnet.c
+++ b/src/osd/osdnet.c
@@ -3,6 +3,7 @@
typedef struct netdev_entry
{
+ int id;
char name[256];
create_netdev func;
struct netdev_entry *m_next;
@@ -13,17 +14,18 @@ static class simple_list<netdev_entry_t> netdev_list;
void add_netdev(const char *name, create_netdev func)
{
netdev_entry_t *entry = new netdev_entry_t;
+ entry->id = netdev_list.count();
strncpy(entry->name, name, 255);
entry->name[255] = '\0';
entry->func = func;
netdev_list.append(*entry);
}
-class netdev *open_netdev(const char *name, class device_network_interface *ifdev, int rate)
+class netdev *open_netdev(int id, class device_network_interface *ifdev, int rate)
{
netdev_entry_t *entry = netdev_list.first();
while(entry) {
- if(!strncmp(name, entry->name, 256))
+ if(entry->id==id)
return entry->func(entry->name, ifdev, rate);
entry = entry->m_next;
}