From 8831b63c0461c7080b16ef37ef021a3f4432ba53 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 9 Sep 2011 14:45:13 +0000 Subject: Made network device selection to be per id, which makes it simpler, and doesn't need hardcoded values (no whatsnew) --- src/osd/osdnet.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/osd/osdnet.c') 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_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; } -- cgit v1.2.3