projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sflow: Avoid division by zero if sampling rate is 0.
[openvswitch]
/
datapath
/
dp_sysfs_if.c
diff --git
a/datapath/dp_sysfs_if.c
b/datapath/dp_sysfs_if.c
index 178afbd733dea14af34f4502ee7cbebd57b05129..95c26dc420bf8b325662d8b1b572530effddd497 100644
(file)
--- a/
datapath/dp_sysfs_if.c
+++ b/
datapath/dp_sysfs_if.c
@@
-21,7
+21,7
@@
#include "dp_sysfs.h"
#include "datapath.h"
#include "dp_sysfs.h"
#include "datapath.h"
-#ifdef
SUPPORT
_SYSFS
+#ifdef
CONFIG
_SYSFS
struct brport_attribute {
struct attribute attr;
struct brport_attribute {
struct attribute attr;
@@
-278,9
+278,10
@@
int dp_sysfs_add_if(struct net_bridge_port *p)
int err;
/* Create /sys/class/net/<devname>/brport directory. */
int err;
/* Create /sys/class/net/<devname>/brport directory. */
- err = kobject_add(&p->kobj);
+ err = kobject_add(&p->kobj, &p->dev->NETDEV_DEV_MEMBER.kobj,
+ SYSFS_BRIDGE_PORT_ATTR);
if (err)
if (err)
- goto err
_put
;
+ goto err;
/* Create symlink from /sys/class/net/<devname>/brport/bridge to
* /sys/class/net/<bridgename>. */
/* Create symlink from /sys/class/net/<devname>/brport/bridge to
* /sys/class/net/<bridgename>. */
@@
-302,27
+303,27
@@
int dp_sysfs_add_if(struct net_bridge_port *p)
err = sysfs_create_link(&dp->ifobj, &p->kobj, p->dev->name);
if (err)
goto err_del;
err = sysfs_create_link(&dp->ifobj, &p->kobj, p->dev->name);
if (err)
goto err_del;
+ strcpy(p->linkname, p->dev->name);
kobject_uevent(&p->kobj, KOBJ_ADD);
kobject_uevent(&p->kobj, KOBJ_ADD);
- return
err
;
+ return
0
;
err_del:
kobject_del(&p->kobj);
err_del:
kobject_del(&p->kobj);
-err_put:
- kobject_put(&p->kobj);
-
- /* Ensure that dp_sysfs_del_if becomes a no-op. */
- p->kobj.dentry = NULL;
+err:
+ p->linkname[0] = 0;
return err;
}
int dp_sysfs_del_if(struct net_bridge_port *p)
{
return err;
}
int dp_sysfs_del_if(struct net_bridge_port *p)
{
- if (p->kobj.dentry) {
+ if (p->linkname[0]) {
+ sysfs_remove_link(&p->dp->ifobj, p->linkname);
kobject_uevent(&p->kobj, KOBJ_REMOVE);
kobject_del(&p->kobj);
kobject_uevent(&p->kobj, KOBJ_REMOVE);
kobject_del(&p->kobj);
+ p->linkname[0] = '\0';
}
return 0;
}
}
return 0;
}
-#endif /*
SUPPORT
_SYSFS */
+#endif /*
CONFIG
_SYSFS */