net_device_interface: remove redundant fields
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21222 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -688,8 +688,8 @@ interface_protocol_control(net_datalink_protocol *_protocol,
|
|||||||
// get interface parameter
|
// get interface parameter
|
||||||
struct ifreq request;
|
struct ifreq request;
|
||||||
strlcpy(request.ifr_parameter.base_name, interface->base_name, IF_NAMESIZE);
|
strlcpy(request.ifr_parameter.base_name, interface->base_name, IF_NAMESIZE);
|
||||||
strlcpy(request.ifr_parameter.device, interface->device_interface->name,
|
strlcpy(request.ifr_parameter.device,
|
||||||
IF_NAMESIZE);
|
interface->device_interface->device->name, IF_NAMESIZE);
|
||||||
request.ifr_parameter.sub_type = 0;
|
request.ifr_parameter.sub_type = 0;
|
||||||
// TODO: for now, we ignore the sub type...
|
// TODO: for now, we ignore the sub type...
|
||||||
|
|
||||||
@@ -747,7 +747,7 @@ interface_protocol_control(net_datalink_protocol *_protocol,
|
|||||||
if (user_memcpy(&request, argument, sizeof(struct ifreq)) < B_OK)
|
if (user_memcpy(&request, argument, sizeof(struct ifreq)) < B_OK)
|
||||||
return B_BAD_ADDRESS;
|
return B_BAD_ADDRESS;
|
||||||
|
|
||||||
return interface->device_interface->module->set_media(
|
return interface->device_interface->device->module->set_media(
|
||||||
interface->device, request.ifr_media);
|
interface->device, request.ifr_media);
|
||||||
}
|
}
|
||||||
case SIOCGIFMEDIA:
|
case SIOCGIFMEDIA:
|
||||||
|
|||||||
@@ -290,7 +290,8 @@ domain_removed_device_interface(net_device_interface *interface)
|
|||||||
|
|
||||||
BenaphoreLocker locker(domain->lock);
|
BenaphoreLocker locker(domain->lock);
|
||||||
|
|
||||||
net_interface_private *priv = find_interface(domain, interface->name);
|
net_interface_private *priv = find_interface(domain,
|
||||||
|
interface->device->name);
|
||||||
if (priv == NULL)
|
if (priv == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ find_device_interface(const char *name)
|
|||||||
while (iterator.HasNext()) {
|
while (iterator.HasNext()) {
|
||||||
net_device_interface *interface = iterator.Next();
|
net_device_interface *interface = iterator.Next();
|
||||||
|
|
||||||
if (!strcmp(interface->name, name))
|
if (!strcmp(interface->device->name, name))
|
||||||
return interface;
|
return interface;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,8 +127,6 @@ allocate_device_interface(net_device *device, net_device_module_info *module)
|
|||||||
if (init_fifo(&interface->receive_queue, name, 16 * 1024 * 1024) < B_OK)
|
if (init_fifo(&interface->receive_queue, name, 16 * 1024 * 1024) < B_OK)
|
||||||
goto error_2;
|
goto error_2;
|
||||||
|
|
||||||
interface->name = device->name;
|
|
||||||
interface->module = module;
|
|
||||||
interface->device = device;
|
interface->device = device;
|
||||||
interface->up_count = 0;
|
interface->up_count = 0;
|
||||||
interface->ref_count = 1;
|
interface->ref_count = 1;
|
||||||
@@ -368,9 +366,9 @@ get_device_interface_address(net_device_interface *interface, sockaddr *_address
|
|||||||
address.sdl_family = AF_LINK;
|
address.sdl_family = AF_LINK;
|
||||||
address.sdl_index = interface->device->index;
|
address.sdl_index = interface->device->index;
|
||||||
address.sdl_type = interface->device->type;
|
address.sdl_type = interface->device->type;
|
||||||
address.sdl_nlen = strlen(interface->name);
|
address.sdl_nlen = strlen(interface->device->name);
|
||||||
address.sdl_slen = 0;
|
address.sdl_slen = 0;
|
||||||
memcpy(address.sdl_data, interface->name, address.sdl_nlen);
|
memcpy(address.sdl_data, interface->device->name, address.sdl_nlen);
|
||||||
|
|
||||||
address.sdl_alen = interface->device->address.length;
|
address.sdl_alen = interface->device->address.length;
|
||||||
memcpy(LLADDR(&address), interface->device->address.data, address.sdl_alen);
|
memcpy(LLADDR(&address), interface->device->address.data, address.sdl_alen);
|
||||||
@@ -414,7 +412,7 @@ list_device_interfaces(void *_buffer, size_t *bufferSize)
|
|||||||
net_device_interface *interface = iterator.Next();
|
net_device_interface *interface = iterator.Next();
|
||||||
|
|
||||||
ifreq request;
|
ifreq request;
|
||||||
strlcpy(request.ifr_name, interface->name, IF_NAMESIZE);
|
strlcpy(request.ifr_name, interface->device->name, IF_NAMESIZE);
|
||||||
get_device_interface_address(interface, &request.ifr_addr);
|
get_device_interface_address(interface, &request.ifr_addr);
|
||||||
|
|
||||||
if (buffer.Copy(&request, IF_NAMESIZE
|
if (buffer.Copy(&request, IF_NAMESIZE
|
||||||
@@ -446,8 +444,9 @@ put_device_interface(struct net_device_interface *interface)
|
|||||||
status_t status;
|
status_t status;
|
||||||
wait_for_thread(interface->consumer_thread, &status);
|
wait_for_thread(interface->consumer_thread, &status);
|
||||||
|
|
||||||
interface->module->uninit_device(interface->device);
|
net_device *device = interface->device;
|
||||||
put_module(interface->module->info.name);
|
device->module->uninit_device(device);
|
||||||
|
put_module(device->module->info.name);
|
||||||
|
|
||||||
recursive_lock_destroy(&interface->rx_lock);
|
recursive_lock_destroy(&interface->rx_lock);
|
||||||
delete interface;
|
delete interface;
|
||||||
@@ -544,10 +543,8 @@ down_device_interface(net_device_interface *interface)
|
|||||||
|
|
||||||
net_device *device = interface->device;
|
net_device *device = interface->device;
|
||||||
|
|
||||||
dprintf("down_device_interface(%s)\n", interface->name);
|
|
||||||
|
|
||||||
device->flags &= ~IFF_UP;
|
device->flags &= ~IFF_UP;
|
||||||
interface->module->down(device);
|
device->module->down(device);
|
||||||
|
|
||||||
notify_device_monitors(interface, B_DEVICE_GOING_DOWN);
|
notify_device_monitors(interface, B_DEVICE_GOING_DOWN);
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,6 @@ typedef DoublyLinkedList<net_device_monitor,
|
|||||||
DoublyLinkedListCLink<net_device_monitor> > DeviceMonitorList;
|
DoublyLinkedListCLink<net_device_monitor> > DeviceMonitorList;
|
||||||
|
|
||||||
struct net_device_interface : DoublyLinkedListLinkImpl<net_device_interface> {
|
struct net_device_interface : DoublyLinkedListLinkImpl<net_device_interface> {
|
||||||
const char *name;
|
|
||||||
struct net_device_module_info *module;
|
|
||||||
struct net_device *device;
|
struct net_device *device;
|
||||||
thread_id reader_thread;
|
thread_id reader_thread;
|
||||||
uint32 up_count;
|
uint32 up_count;
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ link_control(net_protocol *_protocol, int level, int option, void *value,
|
|||||||
|
|
||||||
net_device_interface *interface = get_device_interface(request.ifr_index);
|
net_device_interface *interface = get_device_interface(request.ifr_index);
|
||||||
if (interface != NULL) {
|
if (interface != NULL) {
|
||||||
strlcpy(request.ifr_name, interface->name, IF_NAMESIZE);
|
strlcpy(request.ifr_name, interface->device->name, IF_NAMESIZE);
|
||||||
put_device_interface(interface);
|
put_device_interface(interface);
|
||||||
} else
|
} else
|
||||||
return ENODEV;
|
return ENODEV;
|
||||||
|
|||||||
Reference in New Issue
Block a user