[gvfs] Finish the TODOs in the journal apply code



commit dca2435679ca45199379867d1ec28f3bdfdeb1c8
Author: Alexander Larsson <alexl redhat com>
Date:   Mon Jun 22 15:45:14 2009 +0200

    Finish the TODOs in the journal apply code

 metadata/metatree.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/metadata/metatree.c b/metadata/metatree.c
index 8131b9a..6adca59 100644
--- a/metadata/metatree.c
+++ b/metadata/metatree.c
@@ -1963,6 +1963,7 @@ apply_journal_to_builder (MetaTree *tree,
   MetaJournal *journal;
   MetaJournalEntry *entry;
   guint32 *sizep;
+  guint64 mtime;
   char *journal_path, *journal_key, *source_path;
   char *value;
   char **strv;
@@ -1974,6 +1975,7 @@ apply_journal_to_builder (MetaTree *tree,
   entry = journal->first_entry;
   while (entry < journal->last_entry)
     {
+      mtime = GUINT64_FROM_BE (entry->mtime);
       journal_path = &entry->path[0];
 
       switch (entry->entry_type)
@@ -1985,6 +1987,7 @@ apply_journal_to_builder (MetaTree *tree,
 	  metafile_key_set_value (file,
 				  journal_key,
 				  value);
+	  metafile_set_mtime (file, mtime);
 	  break;
 	case JOURNAL_OP_SETV_KEY:
 	  journal_key = get_next_arg (journal_path);
@@ -1997,17 +2000,28 @@ apply_journal_to_builder (MetaTree *tree,
 	    metafile_key_list_add (file, journal_key, strv[i]);
 
 	  g_free (strv);
+	  metafile_set_mtime (file, mtime);
 	  break;
 	case JOURNAL_OP_UNSET_KEY:
 	  journal_key = get_next_arg (journal_path);
-	  /* TODO */
+	  file = meta_builder_lookup (builder, journal_path, FALSE);
+	  if (file)
+	    {
+	      metafile_key_unset (file, journal_key);
+	      metafile_set_mtime (file, mtime);
+	    }
 	  break;
 	case JOURNAL_OP_COPY_PATH:
 	  source_path = get_next_arg (journal_path);
-	  /* TODO */
+	  meta_builder_copy (builder,
+			     source_path,
+			     journal_path,
+			     mtime);
 	  break;
 	case JOURNAL_OP_REMOVE_PATH:
-	  /* TODO */
+	  meta_builder_remove (builder,
+			       journal_path,
+			       mtime);
 	  break;
 	default:
 	  break;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]