add support for block devices in restore_init_state()
authorpmf <pmf@04897980-b3bd-0310-b5e0-8ef037075253>
Tue, 31 Jul 2007 19:46:16 +0000 (19:46 +0000)
committerpmf <pmf@04897980-b3bd-0310-b5e0-8ef037075253>
Tue, 31 Jul 2007 19:46:16 +0000 (19:46 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@2575 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/lttv/state.c

index 0a058c62dae633d29a943bd0b4721ddd6c494e4f..bc4884ca6e19950cb8711ef647070bb0397909e7 100644 (file)
@@ -185,6 +185,11 @@ static void lttv_state_free_process_table(GHashTable *processes);
 static void lttv_trace_states_read_raw(LttvTraceState *tcs, FILE *fp,
                        GPtrArray *quarktable);
 
+/* Resource function prototypes */
+static void bdev_state_free(gpointer key, gpointer value, gpointer user_data);
+static LttvBdevState *bdev_state_get(LttvTraceState *ts, guint16 devcode);
+
+
 void lttv_state_save(LttvTraceState *self, LttvAttribute *container)
 {
   LTTV_TRACE_STATE_GET_CLASS(self)->state_save(self, container);
@@ -298,6 +303,9 @@ restore_init_state(LttvTraceState *self)
     if(self->irq_states[i].mode_stack->len > 0)
       g_array_remove_range(self->irq_states[i].mode_stack, 0, self->irq_states[i].mode_stack->len);
   }
+
+  g_hash_table_foreach(self->bdev_states, bdev_state_free, NULL);
+  g_hash_table_steal_all(self->bdev_states);
   
 #if 0
   nb_tracefile = self->parent.tracefiles->len;
@@ -2259,7 +2267,7 @@ static gboolean soft_irq_entry(void *hook_data, void *call_data)
   return FALSE;
 }
 
-LttvBdevState *bdev_state_get(LttvTraceState *ts, guint16 devcode)
+static LttvBdevState *bdev_state_get(LttvTraceState *ts, guint16 devcode)
 {
   gint devcode_gint = devcode;
   gpointer bdev = g_hash_table_lookup(ts->bdev_states, &devcode_gint);
@@ -2278,6 +2286,14 @@ LttvBdevState *bdev_state_get(LttvTraceState *ts, guint16 devcode)
   return bdev;
 }
 
+static void bdev_state_free(gpointer key, gpointer value, gpointer user_data)
+{
+       LttvBdevState *bds = (LttvBdevState *) value;
+       
+       g_array_free(bds->mode_stack, FALSE);
+       g_free(bds);
+}
+
 static gboolean bdev_request_issue(void *hook_data, void *call_data)
 {
   LttvTracefileState *s = (LttvTracefileState *)call_data;
This page took 0.027173 seconds and 4 git commands to generate.