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 f118818bd2b6daad4dded24f691de70c0c3227c0..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;
@@
-266,18
+266,6
@@
struct sysfs_ops brport_sysfs_ops = {
.store = brport_store,
};
.store = brport_store,
};
-static void release_nbp(struct kobject *kobj)
-{
- struct net_bridge_port *p
- = container_of(kobj, struct net_bridge_port, kobj);
- kfree(p);
-}
-
-struct kobj_type brport_ktype = {
- .sysfs_ops = &brport_sysfs_ops,
- .release = release_nbp
-};
-
/*
* Add sysfs entries to ethernet device added to a bridge.
* Creates a brport subdirectory with bridge attributes.
/*
* Add sysfs entries to ethernet device added to a bridge.
* Creates a brport subdirectory with bridge attributes.
@@
-290,20
+278,15
@@
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. */
- kobject_init(&p->kobj);
- kobject_set_name(&p->kobj, SYSFS_BRIDGE_PORT_ATTR); /* "brport" */
- p->kobj.ktype = &brport_ktype;
- p->kobj.kset = NULL;
- p->kobj.parent = &(p->dev->class_dev.kobj);
-
- 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>. */
err = sysfs_create_link(&p->kobj,
/* Create symlink from /sys/class/net/<devname>/brport/bridge to
* /sys/class/net/<bridgename>. */
err = sysfs_create_link(&p->kobj,
- &dp->ports[ODPP_LOCAL]->dev->
class_dev
.kobj,
+ &dp->ports[ODPP_LOCAL]->dev->
NETDEV_DEV_MEMBER
.kobj,
SYSFS_BRIDGE_PORT_LINK); /* "bridge" */
if (err)
goto err_del;
SYSFS_BRIDGE_PORT_LINK); /* "bridge" */
if (err)
goto err_del;
@@
-320,29
+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)
;
+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)
{
- struct net_device *dev = p->dev;
-
- kobject_uevent(&p->kobj, KOBJ_REMOVE);
- kobject_del(&p->kobj);
-
- dev_put(dev);
-
- kobject_put(&p->kobj);
-
+ if (p->linkname[0]) {
+ sysfs_remove_link(&p->dp->ifobj, p->linkname);
+ kobject_uevent(&p->kobj, KOBJ_REMOVE);
+ kobject_del(&p->kobj);
+ p->linkname[0] = '\0';
+ }
return 0;
}
return 0;
}
-#endif /*
SUPPORT
_SYSFS */
+#endif /*
CONFIG
_SYSFS */