#define BRC_SYSFS_H 1
struct datapath;
+struct net_bridge_port;
-#include <linux/version.h>
/* brc_sysfs_dp.c */
int brc_sysfs_add_dp(struct datapath *dp);
int brc_sysfs_del_dp(struct datapath *dp);
int brc_sysfs_add_if(struct net_bridge_port *p);
int brc_sysfs_del_if(struct net_bridge_port *p);
+#include <linux/version.h>
+#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,18)
+#define SUPPORT_SYSFS 1
+#else
+/* We only support sysfs on Linux 2.6.18 because that's the only place we
+ * really need it (on Xen, for brcompat) and it's a big pain to try to support
+ * multiple versions. */
+#endif
+
#endif /* brc_sysfs.h */
#include "datapath.h"
#include "dp_dev.h"
-#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,18)
+#ifdef SUPPORT_SYSFS
#define to_dev(obj) container_of(obj, struct device, kobj)
/* Hack to attempt to build on more platforms. */
return 0;
}
-#else
+#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; }
kfree(p);
return 0;
}
-#endif
+#endif /* !SUPPORT_SYSFS */
-#include <linux/version.h>
-#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,18)
-
/*
* Sysfs attributes of bridge ports for OpenVSwitch
*
#include <linux/if_bridge.h>
#include <linux/rtnetlink.h>
#include <linux/spinlock.h>
-
#include "brc_sysfs.h"
#include "datapath.h"
+#ifdef SUPPORT_SYSFS
+
struct brport_attribute {
struct attribute attr;
ssize_t (*show)(struct net_bridge_port *, char *);
return 0;
}
-#endif /* Only support 2.6.18 */
+#endif /* SUPPORT_SYSFS */
{
if (!try_module_get(THIS_MODULE))
return -ENODEV;
-#if CONFIG_SYSFS
+#ifdef SUPPORT_SYSFS
brc_sysfs_add_dp(dp);
#endif
int brc_del_dp(struct datapath *dp)
{
-#if CONFIG_SYSFS
+#ifdef SUPPORT_SYSFS
brc_sysfs_del_dp(dp);
#endif
module_put(THIS_MODULE);
dp_del_dp_hook = brc_del_dp;
/* Register hooks for interface adds and deletes */
-#if CONFIG_SYSFS
+#ifdef SUPPORT_SYSFS
dp_add_if_hook = brc_sysfs_add_if;
dp_del_if_hook = brc_sysfs_del_if;
#endif
{
ASSERT_RTNL();
-#if CONFIG_SYSFS
+#ifdef SUPPORT_SYSFS
if ((p->port_no != ODPP_LOCAL) && dp_del_if_hook)
sysfs_remove_link(&p->dp->ifobj, p->dev->name);
#endif
#include <linux/workqueue.h>
#include <linux/skbuff.h>
#include "flow.h"
+#include "brc_sysfs.h"
struct sk_buff;
struct net_device *netdev; /* ofX network device. */
+#ifdef SUPPORT_SYSFS
struct kobject ifobj;
+#endif
int drop_frags;
u16 port_no;
struct datapath *dp;
struct net_device *dev;
+#ifdef SUPPORT_SYSFS
struct kobject kobj;
+#endif
#ifdef SUPPORT_SNAT
spinlock_t lock;
struct snat_conf *snat;