From 64ad04d23107e97832ec81c0cc32a95214196d6d Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Fri, 20 Aug 2010 13:42:12 -0700 Subject: remove workaround for "changed" status handling --- src/cstore/unionfs/cstore-unionfs.cpp | 47 ++++++++--------------------------- 1 file changed, 10 insertions(+), 37 deletions(-) (limited to 'src/cstore/unionfs/cstore-unionfs.cpp') diff --git a/src/cstore/unionfs/cstore-unionfs.cpp b/src/cstore/unionfs/cstore-unionfs.cpp index 7f14483..46611ed 100644 --- a/src/cstore/unionfs/cstore-unionfs.cpp +++ b/src/cstore/unionfs/cstore-unionfs.cpp @@ -780,33 +780,16 @@ UnionfsCstore::unmark_changed_with_descendants() bool UnionfsCstore::mark_changed() { - 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; - } + b_fs::path marker = get_work_path() / C_MARKER_CHANGED; + if (b_fs_exists(marker)) { + // already marked. treat as success. return true; } - - /* 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). - */ + 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; } @@ -883,18 +866,8 @@ UnionfsCstore::get_comment(string& comment, bool active_cfg) bool UnionfsCstore::marked_changed() { - /* 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()); + b_fs::path marker = get_work_path() / C_MARKER_CHANGED; + return b_fs_exists(marker); } /* XXX currently "committed marking" is done inside commit. -- cgit v1.2.3