[ovs-discuss] [NIC-20 04/11] datapath: Rename brc_sysfs_* to dp_sysfs_*.

Ben Pfaff blp at nicira.com
Wed Aug 5 22:37:07 UTC 2009


These files and names are now part of the datapath, not brcompat, so name
them appropriately so as not to confuse anyone.
---
 datapath/Modules.mk                        |    6 ++--
 datapath/brcompat.c                        |    1 -
 datapath/datapath.c                        |    8 ++--
 datapath/datapath.h                        |    2 +-
 datapath/{brc_sysfs.h => dp_sysfs.h}       |   18 +++++-----
 datapath/{brc_sysfs_dp.c => dp_sysfs_dp.c} |   52 ++++++++++++++--------------
 datapath/{brc_sysfs_if.c => dp_sysfs_if.c} |    6 ++--
 datapath/linux-2.6/.gitignore              |    4 +-
 8 files changed, 48 insertions(+), 49 deletions(-)
 rename datapath/{brc_sysfs.h => dp_sysfs.h} (65%)
 rename datapath/{brc_sysfs_dp.c => dp_sysfs_dp.c} (88%)
 rename datapath/{brc_sysfs_if.c => dp_sysfs_if.c} (98%)

diff --git a/datapath/Modules.mk b/datapath/Modules.mk
index b7d54d1..211f96f 100644
--- a/datapath/Modules.mk
+++ b/datapath/Modules.mk
@@ -11,20 +11,20 @@ dist_modules = $(both_modules)	# Modules to distribute
 
 openvswitch_sources = \
 	actions.c \
-	brc_sysfs_dp.c \
-	brc_sysfs_if.c \
 	datapath.c \
 	dp_dev.c \
 	dp_notify.c \
+	dp_sysfs_dp.c \
+	dp_sysfs_if.c \
 	flow.c \
 	table.c
 
 openvswitch_headers = \
 	actions.h \
-	brc_sysfs.h \
 	compat.h \
 	datapath.h \
 	dp_dev.h \
+	dp_sysfs.h \
 	flow.h
 
 dist_sources = $(foreach module,$(dist_modules),$($(module)_sources))
diff --git a/datapath/brcompat.c b/datapath/brcompat.c
index 46e7f2b..be361ec 100644
--- a/datapath/brcompat.c
+++ b/datapath/brcompat.c
@@ -20,7 +20,6 @@
 #include "compat.h"
 #include "openvswitch/brcompat-netlink.h"
 #include "brc_procfs.h"
-#include "brc_sysfs.h"
 #include "datapath.h"
 #include "dp_dev.h"
 
diff --git a/datapath/datapath.c b/datapath/datapath.c
index cfe660f..d8bd245 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -240,7 +240,7 @@ static int create_dp(int dp_idx, const char __user *devnamep)
 	rtnl_unlock();
 
 #ifdef SUPPORT_SYSFS
-	brc_sysfs_add_dp(dp);
+	dp_sysfs_add_dp(dp);
 #endif
 
 	return 0;
@@ -270,7 +270,7 @@ static void do_destroy_dp(struct datapath *dp)
 			dp_del_port(p);
 
 #ifdef SUPPORT_SYSFS
-	brc_sysfs_del_dp(dp);
+	dp_sysfs_del_dp(dp);
 #endif
 
 	rcu_assign_pointer(dps[dp->dp_idx], NULL);
@@ -394,7 +394,7 @@ static int add_port(int dp_idx, struct odp_port __user *portp)
 		goto out_put;
 
 #ifdef SUPPORT_SYSFS
-	brc_sysfs_add_if(dp->ports[port_no]);
+	dp_sysfs_add_if(dp->ports[port_no]);
 #endif
 
 out_put:
