projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
python: Avoid using 'type' as a variable name.
[openvswitch]
/
lib
/
netdev.c
diff --git
a/lib/netdev.c
b/lib/netdev.c
index ec8ae4fc41a303a6f6d50c4c47f9ab2a9dd5996e..12ac81d6edf0b67a0b263f25f142f7925efbf333 100644
(file)
--- a/
lib/netdev.c
+++ b/
lib/netdev.c
@@
-192,14
+192,15
@@
netdev_enumerate_types(struct sset *types)
}
}
}
}
-/* Opens the network device named 'name' (e.g. "eth0") and returns zero if
- * successful, otherwise a positive errno value. On success, sets '*netdevp'
- * to the new network device, otherwise to null.
+/* Opens the network device named 'name' (e.g. "eth0") of the specified 'type'
+ * (e.g. "system") and returns zero if successful, otherwise a positive errno
+ * value. On success, sets '*netdevp' to the new network device, otherwise to
+ * null.
*
* Some network devices may need to be configured (with netdev_set_config())
* before they can be used. */
int
*
* Some network devices may need to be configured (with netdev_set_config())
* before they can be used. */
int
-netdev_open(
struct netdev_options *options
, struct netdev **netdevp)
+netdev_open(
const char *name, const char *type
, struct netdev **netdevp)
{
struct netdev_dev *netdev_dev;
int error;
{
struct netdev_dev *netdev_dev;
int error;
@@
-207,18
+208,18
@@
netdev_open(struct netdev_options *options, struct netdev **netdevp)
*netdevp = NULL;
netdev_initialize();
*netdevp = NULL;
netdev_initialize();
- netdev_dev = shash_find_data(&netdev_dev_shash,
options->
name);
+ netdev_dev = shash_find_data(&netdev_dev_shash, name);
if (!netdev_dev) {
const struct netdev_class *class;
if (!netdev_dev) {
const struct netdev_class *class;
- class = netdev_lookup_provider(
options->
type);
+ class = netdev_lookup_provider(type);
if (!class) {
VLOG_WARN("could not create netdev %s of unknown type %s",
if (!class) {
VLOG_WARN("could not create netdev %s of unknown type %s",
-
options->name, options->
type);
+
name,
type);
return EAFNOSUPPORT;
}
return EAFNOSUPPORT;
}
- error = class->create(class,
options->
name, &netdev_dev);
+ error = class->create(class, name, &netdev_dev);
if (error) {
return error;
}
if (error) {
return error;
}
@@
-239,17
+240,6
@@
netdev_open(struct netdev_options *options, struct netdev **netdevp)
return error;
}
return error;
}
-int
-netdev_open_default(const char *name, struct netdev **netdevp)
-{
- struct netdev_options options;
-
- memset(&options, 0, sizeof options);
- options.name = name;
-
- return netdev_open(&options, netdevp);
-}
-
/* Reconfigures the device 'netdev' with 'args'. 'args' may be empty
* or NULL if none are needed. */
int
/* Reconfigures the device 'netdev' with 'args'. 'args' may be empty
* or NULL if none are needed. */
int
@@
-321,7
+311,7
@@
netdev_exists(const char *name)
struct netdev *netdev;
int error;
struct netdev *netdev;
int error;
- error = netdev_open
_default(name
, &netdev);
+ error = netdev_open
(name, "system"
, &netdev);
if (!error) {
netdev_close(netdev);
return true;
if (!error) {
netdev_close(netdev);
return true;
@@
-650,7
+640,7
@@
netdev_set_advertisements(struct netdev *netdev, uint32_t advertise)
*
* - EOPNOTSUPP: No IPv4 network stack attached to 'netdev'.
*
*
* - EOPNOTSUPP: No IPv4 network stack attached to 'netdev'.
*
- * 'address' or 'netmask' or both may be null, in which case the address or
+ * 'address' or 'netmask' or both may be null, in which case the address or
* netmask is not reported. */
int
netdev_get_in4(const struct netdev *netdev,
* netmask is not reported. */
int
netdev_get_in4(const struct netdev *netdev,
@@
-1265,7
+1255,7
@@
netdev_find_dev_by_in4(const struct in_addr *in4)
SSET_FOR_EACH (name, &dev_list) {
struct in_addr dev_in4;
SSET_FOR_EACH (name, &dev_list) {
struct in_addr dev_in4;
- if (!netdev_open
_default(name
, &netdev)
+ if (!netdev_open
(name, "system"
, &netdev)
&& !netdev_get_in4(netdev, &dev_in4, NULL)
&& dev_in4.s_addr == in4->s_addr) {
goto exit;
&& !netdev_get_in4(netdev, &dev_in4, NULL)
&& dev_in4.s_addr == in4->s_addr) {
goto exit;