Skip to content

Commit

Permalink
batman-adv: rename batman_if struct to hard_iface
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
  • Loading branch information
Marek Lindner committed Mar 5, 2011
1 parent 4389e47 commit e6c10f4
Show file tree
Hide file tree
Showing 18 changed files with 335 additions and 330 deletions.
8 changes: 4 additions & 4 deletions net/batman-adv/aggregation.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static bool can_aggregate_with(struct batman_packet *new_batman_packet,
int packet_len,
unsigned long send_time,
bool directlink,
struct batman_if *if_incoming,
struct hard_iface *if_incoming,
struct forw_packet *forw_packet)
{
struct batman_packet *batman_packet =
Expand Down Expand Up @@ -99,7 +99,7 @@ static bool can_aggregate_with(struct batman_packet *new_batman_packet,
/* create a new aggregated packet and add this packet to it */
static void new_aggregated_packet(unsigned char *packet_buff, int packet_len,
unsigned long send_time, bool direct_link,
struct batman_if *if_incoming,
struct hard_iface *if_incoming,
int own_packet)
{
struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
Expand Down Expand Up @@ -188,7 +188,7 @@ static void aggregate(struct forw_packet *forw_packet_aggr,

void add_bat_packet_to_list(struct bat_priv *bat_priv,
unsigned char *packet_buff, int packet_len,
struct batman_if *if_incoming, char own_packet,
struct hard_iface *if_incoming, char own_packet,
unsigned long send_time)
{
/**
Expand Down Expand Up @@ -247,7 +247,7 @@ void add_bat_packet_to_list(struct bat_priv *bat_priv,

/* unpack the aggregated packets and process them one by one */
void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff,
int packet_len, struct batman_if *if_incoming)
int packet_len, struct hard_iface *if_incoming)
{
struct batman_packet *batman_packet;
int buff_pos = 0;
Expand Down
4 changes: 2 additions & 2 deletions net/batman-adv/aggregation.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ static inline int aggregated_packet(int buff_pos, int packet_len, int num_hna)

void add_bat_packet_to_list(struct bat_priv *bat_priv,
unsigned char *packet_buff, int packet_len,
struct batman_if *if_incoming, char own_packet,
struct hard_iface *if_incoming, char own_packet,
unsigned long send_time);
void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff,
int packet_len, struct batman_if *if_incoming);
int packet_len, struct hard_iface *if_incoming);

#endif /* _NET_BATMAN_ADV_AGGREGATION_H_ */
41 changes: 22 additions & 19 deletions net/batman-adv/bat_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,16 +441,16 @@ static ssize_t show_mesh_iface(struct kobject *kobj, struct attribute *attr,
char *buff)
{
struct net_device *net_dev = kobj_to_netdev(kobj);
struct batman_if *batman_if = get_batman_if_by_netdev(net_dev);
struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev);
ssize_t length;

if (!batman_if)
if (!hard_iface)
return 0;

length = sprintf(buff, "%s\n", batman_if->if_status == IF_NOT_IN_USE ?
"none" : batman_if->soft_iface->name);
length = sprintf(buff, "%s\n", hard_iface->if_status == IF_NOT_IN_USE ?
"none" : hard_iface->soft_iface->name);

hardif_free_ref(batman_if);
hardif_free_ref(hard_iface);

return length;
}
Expand All @@ -459,11 +459,11 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr,
char *buff, size_t count)
{
struct net_device *net_dev = kobj_to_netdev(kobj);
struct batman_if *batman_if = get_batman_if_by_netdev(net_dev);
struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev);
int status_tmp = -1;
int ret = count;

if (!batman_if)
if (!hard_iface)
return count;

if (buff[count - 1] == '\n')
Expand All @@ -472,7 +472,7 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr,
if (strlen(buff) >= IFNAMSIZ) {
pr_err("Invalid parameter for 'mesh_iface' setting received: "
"interface name too long '%s'\n", buff);
hardif_free_ref(batman_if);
hardif_free_ref(hard_iface);
return -EINVAL;
}

Expand All @@ -481,42 +481,45 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr,
else
status_tmp = IF_I_WANT_YOU;

if ((batman_if->if_status == status_tmp) || ((batman_if->soft_iface) &&
(strncmp(batman_if->soft_iface->name, buff, IFNAMSIZ) == 0)))
if (hard_iface->if_status == status_tmp)
goto out;

if ((hard_iface->soft_iface) &&
(strncmp(hard_iface->soft_iface->name, buff, IFNAMSIZ) == 0))
goto out;

if (status_tmp == IF_NOT_IN_USE) {
rtnl_lock();
hardif_disable_interface(batman_if);
hardif_disable_interface(hard_iface);
rtnl_unlock();
goto out;
}

/* if the interface already is in use */
if (batman_if->if_status != IF_NOT_IN_USE) {
if (hard_iface->if_status != IF_NOT_IN_USE) {
rtnl_lock();
hardif_disable_interface(batman_if);
hardif_disable_interface(hard_iface);
rtnl_unlock();
}

ret = hardif_enable_interface(batman_if, buff);
ret = hardif_enable_interface(hard_iface, buff);

out:
hardif_free_ref(batman_if);
hardif_free_ref(hard_iface);
return ret;
}

static ssize_t show_iface_status(struct kobject *kobj, struct attribute *attr,
char *buff)
{
struct net_device *net_dev = kobj_to_netdev(kobj);
struct batman_if *batman_if = get_batman_if_by_netdev(net_dev);
struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev);
ssize_t length;

if (!batman_if)
if (!hard_iface)
return 0;

switch (batman_if->if_status) {
switch (hard_iface->if_status) {
case IF_TO_BE_REMOVED:
length = sprintf(buff, "disabling\n");
break;
Expand All @@ -535,7 +538,7 @@ static ssize_t show_iface_status(struct kobject *kobj, struct attribute *attr,
break;
}

hardif_free_ref(batman_if);
hardif_free_ref(hard_iface);

return length;
}
Expand Down
Loading

0 comments on commit e6c10f4

Please sign in to comment.