[augeas-devel] [PATCH] * src/augeas.h (aug_init): make loading the tree optional

David Lutterkort lutter at redhat.com
Wed Mar 18 23:04:57 UTC 2009


The new flag AUG_NO_LOAD can be used to keep aug_init from loading any
files. This gives the user a chance to modify /augeas/load and then call
aug_load.
---
 src/augeas.c |    5 +++--
 src/augeas.h |    3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/augeas.c b/src/augeas.c
index c3fc27a..42eaac3 100644
--- a/src/augeas.c
+++ b/src/augeas.c
@@ -278,8 +278,9 @@ struct augeas *aug_init(const char *root, const char *loadpath,
             continue;
         tree_from_transform(result, modl->name, xform);
     }
-    if (aug_load(result) < 0)
-        goto error;
+    if (!(result->flags & AUG_NO_LOAD))
+        if (aug_load(result) < 0)
+            goto error;
 
     return result;
 
diff --git a/src/augeas.h b/src/augeas.h
index b2f32f8..73deafe 100644
--- a/src/augeas.h
+++ b/src/augeas.h
@@ -44,8 +44,9 @@ enum aug_flags {
                                      expensive it is not done by default */
     AUG_NO_STDINC    = (1 << 3),   /* Do not use the builtin load path for
                                      modules */
-    AUG_SAVE_NOOP    = (1 << 4)   /* Make save a no-op process, just record
+    AUG_SAVE_NOOP    = (1 << 4),  /* Make save a no-op process, just record
                                      what would have changed */
+    AUG_NO_LOAD      = (1 << 5)   /* Do not load the tree from AUG_INIT */
 };
 
 /* Function: aug_init
-- 
1.6.0.6




More information about the augeas-devel mailing list