Commit 269c5ab0 authored by Matthieu Dorier's avatar Matthieu Dorier

Merge branch 'master' of xgitlab.cels.anl.gov:sds/bake

parents e671cc2a 9b72b5a8
......@@ -47,6 +47,16 @@ typedef struct {
*/
void bake_perror(char *s, int ret);
/**
* Convert region id into printable string for debugging purposes
*
* @param[in] str string to fill in
* @param[in] size length of string, not including terminator. If rid
* string is longer than this it will be truncated.
* @param[in] rid region_id
*/
void bake_print_dbg_region_id_t(char *str, size_t size, bake_region_id_t rid);
#ifdef __cplusplus
}
#endif
......
......@@ -36,6 +36,7 @@ int main(int argc, char **argv)
char* local_region;
int region_fd;
uint64_t size;
char region_str[128];
if(argc != 6)
{
......@@ -111,6 +112,9 @@ int main(int argc, char **argv)
}
close(region_fd);
bake_print_dbg_region_id_t(region_str, 127, rid);
printf("# will read bake region %s\n", region_str);
#ifdef USE_SIZECHECK_HEADERS
uint64_t check_size;
ret = bake_get_size(bph, rid, &check_size);
......
......@@ -38,6 +38,7 @@ int main(int argc, char **argv)
char* local_region;
int region_fd;
char region_file[128];
char region_str[128];
#ifdef USE_SIZECHECK_HEADERS
uint64_t check_size;
#endif
......@@ -162,6 +163,9 @@ int main(int argc, char **argv)
return(-1);
}
bake_print_dbg_region_id_t(region_str, 127, rid);
printf("# created bake region %s\n", region_str);
/* transfer data */
ret = bake_write(
bph,
......
......@@ -7,6 +7,8 @@
#include "bake-config.h"
#include "bake.h"
#include <stdio.h>
#include <inttypes.h>
#include <libpmemobj.h>
static char * bake_err_str(int ret)
{
......@@ -64,3 +66,14 @@ void bake_perror(char *s, int err)
fprintf(stderr, "%s\n", error_string);
}
void bake_print_dbg_region_id_t(char *str, size_t size, bake_region_id_t rid)
{
PMEMoid *oid;
/* NOTE: this is fragile. Would break if pmemobj format changes. */
oid = (PMEMoid *)rid.data;
snprintf(str, size, "%u:%" PRIu64 ":%" PRIu64, rid.type, oid->pool_uuid_lo, oid->off);
return;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment