X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_chkpt_stores.h;h=d7bc3f07207269b2a0947750f2e07494bfdc20d6;hb=40a6dd36505a959c132c32497aa50bd74afd8250;hp=3c2572b8a695255af6beb11959429b52ec6ca161;hpb=46255dee5894bc5e3be5f54a5866c0c4b30b3896;p=palacios.git diff --git a/palacios/src/palacios/vmm_chkpt_stores.h b/palacios/src/palacios/vmm_chkpt_stores.h index 3c2572b..d7bc3f0 100644 --- a/palacios/src/palacios/vmm_chkpt_stores.h +++ b/palacios/src/palacios/vmm_chkpt_stores.h @@ -47,11 +47,11 @@ static struct {} null_store __attribute__((__used__)) \ static void * debug_open_chkpt(char * url, chkpt_mode_t mode) { if (mode == LOAD) { - V3_Print("Cannot load from debug store\n"); + V3_Print(VM_NONE, VCORE_NONE, "Cannot load from debug store\n"); return NULL; } - V3_Print("Opening Checkpoint: %s\n", url); + V3_Print(VM_NONE, VCORE_NONE, "Opening Checkpoint: %s\n", url); return (void *)1; } @@ -59,25 +59,24 @@ static void * debug_open_chkpt(char * url, chkpt_mode_t mode) { static int debug_close_chkpt(void * store_data) { - V3_Print("Closing Checkpoint\n"); + V3_Print(VM_NONE, VCORE_NONE, "Closing Checkpoint\n"); return 0; } static void * debug_open_ctx(void * store_data, - void * parent_ctx, char * name) { - V3_Print("[%s]\n", name); + V3_Print(VM_NONE, VCORE_NONE, "[%s]\n", name); return (void *)1; } static int debug_close_ctx(void * store_data, void * ctx) { - V3_Print("[CLOSE]\n"); + V3_Print(VM_NONE, VCORE_NONE, "[CLOSE]\n"); return 0; } static int debug_save(void * store_data, void * ctx, char * tag, uint64_t len, void * buf) { - V3_Print("%s:\n", tag); + V3_Print(VM_NONE, VCORE_NONE, "%s:\n", tag); if (len > 100) { len = 100; @@ -90,7 +89,7 @@ static int debug_save(void * store_data, void * ctx, static int debug_load(void * store_data, void * ctx, char * tag, uint64_t len, void * buf) { - V3_Print("Loading not supported !!!\n"); + V3_Print(VM_NONE, VCORE_NONE, "Loading not supported !!!\n"); return 0; } @@ -109,7 +108,6 @@ register_chkpt_store(debug_store); - #ifdef V3_CONFIG_KEYED_STREAMS #include @@ -135,7 +133,6 @@ static int keyed_stream_close_chkpt(void * store_data) { } static void * keyed_stream_open_ctx(void * store_data, - void * parent_ctx, char * name) { v3_keyed_stream_t stream = store_data; @@ -152,20 +149,20 @@ static int keyed_stream_close_ctx(void * store_data, void * ctx) { static int keyed_stream_save(void * store_data, void * ctx, char * tag, uint64_t len, void * buf) { - if (v3_keyed_stream_write_key(store_data, ctx, buf, len) != len) { - return -1; - } else { - return 0; - } + if (v3_keyed_stream_write_key(store_data, ctx, tag, strlen(tag), buf, len) != len) { + return -1; + } else { + return 0; + } } static int keyed_stream_load(void * store_data, void * ctx, char * tag, uint64_t len, void * buf) { - if (v3_keyed_stream_read_key(store_data, ctx, buf, len) != len) { - return -1; - } else { - return 0; - } + if (v3_keyed_stream_read_key(store_data, ctx, tag, strlen(tag), buf, len) != len) { + return -1; + } else { + return 0; + } } @@ -215,7 +212,6 @@ static int dir_close_chkpt(void * store_data) { } static void * dir_open_ctx(void * store_data, - void * parent_ctx, char * name) { char * url = store_data; @@ -223,9 +219,23 @@ static void * dir_open_ctx(void * store_data, ctx = V3_Malloc(sizeof(struct file_ctx)); + + if (!ctx) { + PrintError(VM_NONE, VCORE_NONE, "Cannot allocate\n"); + return NULL; + } + memset(ctx, 0, sizeof(struct file_ctx)); ctx->filename = V3_Malloc(strlen(url) + strlen(name) + 5); + + if (!ctx->filename) { + PrintError(VM_NONE, VCORE_NONE, "Cannot allocate\n"); + V3_Free(ctx); + return NULL; + } + + memset(ctx->filename, 0, strlen(url) + strlen(name) + 5); snprintf(ctx->filename, strlen(url) + strlen(name) + 5, "%s/%s", url, name);