* Distributed under the terms of the GNU GPL version 2.
*
* Significant portions of this file may be copied from parts of the Linux
* Distributed under the terms of the GNU GPL version 2.
*
* Significant portions of this file may be copied from parts of the Linux
#ifdef CONFIG_SYSFS
#define to_dev(obj) container_of(obj, struct device, kobj)
/* Hack to attempt to build on more platforms. */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)
#ifdef CONFIG_SYSFS
#define to_dev(obj) container_of(obj, struct device, kobj)
/* Hack to attempt to build on more platforms. */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)
#define DEVICE_PARAMS struct device *d, struct device_attribute *attr
#define DEVICE_ARGS d, attr
#define DEV_ATTR(NAME) dev_attr_##NAME
#endif
#define DEVICE_PARAMS struct device *d, struct device_attribute *attr
#define DEVICE_ARGS d, attr
#define DEV_ATTR(NAME) dev_attr_##NAME
#endif
const char *buf, size_t len,
void (*set)(struct datapath *, unsigned long))
{
const char *buf, size_t len,
void (*set)(struct datapath *, unsigned long))
{
return sprintf(buf, "%lu\n", jiffies_to_clock_t(br->forward_delay));
#else
return sprintf(buf, "%d\n", 0);
return sprintf(buf, "%lu\n", jiffies_to_clock_t(br->forward_delay));
#else
return sprintf(buf, "%d\n", 0);
{
return store_bridge_parm(DEVICE_ARGS, buf, len, set_forward_delay);
}
{
return store_bridge_parm(DEVICE_ARGS, buf, len, set_forward_delay);
}
show_forward_delay, store_forward_delay);
static ssize_t show_hello_time(DEVICE_PARAMS, char *buf)
show_forward_delay, store_forward_delay);
static ssize_t show_hello_time(DEVICE_PARAMS, char *buf)
{
return store_bridge_parm(DEVICE_ARGS, buf, len, set_hello_time);
}
{
return store_bridge_parm(DEVICE_ARGS, buf, len, set_hello_time);
}
-static DP_DEVICE_ATTR(hello_time, S_IRUGO | S_IWUSR, show_hello_time,
+static INTERNAL_DEVICE_ATTR(hello_time, S_IRUGO | S_IWUSR, show_hello_time,
{
return store_bridge_parm(DEVICE_ARGS, buf, len, set_max_age);
}
{
return store_bridge_parm(DEVICE_ARGS, buf, len, set_max_age);
}
-static DP_DEVICE_ATTR(max_age, S_IRUGO | S_IWUSR, show_max_age, store_max_age);
+static INTERNAL_DEVICE_ATTR(max_age, S_IRUGO | S_IWUSR, show_max_age, store_max_age);
return sprintf(buf, "%lu\n", jiffies_to_clock_t(br->ageing_time));
#else
return sprintf(buf, "%d\n", 0);
return sprintf(buf, "%lu\n", jiffies_to_clock_t(br->ageing_time));
#else
return sprintf(buf, "%d\n", 0);
{
return store_bridge_parm(DEVICE_ARGS, buf, len, set_ageing_time);
}
{
return store_bridge_parm(DEVICE_ARGS, buf, len, set_ageing_time);
}
-static DP_DEVICE_ATTR(ageing_time, S_IRUGO | S_IWUSR, show_ageing_time,
+static INTERNAL_DEVICE_ATTR(ageing_time, S_IRUGO | S_IWUSR, show_ageing_time,
return sprintf(buf, "%d\n", br->stp_enabled);
#else
return sprintf(buf, "%d\n", 0);
return sprintf(buf, "%d\n", br->stp_enabled);
#else
return sprintf(buf, "%d\n", 0);
-static DP_DEVICE_ATTR(stp_state, S_IRUGO | S_IWUSR, show_stp_state,
+static INTERNAL_DEVICE_ATTR(stp_state, S_IRUGO | S_IWUSR, show_stp_state,
return sprintf(buf, "%d\n",
(br->bridge_id.prio[0] << 8) | br->bridge_id.prio[1]);
#else
return sprintf(buf, "%d\n",
(br->bridge_id.prio[0] << 8) | br->bridge_id.prio[1]);
#else
{
return store_bridge_parm(DEVICE_ARGS, buf, len, set_priority);
}
{
return store_bridge_parm(DEVICE_ARGS, buf, len, set_priority);
}
-static DP_DEVICE_ATTR(priority, S_IRUGO | S_IWUSR, show_priority, store_priority);
+static INTERNAL_DEVICE_ATTR(priority, S_IRUGO | S_IWUSR, show_priority, store_priority);
-static DP_DEVICE_ATTR(root_id, S_IRUGO, show_root_id, NULL);
+static INTERNAL_DEVICE_ATTR(root_id, S_IRUGO, show_root_id, NULL);
- struct datapath *dp = dp_dev_get_dp(to_net_dev(d));
- const unsigned char *addr = dp->ports[ODPP_LOCAL]->dev->dev_addr;
+ struct datapath *dp = sysfs_get_dp(to_net_dev(d));
+ const unsigned char *addr = vport_get_addr(dp->ports[ODPP_LOCAL]->vport);
/* xxx Do we need a lock of some sort? */
return sprintf(buf, "%.2x%.2x.%.2x%.2x%.2x%.2x%.2x%.2x\n",
0, 0, addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
}
/* xxx Do we need a lock of some sort? */
return sprintf(buf, "%.2x%.2x.%.2x%.2x%.2x%.2x%.2x%.2x\n",
0, 0, addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
}
-static DP_DEVICE_ATTR(bridge_id, S_IRUGO, show_bridge_id, NULL);
+static INTERNAL_DEVICE_ATTR(bridge_id, S_IRUGO, show_bridge_id, NULL);
-static DP_DEVICE_ATTR(root_port, S_IRUGO, show_root_port, NULL);
+static INTERNAL_DEVICE_ATTR(root_port, S_IRUGO, show_root_port, NULL);
-static DP_DEVICE_ATTR(root_path_cost, S_IRUGO, show_root_path_cost, NULL);
+static INTERNAL_DEVICE_ATTR(root_path_cost, S_IRUGO, show_root_path_cost, NULL);
-static DP_DEVICE_ATTR(topology_change, S_IRUGO, show_topology_change, NULL);
+static INTERNAL_DEVICE_ATTR(topology_change, S_IRUGO, show_topology_change, NULL);
return sprintf(buf, "%d\n", br->topology_change_detected);
#else
return sprintf(buf, "%d\n", 0);
#endif
}
return sprintf(buf, "%d\n", br->topology_change_detected);
#else
return sprintf(buf, "%d\n", 0);
#endif
}
show_topology_change_detected, NULL);
static ssize_t show_hello_timer(DEVICE_PARAMS, char *buf)
{
#if 0
show_topology_change_detected, NULL);
static ssize_t show_hello_timer(DEVICE_PARAMS, char *buf)
{
#if 0
return sprintf(buf, "%ld\n", br_timer_value(&br->hello_timer));
#else
return sprintf(buf, "%d\n", 0);
#endif
}
return sprintf(buf, "%ld\n", br_timer_value(&br->hello_timer));
#else
return sprintf(buf, "%d\n", 0);
#endif
}
-static DP_DEVICE_ATTR(hello_timer, S_IRUGO, show_hello_timer, NULL);
+static INTERNAL_DEVICE_ATTR(hello_timer, S_IRUGO, show_hello_timer, NULL);
return sprintf(buf, "%ld\n", br_timer_value(&br->tcn_timer));
#else
return sprintf(buf, "%d\n", 0);
#endif
}
return sprintf(buf, "%ld\n", br_timer_value(&br->tcn_timer));
#else
return sprintf(buf, "%d\n", 0);
#endif
}
-static DP_DEVICE_ATTR(tcn_timer, S_IRUGO, show_tcn_timer, NULL);
+static INTERNAL_DEVICE_ATTR(tcn_timer, S_IRUGO, show_tcn_timer, NULL);
return sprintf(buf, "%ld\n", br_timer_value(&br->topology_change_timer));
#else
return sprintf(buf, "%d\n", 0);
#endif
}
return sprintf(buf, "%ld\n", br_timer_value(&br->topology_change_timer));
#else
return sprintf(buf, "%d\n", 0);
#endif
}
-static DP_DEVICE_ATTR(topology_change_timer, S_IRUGO, show_topology_change_timer,
+static INTERNAL_DEVICE_ATTR(topology_change_timer, S_IRUGO, show_topology_change_timer,
return sprintf(buf, "%ld\n", br_timer_value(&br->gc_timer));
#else
return sprintf(buf, "%d\n", 0);
#endif
}
return sprintf(buf, "%ld\n", br_timer_value(&br->gc_timer));
#else
return sprintf(buf, "%d\n", 0);
#endif
}
-static DP_DEVICE_ATTR(gc_timer, S_IRUGO, show_gc_timer, NULL);
+static INTERNAL_DEVICE_ATTR(gc_timer, S_IRUGO, show_gc_timer, NULL);
return sprintf(buf, "%x:%x:%x:%x:%x:%x\n",
br->group_addr[0], br->group_addr[1],
br->group_addr[2], br->group_addr[3],
return sprintf(buf, "%x:%x:%x:%x:%x:%x\n",
br->group_addr[0], br->group_addr[1],
br->group_addr[2], br->group_addr[3],
static ssize_t store_group_addr(DEVICE_PARAMS,
const char *buf, size_t len)
{
static ssize_t store_group_addr(DEVICE_PARAMS,
const char *buf, size_t len)
{
show_group_addr, store_group_addr);
static struct attribute *bridge_attrs[] = {
show_group_addr, store_group_addr);
static struct attribute *bridge_attrs[] = {
#else /* !CONFIG_SYSFS */
int dp_sysfs_add_dp(struct datapath *dp) { return 0; }
int dp_sysfs_del_dp(struct datapath *dp) { return 0; }
#else /* !CONFIG_SYSFS */
int dp_sysfs_add_dp(struct datapath *dp) { return 0; }
int dp_sysfs_del_dp(struct datapath *dp) { return 0; }
-int dp_sysfs_add_if(struct net_bridge_port *p) { return 0; }
-int dp_sysfs_del_if(struct net_bridge_port *p) { return 0; }
+int dp_sysfs_add_if(struct dp_port *p) { return 0; }
+int dp_sysfs_del_if(struct dp_port *p) { return 0; }