summaryrefslogtreecommitdiff
path: root/src/cstore
diff options
context:
space:
mode:
Diffstat (limited to 'src/cstore')
-rw-r--r--src/cstore/cstore.cpp2
-rw-r--r--src/cstore/unionfs/cstore-unionfs.cpp47
2 files changed, 38 insertions, 11 deletions
diff --git a/src/cstore/cstore.cpp b/src/cstore/cstore.cpp
index 86a9455..f146cb0 100644
--- a/src/cstore/cstore.cpp
+++ b/src/cstore/cstore.cpp
@@ -2552,7 +2552,7 @@ Cstore::create_default_children()
// has default value. set it.
push_cfg_path(tcnodes[i]);
if (!add_node() || !write_value(def.def_default)
- || !mark_display_default() || !mark_changed()) {
+ || !mark_display_default()) {
ret = false;
}
pop_cfg_path();
diff --git a/src/cstore/unionfs/cstore-unionfs.cpp b/src/cstore/unionfs/cstore-unionfs.cpp
index 46611ed..7f14483 100644
--- a/src/cstore/unionfs/cstore-unionfs.cpp
+++ b/src/cstore/unionfs/cstore-unionfs.cpp
@@ -780,16 +780,33 @@ UnionfsCstore::unmark_changed_with_descendants()
bool
UnionfsCstore::mark_changed()
{
- b_fs::path marker = get_work_path() / C_MARKER_CHANGED;
- if (b_fs_exists(marker)) {
- // already marked. treat as success.
+ if (!mutable_cfg_path.has_parent_path()) {
+ /* at root, mark changed. root marker is needed by the original
+ * implementation as an indication of whether the whole config
+ * has changed.
+ */
+ b_fs::path marker = get_work_path() / C_MARKER_CHANGED;
+ if (b_fs_exists(marker)) {
+ // already marked. treat as success.
+ return true;
+ }
+ if (!create_file(marker.file_string())) {
+ output_internal("failed to mark changed [%s]\n",
+ get_work_path().file_string().c_str());
+ return false;
+ }
return true;
}
- if (!create_file(marker.file_string())) {
- output_internal("failed to mark changed [%s]\n",
- get_work_path().file_string().c_str());
- return false;
- }
+
+ /* XXX not at root => nop for now.
+ * we should be marking changed here. however, as commit is still
+ * using its own unionfs implementation, it will not understand the
+ * markers and therefore will not perform the necessary cleanup when
+ * it's done.
+ *
+ * for now, don't mark anything besides root. the query function
+ * will use unionfs-specific implementation (changes-only dir).
+ */
return true;
}
@@ -866,8 +883,18 @@ UnionfsCstore::get_comment(string& comment, bool active_cfg)
bool
UnionfsCstore::marked_changed()
{
- b_fs::path marker = get_work_path() / C_MARKER_CHANGED;
- return b_fs_exists(marker);
+ /* this function is only called by cfgPathChanged() in base class.
+ *
+ * XXX currently just use the changes_only dir for this query.
+ * see explanation in mark_changed().
+ *
+ * this implementation relies on the fact that cfgPathChanged()
+ * includes deleted/added nodes (including deactivated/activated
+ * nodes since it's NOT deactivate-aware). if that is not the case,
+ * result will be different between deleted nodes (NOT IN
+ * changes_only) and deactivated nodes (IN changes_only).
+ */
+ return b_fs_exists(get_change_path());
}
/* XXX currently "committed marking" is done inside commit.