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:
Hugo Santos 2007-05-23 19:56:16 +00:00
parent 14e3d1b576
commit be2f6ac347
5 changed files with 14 additions and 18 deletions

View File

@ -688,8 +688,8 @@ interface_protocol_control(net_datalink_protocol *_protocol,
// get interface parameter
struct ifreq request;
strlcpy(request.ifr_parameter.base_name, interface->base_name, IF_NAMESIZE);
strlcpy(request.ifr_parameter.device, interface->device_interface->name,
IF_NAMESIZE);
strlcpy(request.ifr_parameter.device,
interface->device_interface->device->name, IF_NAMESIZE);
request.ifr_parameter.sub_type = 0;
// 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)
return B_BAD_ADDRESS;
return interface->device_interface->module->set_media(
return interface->device_interface->device->module->set_media(
interface->device, request.ifr_media);
}
case SIOCGIFMEDIA:

View File

@ -290,7 +290,8 @@ domain_removed_device_interface(net_device_interface *interface)
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)
continue;

View File

@ -93,7 +93,7 @@ find_device_interface(const char *name)
while (iterator.HasNext()) {
net_device_interface *interface = iterator.Next();
if (!strcmp(interface->name, name))
if (!strcmp(interface->device->name, name))
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)
goto error_2;
interface->name = device->name;
interface->module = module;
interface->device = device;
interface->up_count = 0;
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_index = interface->device->index;
address.sdl_type = interface->device->type;
address.sdl_nlen = strlen(interface->name);
address.sdl_nlen = strlen(interface->device->name);
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;
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();
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);
if (buffer.Copy(&request, IF_NAMESIZE
@ -446,8 +444,9 @@ put_device_interface(struct net_device_interface *interface)
status_t status;
wait_for_thread(interface->consumer_thread, &status);
interface->module->uninit_device(interface->device);
put_module(interface->module->info.name);
net_device *device = interface->device;
device->module->uninit_device(device);
put_module(device->module->info.name);
recursive_lock_destroy(&interface->rx_lock);
delete interface;
@ -544,10 +543,8 @@ down_device_interface(net_device_interface *interface)
net_device *device = interface->device;
dprintf("down_device_interface(%s)\n", interface->name);
device->flags &= ~IFF_UP;
interface->module->down(device);
device->module->down(device);
notify_device_monitors(interface, B_DEVICE_GOING_DOWN);

View File

@ -27,8 +27,6 @@ typedef DoublyLinkedList<net_device_monitor,
DoublyLinkedListCLink<net_device_monitor> > DeviceMonitorList;
struct net_device_interface : DoublyLinkedListLinkImpl<net_device_interface> {
const char *name;
struct net_device_module_info *module;
struct net_device *device;
thread_id reader_thread;
uint32 up_count;

View File

@ -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);
if (interface != NULL) {
strlcpy(request.ifr_name, interface->name, IF_NAMESIZE);
strlcpy(request.ifr_name, interface->device->name, IF_NAMESIZE);
put_device_interface(interface);
} else
return ENODEV;