Skip to content

Commit

Permalink
examples: print a message in case no pmem provided or able to be used
Browse files Browse the repository at this point in the history
  • Loading branch information
Pzbierski committed Aug 8, 2021
1 parent 100bed7 commit e3d85b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion examples/03-read-to-persistent/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ main(int argc, char *argv[])
#endif

/* if no pmem support or it is not provided */
if (mr_ptr == NULL) {
if (mr_ptr == NULL)
{
(void) fprintf(stderr, NO_PMEM_MSG);
mr_ptr = malloc_aligned(sizeof(struct hello_t));
if (mr_ptr == NULL)
return -1;
Expand Down
6 changes: 4 additions & 2 deletions examples/common/common-conn.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause */
/* Copyright 2020, Intel Corporation */
/* Copyright 2020-2021 , Intel Corporation */

/*
* common-conn.h -- a common connection functions declarations for examples
Expand All @@ -12,11 +12,13 @@
#include <librpma.h>

#ifdef USE_LIBPMEM

/* signature marking the persistent contents as valid */
#define SIGNATURE_STR "RPMA_EXAMPLE_SIG"
#define SIGNATURE_LEN (strlen(SIGNATURE_STR) + 1)

#define NO_PMEM_MSG "No <pmem-path> provided. Using DRAM instead.\n"
#else
#define NO_PMEM_MSG "The example is unable to use libpmem. If unintended please check the build log. Using DRAM instead.\n"
#endif

/*
Expand Down

0 comments on commit e3d85b1

Please sign in to comment.