@@ -439,7 +439,7 @@ int dp_del_port(struct net_bridge_port *p)
 		dp_dev_destroy(p->dev);
 	}
 	if (p->port_no != ODPP_LOCAL) {
-		brc_sysfs_del_if(p);
+		dp_sysfs_del_if(p);
 	} else {
 		dev_put(p->dev);
 		kfree(p);
diff --git a/datapath/datapath.h b/datapath/datapath.h
index 6ff8d21..e778a70 100644
--- a/datapath/datapath.h
+++ b/datapath/datapath.h
@@ -19,7 +19,7 @@
 #include <linux/workqueue.h>
 #include <linux/skbuff.h>
 #include "flow.h"
-#include "brc_sysfs.h"
+#include "dp_sysfs.h"
 
 /* Mask for the priority bits in a vlan header.  If we ever merge upstream
  * then this should go into include/linux/if_vlan.h. */
diff --git a/datapath/brc_sysfs.h b/datapath/dp_sysfs.h
similarity index 65%
rename from datapath/brc_sysfs.h
rename to datapath/dp_sysfs.h
index 526f5fa..d98fdf3 100644
--- a/datapath/brc_sysfs.h
+++ b/datapath/dp_sysfs.h
@@ -6,19 +6,19 @@
  * kernel, by Linus Torvalds and others.
  */
 
-#ifndef BRC_SYSFS_H
-#define BRC_SYSFS_H 1
+#ifndef DP_SYSFS_H
+#define DP_SYSFS_H 1
 
 struct datapath;
 struct net_bridge_port;
 
-/* brc_sysfs_dp.c */
-int brc_sysfs_add_dp(struct datapath *dp);
-int brc_sysfs_del_dp(struct datapath *dp);
+/* dp_sysfs_dp.c */
+int dp_sysfs_add_dp(struct datapath *dp);
+int dp_sysfs_del_dp(struct datapath *dp);
 
-/* brc_sysfs_if.c */
-int brc_sysfs_add_if(struct net_bridge_port *p);
-int brc_sysfs_del_if(struct net_bridge_port *p);
+/* dp_sysfs_if.c */
+int dp_sysfs_add_if(struct net_bridge_port *p);
+int dp_sysfs_del_if(struct net_bridge_port *p);
 
 #include <linux/version.h>
 #if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,18)
@@ -29,5 +29,5 @@ int brc_sysfs_del_if(struct net_bridge_port *p);
  * multiple versions. */
 #endif
 
-#endif /* brc_sysfs.h */
+#endif /* dp_sysfs.h */
 
diff --git a/datapath/brc_sysfs_dp.c b/datapath/dp_sysfs_dp.c
similarity index 88%
rename from datapath/brc_sysfs_dp.c
rename to datapath/dp_sysfs_dp.c
index d5c4fc2..714a4b2 100644
--- a/datapath/brc_sysfs_dp.c
+++ b/datapath/dp_sysfs_dp.c
@@ -24,7 +24,7 @@
 #include <linux/times.h>
 #include <linux/version.h>
 
-#include "brc_sysfs.h"
+#include "dp_sysfs.h"
 #include "datapath.h"
 #include "dp_dev.h"
 
@@ -34,10 +34,10 @@
 /* Hack to attempt to build on more platforms. */
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)
 #define to_kobj(d) &(d)->class_dev.kobj
-#define BRC_DEVICE_ATTR CLASS_DEVICE_ATTR
+#define DP_DEVICE_ATTR CLASS_DEVICE_ATTR
 #else
 #define to_kobj(d) &(d)->dev.kobj
