aboutsummaryrefslogtreecommitdiff
path: root/lib/dummy.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2012-01-19 10:24:46 -0800
committerBen Pfaff <blp@nicira.com>2012-01-19 10:24:46 -0800
commit0cbfe35d74ab5f585033844b6513273aa16cca11 (patch)
tree9268d33f6fe403f02d9be2fc3a372b0fa2d28e0f /lib/dummy.c
parenta647150f01cf09eddc6d28bfec88b1bb8bab30df (diff)
dummy: Make --enable-dummy=override replace all dpifs, netdevs by dummies.
Plain "--enable-dummy" just creates new dummy dpif and netdev classes. This commit makes "--enable-dummy=override" go a step farther and actually delete and replace all the existing dpif and netdev classes by copies of the dummy class. This is useful for testing in an environment where changing the classes in Bridge or Interface records is challenging. Requested-by: Andrew Lambeth <wal@nicira.com> Tested-by: Andrew Lambeth <wal@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/dummy.c')
-rw-r--r--lib/dummy.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/dummy.c b/lib/dummy.c
index fe2fa621..a07830a6 100644
--- a/lib/dummy.c
+++ b/lib/dummy.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2011 Nicira Networks.
+ * Copyright (c) 2010, 2011, 2012 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,11 +22,16 @@
* testing. A client program might call this function if it is designed
* specifically for testing or the user enables it on the command line.
*
+ * If 'override' is false, then "dummy" dpif and netdev classes will be
+ * created. If 'override' is true, then in addition all existing dpif and
+ * netdev classes will be deleted and replaced by dummy classes.
+ *
* There is no strong reason why dummy devices shouldn't always be enabled. */
void
-dummy_enable(void)
+dummy_enable(bool override)
{
- netdev_dummy_register();
- dpif_dummy_register();
+ netdev_dummy_register(override);
+ dpif_dummy_register(override);
timeval_dummy_register();
}
+