From: pmf Date: Tue, 31 Jul 2007 19:46:16 +0000 (+0000) Subject: add support for block devices in restore_init_state() X-Git-Tag: v0.12.20~914 X-Git-Url: http://git.lttng.org/?a=commitdiff_plain;h=44c0619eb20fb7e34b3ec088219fe6d3c05cec75;p=lttv.git add support for block devices in restore_init_state() git-svn-id: http://ltt.polymtl.ca/svn@2575 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/lttv/lttv/state.c b/ltt/branches/poly/lttv/lttv/state.c index 0a058c62..bc4884ca 100644 --- a/ltt/branches/poly/lttv/lttv/state.c +++ b/ltt/branches/poly/lttv/lttv/state.c @@ -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;