History

Merge branch 'bareudp-remove-unused'

Guillaume Nault says: ==================== bareudp: Remove unused code from header file Stop exporting unused functions and structures in bareudp.h. The only piece of bareudp.h that is actually used is netif_is_bareudp(). The rest can be moved to bareudp.c or even dropped entirely. ====================

David S. Miller committed 4 years ago

Commit d147dd72 parents 6180c78 dcdd77e2 files · +8 −46Browse files

Unified · Split

2 files
  1. drivers/net/bareudp.c +7 −34
  2. include/net/bareudp.h +1 −12
drivers/net/bareudp.c+7−34
@@ -38,6 +38,13 @@ struct bareudp_net { · 37 unmodified lines
38 struct list_head bareudp_list;38 struct list_head bareudp_list;
39};39};
40 40
41struct bareudp_conf {
42 __be16 ethertype;
43 __be16 port;
44 u16 sport_min;
45 bool multi_proto_mode;
46};
47
41/* Pseudo network device */48/* Pseudo network device */
42struct bareudp_dev {49struct bareudp_dev {
43 struct net *net; /* netns for packet i/o */50 struct net *net; /* netns for packet i/o */
@@ -721,40 +728,6 @@ static struct rtnl_link_ops bareudp_link_ops __read_mostly = { · 677 unmodified lines
721 .fill_info = bareudp_fill_info,728 .fill_info = bareudp_fill_info,
722};729};
723 730
724struct net_device *bareudp_dev_create(struct net *net, const char *name,
725 u8 name_assign_type,
726 struct bareudp_conf *conf)
727{
728 struct nlattr *tb[IFLA_MAX + 1];
729 struct net_device *dev;
730 int err;
731
732 memset(tb, 0, sizeof(tb));
733 dev = rtnl_create_link(net, name, name_assign_type,
734 &bareudp_link_ops, tb, NULL);
735 if (IS_ERR(dev))
736 return dev;
737
738 err = bareudp_configure(net, dev, conf);
739 if (err) {
740 free_netdev(dev);
741 return ERR_PTR(err);
742 }
743 err = dev_set_mtu(dev, IP_MAX_MTU - BAREUDP_BASE_HLEN);
744 if (err)
745 goto err;
746
747 err = rtnl_configure_link(dev, NULL);
748 if (err < 0)
749 goto err;
750
751 return dev;
752err:
753 bareudp_dellink(dev, NULL);
754 return ERR_PTR(err);
755}
756EXPORT_SYMBOL_GPL(bareudp_dev_create);
757
758static __net_init int bareudp_init_net(struct net *net)731static __net_init int bareudp_init_net(struct net *net)
759{732{
760 struct bareudp_net *bn = net_generic(net, bareudp_net_id);733 struct bareudp_net *bn = net_generic(net, bareudp_net_id);
include/net/bareudp.h+1−12
@@ -3,21 +3,10 @@ · 2 unmodified lines
3#ifndef __NET_BAREUDP_H3#ifndef __NET_BAREUDP_H
4#define __NET_BAREUDP_H4#define __NET_BAREUDP_H
5 5
6#include <linux/netdevice.h>
6#include <linux/types.h>7#include <linux/types.h>
7#include <linux/skbuff.h>
8#include <net/rtnetlink.h>8#include <net/rtnetlink.h>
9 9
10struct bareudp_conf {
11 __be16 ethertype;
12 __be16 port;
13 u16 sport_min;
14 bool multi_proto_mode;
15};
16
17struct net_device *bareudp_dev_create(struct net *net, const char *name,
18 u8 name_assign_type,
19 struct bareudp_conf *info);
20
21static inline bool netif_is_bareudp(const struct net_device *dev)10static inline bool netif_is_bareudp(const struct net_device *dev)
22{11{
23 return dev->rtnl_link_ops &&12 return dev->rtnl_link_ops &&