Describe dummy test model. Work on OpenFlow intro.
[openvswitch] / lib / dirs.c.in
index a5d9f317bca33ab194204a577a0140edaa9eb6b7..658a74b4c6179d7be18fbb6d5e5cc1d00e7bf4bd 100644 (file)
@@ -1,6 +1,6 @@
 #line 2 "@srcdir@/lib/dirs.c.in"
 /*
- * Copyright (c) 2008, 2009, 2010, 2011 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
 #include <config.h>
 #include "dirs.h"
 #include <stdlib.h>
+#include "util.h"
 
 struct directory {
     const char *value;          /* Actual value; NULL if not yet determined. */
@@ -65,6 +66,23 @@ ovs_logdir(void)
     return get_dir(&d);
 }
 
+const char *
+ovs_dbdir(void)
+{
+    static const char *dbdir;
+    if (!dbdir) {
+        dbdir = getenv("OVS_DBDIR");
+        if (!dbdir || !dbdir[0]) {
+            char *sysconfdir = getenv("OVS_SYSCONFDIR");
+
+            dbdir = (sysconfdir
+                     ? xasprintf("%s/openvswitch", sysconfdir)
+                     : @DBDIR@);
+        }
+    }
+    return dbdir;
+}
+
 const char *
 ovs_bindir(void)
 {