-#define BRC_DEVICE_ATTR DEVICE_ATTR
+#define DP_DEVICE_ATTR DEVICE_ATTR
 #endif
 
 /*
@@ -104,7 +104,7 @@ static ssize_t store_forward_delay(struct class_device *d,
 {
 	return store_bridge_parm(d, buf, len, set_forward_delay);
 }
-static BRC_DEVICE_ATTR(forward_delay, S_IRUGO | S_IWUSR,
+static DP_DEVICE_ATTR(forward_delay, S_IRUGO | S_IWUSR,
 		   show_forward_delay, store_forward_delay);
 
 static ssize_t show_hello_time(struct class_device *d, char *buf)
@@ -135,7 +135,7 @@ static ssize_t store_hello_time(struct class_device *d,
 {
 	return store_bridge_parm(d, buf, len, set_hello_time);
 }
-static BRC_DEVICE_ATTR(hello_time, S_IRUGO | S_IWUSR, show_hello_time,
+static DP_DEVICE_ATTR(hello_time, S_IRUGO | S_IWUSR, show_hello_time,
 		   store_hello_time);
 
 static ssize_t show_max_age(struct class_device *d, 
@@ -166,7 +166,7 @@ static ssize_t store_max_age(struct class_device *d,
 {
 	return store_bridge_parm(d, buf, len, set_max_age);
 }
-static BRC_DEVICE_ATTR(max_age, S_IRUGO | S_IWUSR, show_max_age, store_max_age);
+static DP_DEVICE_ATTR(max_age, S_IRUGO | S_IWUSR, show_max_age, store_max_age);
 
 static ssize_t show_ageing_time(struct class_device *d,
 				char *buf)
@@ -193,7 +193,7 @@ static ssize_t store_ageing_time(struct class_device *d,
 {
 	return store_bridge_parm(d, buf, len, set_ageing_time);
 }
-static BRC_DEVICE_ATTR(ageing_time, S_IRUGO | S_IWUSR, show_ageing_time,
+static DP_DEVICE_ATTR(ageing_time, S_IRUGO | S_IWUSR, show_ageing_time,
 		   store_ageing_time);
 
 static ssize_t show_stp_state(struct class_device *d,
@@ -233,7 +233,7 @@ static ssize_t store_stp_state(struct class_device *d,
 
 	return len;
 }
-static BRC_DEVICE_ATTR(stp_state, S_IRUGO | S_IWUSR, show_stp_state,
+static DP_DEVICE_ATTR(stp_state, S_IRUGO | S_IWUSR, show_stp_state,
 		   store_stp_state);
 
 static ssize_t show_priority(struct class_device *d, 
@@ -262,7 +262,7 @@ static ssize_t store_priority(struct class_device *d,
 {
 	return store_bridge_parm(d, buf, len, set_priority);
 }
-static BRC_DEVICE_ATTR(priority, S_IRUGO | S_IWUSR, show_priority, store_priority);
+static DP_DEVICE_ATTR(priority, S_IRUGO | S_IWUSR, show_priority, store_priority);
 
 static ssize_t show_root_id(struct class_device *d, 
 			    char *buf)
@@ -273,7 +273,7 @@ static ssize_t show_root_id(struct class_device *d,
 	return sprintf(buf, "0000.010203040506\n");
 #endif
 }
-static BRC_DEVICE_ATTR(root_id, S_IRUGO, show_root_id, NULL);
+static DP_DEVICE_ATTR(root_id, S_IRUGO, show_root_id, NULL);
 
 static ssize_t show_bridge_id(struct class_device *d, 
 			      char *buf)
@@ -285,7 +285,7 @@ static ssize_t show_bridge_id(struct class_device *d,
 	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 BRC_DEVICE_ATTR(bridge_id, S_IRUGO, show_bridge_id, NULL);
+static DP_DEVICE_ATTR(bridge_id, S_IRUGO, show_bridge_id, NULL);
 
 static ssize_t show_root_port(struct class_device *d, 
 			      char *buf)
@@ -296,7 +296,7 @@ static ssize_t show_root_port(struct class_device *d,
 	return sprintf(buf, "%d\n", 0);
 #endif
 }
-static BRC_DEVICE_ATTR(root_port, S_IRUGO, show_root_port, NULL);
+static DP_DEVICE_ATTR(root_port, S_IRUGO, show_root_port, NULL);
 
 static ssize_t show_root_path_cost(struct class_device *d,
 				   char *buf)
@@ -307,7 +307,7 @@ static ssize_t show_root_path_cost(struct class_device *d,
 	return sprintf(buf, "%d\n", 0);
 #endif
 }
-static BRC_DEVICE_ATTR(root_path_cost, S_IRUGO, show_root_path_cost, NULL);
+static DP_DEVICE_ATTR(root_path_cost, S_IRUGO, show_root_path_cost, NULL);
 
 static ssize_t show_topology_change(struct class_device *d,
 				    char *buf)
@@ -318,7 +318,7 @@ static ssize_t show_topology_change(struct class_device *d,
 	return sprintf(buf, "%d\n", 0);
 #endif
 }
-static BRC_DEVICE_ATTR(topology_change, S_IRUGO, show_topology_change, NULL);
+static DP_DEVICE_ATTR(topology_change, S_IRUGO, show_topology_change, NULL);
 
 static ssize_t show_topology_change_detected(struct class_device *d,
 					     char *buf)
@@ -330,7 +330,7 @@ static ssize_t show_topology_change_detected(struct class_device *d,
 	return sprintf(buf, "%d\n", 0);
 #endif
 }
-static BRC_DEVICE_ATTR(topology_change_detected, S_IRUGO,
+static DP_DEVICE_ATTR(topology_change_detected, S_IRUGO,
 		   show_topology_change_detected, NULL);
 
 static ssize_t show_hello_timer(struct class_device *d,
@@ -343,7 +343,7 @@ static ssize_t show_hello_timer(struct class_device *d,
 	return sprintf(buf, "%d\n", 0);
 #endif
 }
-static BRC_DEVICE_ATTR(hello_timer, S_IRUGO, show_hello_timer, NULL);
+static DP_DEVICE_ATTR(hello_timer, S_IRUGO, show_hello_timer, NULL);
 
 static ssize_t show_tcn_timer(struct class_device *d, 
 			      char *buf)
@@ -355,7 +355,7 @@ static ssize_t show_tcn_timer(struct class_device *d,
 	return sprintf(buf, "%d\n", 0);
 #endif
 }
-static BRC_DEVICE_ATTR(tcn_timer, S_IRUGO, show_tcn_timer, NULL);
+static DP_DEVICE_ATTR(tcn_timer, S_IRUGO, show_tcn_timer, NULL);
 
 static ssize_t show_topology_change_timer(struct class_device *d,
 					  char *buf)
@@ -367,7 +367,7 @@ static ssize_t show_topology_change_timer(struct class_device *d,
 	return sprintf(buf, "%d\n", 0);
 #endif
 }
-static BRC_DEVICE_ATTR(topology_change_timer, S_IRUGO, show_topology_change_timer,
+static DP_DEVICE_ATTR(topology_change_timer, S_IRUGO, show_topology_change_timer,
 		   NULL);
 
 static ssize_t show_gc_timer(struct class_device *d, 
@@ -380,7 +380,7 @@ static ssize_t show_gc_timer(struct class_device *d,
 	return sprintf(buf, "%d\n", 0);
 #endif
 }
-static BRC_DEVICE_ATTR(gc_timer, S_IRUGO, show_gc_timer, NULL);
+static DP_DEVICE_ATTR(gc_timer, S_IRUGO, show_gc_timer, NULL);
 
 static ssize_t show_group_addr(struct class_device *d,
 			       char *buf)
@@ -435,7 +435,7 @@ static ssize_t store_group_addr(struct class_device *d,
 	return len;
 }
 
-static BRC_DEVICE_ATTR(group_addr, S_IRUGO | S_IWUSR,
+static DP_DEVICE_ATTR(group_addr, S_IRUGO | S_IWUSR,
 		   show_group_addr, store_group_addr);
 
 static struct attribute *bridge_attrs[] = {
@@ -474,7 +474,7 @@ static struct attribute_group bridge_group = {
  *   to hold links.  The ifobj exists in the same data structure
  *   as its parent the bridge so reference counting works.
  */
