dev.c (7364e445f62825758fa61195d237a5b8ecdd06ec) dev.c (9c7dafbfab1554705f85523fead578aa1a3d338c)
1/*
2 * NET3 Protocol independent device support routines.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 *

--- 1041 unchanged lines hidden (view full) ---

1050 * @dev: device
1051 * @alias: name up to IFALIASZ
1052 * @len: limit of bytes to copy from info
1053 *
1054 * Set ifalias for a device,
1055 */
1056int dev_set_alias(struct net_device *dev, const char *alias, size_t len)
1057{
1/*
2 * NET3 Protocol independent device support routines.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 *

--- 1041 unchanged lines hidden (view full) ---

1050 * @dev: device
1051 * @alias: name up to IFALIASZ
1052 * @len: limit of bytes to copy from info
1053 *
1054 * Set ifalias for a device,
1055 */
1056int dev_set_alias(struct net_device *dev, const char *alias, size_t len)
1057{
1058 char *new_ifalias;
1059
1060 ASSERT_RTNL();
1061
1062 if (len >= IFALIASZ)
1063 return -EINVAL;
1064
1065 if (!len) {
1066 if (dev->ifalias) {
1067 kfree(dev->ifalias);
1068 dev->ifalias = NULL;
1069 }
1070 return 0;
1071 }
1072
1058 ASSERT_RTNL();
1059
1060 if (len >= IFALIASZ)
1061 return -EINVAL;
1062
1063 if (!len) {
1064 if (dev->ifalias) {
1065 kfree(dev->ifalias);
1066 dev->ifalias = NULL;
1067 }
1068 return 0;
1069 }
1070
1073 new_ifalias = krealloc(dev->ifalias, len + 1, GFP_KERNEL);
1074 if (!new_ifalias)
1071 dev->ifalias = krealloc(dev->ifalias, len + 1, GFP_KERNEL);
1072 if (!dev->ifalias)
1075 return -ENOMEM;
1073 return -ENOMEM;
1076 dev->ifalias = new_ifalias;
1077
1078 strlcpy(dev->ifalias, alias, len+1);
1079 return len;
1080}
1081
1082
1083/**
1084 * netdev_features_change - device changes features

--- 4492 unchanged lines hidden (view full) ---

5577 ret = dev->netdev_ops->ndo_init(dev);
5578 if (ret) {
5579 if (ret > 0)
5580 ret = -EIO;
5581 goto out;
5582 }
5583 }
5584
1074
1075 strlcpy(dev->ifalias, alias, len+1);
1076 return len;
1077}
1078
1079
1080/**
1081 * netdev_features_change - device changes features

--- 4492 unchanged lines hidden (view full) ---

5574 ret = dev->netdev_ops->ndo_init(dev);
5575 if (ret) {
5576 if (ret > 0)
5577 ret = -EIO;
5578 goto out;
5579 }
5580 }
5581
5585 dev->ifindex = dev_new_index(net);
5582 ret = -EBUSY;
5583 if (!dev->ifindex)
5584 dev->ifindex = dev_new_index(net);
5585 else if (__dev_get_by_index(net, dev->ifindex))
5586 goto err_uninit;
5587
5586 if (dev->iflink == -1)
5587 dev->iflink = dev->ifindex;
5588
5589 /* Transfer changeable features to wanted_features and enable
5590 * software offloads (GSO and GRO).
5591 */
5592 dev->hw_features |= NETIF_F_SOFT_FEATURES;
5593 dev->features |= NETIF_F_SOFT_FEATURES;

--- 1049 unchanged lines hidden ---
5588 if (dev->iflink == -1)
5589 dev->iflink = dev->ifindex;
5590
5591 /* Transfer changeable features to wanted_features and enable
5592 * software offloads (GSO and GRO).
5593 */
5594 dev->hw_features |= NETIF_F_SOFT_FEATURES;
5595 dev->features |= NETIF_F_SOFT_FEATURES;

--- 1049 unchanged lines hidden ---