-int brc_sysfs_add_dp(struct datapath *dp)
+int dp_sysfs_add_dp(struct datapath *dp)
 {
 	struct kobject *kobj = to_kobj(dp->ports[ODPP_LOCAL]->dev);
 	int err;
@@ -515,7 +515,7 @@ int brc_sysfs_add_dp(struct datapath *dp)
 	return err;
 }
 
-int brc_sysfs_del_dp(struct datapath *dp)
+int dp_sysfs_del_dp(struct datapath *dp)
 {
 	struct kobject *kobj = to_kobj(dp->ports[ODPP_LOCAL]->dev);
 
@@ -529,10 +529,10 @@ int brc_sysfs_del_dp(struct datapath *dp)
 	return 0;
 }
 #else /* !SUPPORT_SYSFS */
-int brc_sysfs_add_dp(struct datapath *dp) { return 0; }
-int brc_sysfs_del_dp(struct datapath *dp) { return 0; }
-int brc_sysfs_add_if(struct net_bridge_port *p) { return 0; }
-int brc_sysfs_del_if(struct net_bridge_port *p)
+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)
 {
 	dev_put(p->dev);
 	kfree(p);
diff --git a/datapath/brc_sysfs_if.c b/datapath/dp_sysfs_if.c
similarity index 98%
rename from datapath/brc_sysfs_if.c
rename to datapath/dp_sysfs_if.c
index 5cae6a9..f118818 100644
--- a/datapath/brc_sysfs_if.c
+++ b/datapath/dp_sysfs_if.c
@@ -18,7 +18,7 @@
 #include <linux/if_bridge.h>
 #include <linux/rtnetlink.h>
 #include <linux/spinlock.h>
-#include "brc_sysfs.h"
+#include "dp_sysfs.h"
 #include "datapath.h"
 
 #ifdef SUPPORT_SYSFS
@@ -283,7 +283,7 @@ struct kobj_type brport_ktype = {
  * Creates a brport subdirectory with bridge attributes.
  * Puts symlink in bridge's brport subdirectory
  */
-int brc_sysfs_add_if(struct net_bridge_port *p)
+int dp_sysfs_add_if(struct net_bridge_port *p)
 {
 	struct datapath *dp = p->dp;
 	struct brport_attribute **a;
@@ -332,7 +332,7 @@ err_put:
 	return err;
 }
 
-int brc_sysfs_del_if(struct net_bridge_port *p)
+int dp_sysfs_del_if(struct net_bridge_port *p)
 {
 	struct net_device *dev = p->dev;
 
diff --git a/datapath/linux-2.6/.gitignore b/datapath/linux-2.6/.gitignore
index af5821a..aa10e66 100644
--- a/datapath/linux-2.6/.gitignore
+++ b/datapath/linux-2.6/.gitignore
@@ -3,8 +3,8 @@
 /Makefile.main
 /actions.c
 /brcompat.c
-/brc_sysfs_dp.c
-/brc_sysfs_if.c
+/dp_sysfs_dp.c
+/dp_sysfs_if.c
 /datapath.c
 /dp_dev.c
 /dp_notify.c
-- 
1.6.3.3





More information about the discuss mailing list