diff options
-rw-r--r-- | MANIFEST | 2 | ||||
-rw-r--r-- | src/H5FDmirror.c | 20 | ||||
-rw-r--r-- | src/H5private.h | 3 | ||||
-rw-r--r-- | test/mirror_vfd.c | 73 | ||||
-rw-r--r-- | test/test_mirror.sh.in | 2 | ||||
-rw-r--r-- | test/use_common.c | 6 | ||||
-rw-r--r-- | utils/mirror_vfd/CMakeLists.txt | 22 | ||||
-rw-r--r-- | utils/mirror_vfd/Makefile.am | 2 | ||||
-rw-r--r-- | utils/mirror_vfd/mirror_server.c | 25 | ||||
-rw-r--r-- | utils/mirror_vfd/mirror_server_stop.c (renamed from utils/mirror_vfd/mirror_server_halten_sie.c) | 0 | ||||
-rw-r--r-- | utils/mirror_vfd/mirror_writer.c | 29 |
11 files changed, 128 insertions, 56 deletions
@@ -2788,7 +2788,7 @@ ./utils/mirror_vfd/mirror_remote.c ./utils/mirror_vfd/mirror_remote.h ./utils/mirror_vfd/mirror_server.c -./utils/mirror_vfd/mirror_server_halten_sie.c +./utils/mirror_vfd/mirror_server_stop.c ./utils/mirror_vfd/mirror_writer.c # high level libraries diff --git a/src/H5FDmirror.c b/src/H5FDmirror.c index ea1f516..bcbac08 100644 --- a/src/H5FDmirror.c +++ b/src/H5FDmirror.c @@ -62,7 +62,8 @@ typedef struct H5FD_mirror_t { #define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) #define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR)) -#define _BSWAP_64(X) \ +#ifndef BSWAP_64 +#define BSWAP_64(X) \ (uint64_t)( (((X) & 0x00000000000000FF) << 56) \ | (((X) & 0x000000000000FF00) << 40) \ | (((X) & 0x0000000000FF0000) << 24) \ @@ -71,6 +72,7 @@ typedef struct H5FD_mirror_t { | (((X) & 0x0000FF0000000000) >> 24) \ | (((X) & 0x00FF000000000000) >> 40) \ | (((X) & 0xFF00000000000000) >> 56)) +#endif /* BSWAP_64 */ /* Debugging flabs for verbose tracing -- nonzero to enable */ #define MIRROR_DEBUG_OP_CALLS 0 @@ -387,7 +389,7 @@ H5FD__mirror_xmit_decode_uint64(uint64_t *out, const unsigned char *_buf) HDassert(_buf && out); HDmemcpy(&n, _buf, sizeof(n)); if (TRUE == is_host_little_endian()) { - *out = _BSWAP_64(n); + *out = BSWAP_64(n); } else { *out = n; @@ -484,7 +486,7 @@ H5FD__mirror_xmit_encode_uint64(unsigned char *_dest, uint64_t v) LOG_OP_CALL("H5FD__mirror_xmit_decode_uint64"); HDassert(_dest); if (TRUE == is_host_little_endian()) { - n = _BSWAP_64(v); + n = BSWAP_64(v); } HDmemcpy(_dest, &n, sizeof(n)); return 8; @@ -813,7 +815,11 @@ H5FD_mirror_xmit_encode_open(unsigned char *dest, size_t n_writ = 0; LOG_OP_CALL("H5FD_mirror_xmit_encode_open"); HDassert(dest && x); - HDbzero(dest, H5FD_MIRROR_XMIT_OPEN_SIZE); + /* clear entire structure, but especially its filepath string area */ + for (n_writ = 0; n_writ < H5FD_MIRROR_XMIT_OPEN_SIZE; n_writ++) { + *(dest+n_writ) = 0; + } + n_writ = 0; n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub)); n_writ += H5FD__mirror_xmit_encode_uint32(&dest[n_writ], x->flags); @@ -849,7 +855,11 @@ H5FD_mirror_xmit_encode_reply(unsigned char *dest, size_t n_writ = 0; LOG_OP_CALL("H5FD_mirror_xmit_encode_reply"); HDassert(dest && x); - HDbzero(dest, H5FD_MIRROR_XMIT_REPLY_SIZE); + /* clear entire structure, but especially its message string area */ + for (n_writ = 0; n_writ < H5FD_MIRROR_XMIT_REPLY_SIZE; n_writ++) { + *(dest+n_writ) = 0; + } + n_writ = 0; n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub)); n_writ += H5FD__mirror_xmit_encode_uint32(&dest[n_writ], x->status); diff --git a/src/H5private.h b/src/H5private.h index f7fb40b..95d4885 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -717,9 +717,6 @@ typedef struct { #ifndef HDbsearch #define HDbsearch(K,B,N,Z,F) bsearch(K,B,N,Z,F) #endif /* HDbsearch */ -#ifndef HDbzero - #define HDbzero(A,B) bzero((A),(B)) /* mirror VFD */ -#endif /* HDbzero */ #ifndef HDcalloc #define HDcalloc(N,Z) calloc(N,Z) #endif /* HDcalloc */ diff --git a/test/mirror_vfd.c b/test/mirror_vfd.c index 00902dd..112d67a 100644 --- a/test/mirror_vfd.c +++ b/test/mirror_vfd.c @@ -101,6 +101,31 @@ static herr_t _populate_filepath(const char *dirname, const char *_basename, static hid_t create_mirroring_split_fapl(const char *_basename, struct mirrortest_filenames *names); +static void mybzero(void *dest, size_t size); + + +/* ---------------------------------------------------------------------------- + * Function: mybzero + * + * Purpose: Have bzero simplicity and abstraction in (possible) absence of + * it being available. + * + * Programmer: Jacob Smith + * 2020-03-30 + * ---------------------------------------------------------------------------- + */ +static void +mybzero(void *dest, size_t size) +{ + size_t i = 0; + char *s = NULL; + HDassert(dest != NULL); + s = (char *)dest; + for (i = 0; i < size; i++) { + *(s+i) = 0; + } +} /* end mybzero() */ + /* ---------------------------------------------------------------------------- * Function: _populate_filepath @@ -349,8 +374,8 @@ test_xmit_encode_decode(void) /* Start of buffer uint8_t */ - HDbzero(buf, 8); - HDbzero(expected, 8); + mybzero(buf, 8); + mybzero(expected, 8); expected[0] = 200; out = 0; if (H5FD__mirror_xmit_encode_uint8(buf, v) != 1) { @@ -369,8 +394,8 @@ test_xmit_encode_decode(void) /* Middle of buffer uint8_t */ - HDbzero(buf, 8); - HDbzero(expected, 8); + mybzero(buf, 8); + mybzero(expected, 8); expected[3] = v; out = 0; if (H5FD__mirror_xmit_encode_uint8((buf+3), v) != 1) { @@ -389,8 +414,8 @@ test_xmit_encode_decode(void) /* End of buffer uint8_t */ - HDbzero(buf, 8); - HDbzero(expected, 8); + mybzero(buf, 8); + mybzero(expected, 8); expected[7] = v; out = 0; if (H5FD__mirror_xmit_encode_uint8((buf+7), v) != 1) { @@ -419,8 +444,8 @@ test_xmit_encode_decode(void) /* Start of buffer uint16_t */ - HDbzero(buf, 8); - HDbzero(expected, 8); + mybzero(buf, 8); + mybzero(expected, 8); expected[0] = 0x8F; expected[1] = 0x02; out = 0; @@ -440,8 +465,8 @@ test_xmit_encode_decode(void) /* Middle of buffer uint16_t */ - HDbzero(buf, 8); - HDbzero(expected, 8); + mybzero(buf, 8); + mybzero(expected, 8); expected[3] = 0x8F; expected[4] = 0x02; out = 0; @@ -468,8 +493,8 @@ test_xmit_encode_decode(void) /* End of buffer uint16_t */ - HDbzero(buf, 8); - HDbzero(expected, 8); + mybzero(buf, 8); + mybzero(expected, 8); expected[6] = 0x8F; expected[7] = 0x02; out = 0; @@ -499,8 +524,8 @@ test_xmit_encode_decode(void) /* Start of buffer uint32_t */ - HDbzero(buf, 8); - HDbzero(expected, 8); + mybzero(buf, 8); + mybzero(expected, 8); expected[0] = 0x8F; expected[1] = 0x02; expected[2] = 0x00; @@ -522,8 +547,8 @@ test_xmit_encode_decode(void) /* Middle of buffer uint32_t */ - HDbzero(buf, 8); - HDbzero(expected, 8); + mybzero(buf, 8); + mybzero(expected, 8); expected[3] = 0x8F; expected[4] = 0x02; expected[5] = 0x00; @@ -552,8 +577,8 @@ test_xmit_encode_decode(void) /* End of buffer uint32_t */ - HDbzero(buf, 8); - HDbzero(expected, 8); + mybzero(buf, 8); + mybzero(expected, 8); expected[4] = 0x8F; expected[5] = 0x02; expected[6] = 0x00; @@ -585,8 +610,8 @@ test_xmit_encode_decode(void) /* Start of buffer uint64_t */ - HDbzero(buf, 16); - HDbzero(expected, 16); + mybzero(buf, 16); + mybzero(expected, 16); expected[0] = 0x90; expected[1] = 0xDC; expected[2] = 0xBE; @@ -612,8 +637,8 @@ test_xmit_encode_decode(void) /* Middle of buffer uint64_t */ - HDbzero(buf, 16); - HDbzero(expected, 16); + mybzero(buf, 16); + mybzero(expected, 16); expected[3] = 0x90; expected[4] = 0xDC; expected[5] = 0xBE; @@ -646,8 +671,8 @@ test_xmit_encode_decode(void) /* End of buffer uint64_t */ - HDbzero(buf, 16); - HDbzero(expected, 16); + mybzero(buf, 16); + mybzero(expected, 16); expected[8] = 0x90; expected[9] = 0xDC; expected[10] = 0xBE; diff --git a/test/test_mirror.sh.in b/test/test_mirror.sh.in index 3fdc673..9635c38 100644 --- a/test/test_mirror.sh.in +++ b/test/test_mirror.sh.in @@ -81,7 +81,7 @@ SERVER_ARGS="$SERVER_PORT $SERVER_VERBOSITY" nerrors=$? echo "Stopping Mirror Server" -./mirror_server_halten_sie $SERVER_PORT +./mirror_server_stop $SERVER_PORT ############################################################################### ## Report and exit diff --git a/test/use_common.c b/test/use_common.c index a986543..bf29936 100644 --- a/test/use_common.c +++ b/test/use_common.c @@ -21,10 +21,6 @@ #include "use.h" -#define H5D_FRIEND /*suppress error about including H5Dpkg */ -#define H5D_TESTING -#include "H5Dpkg.h" /* TODO : used to verify chunk index type (yes?) -- is there a way to do this sanity-check using the public API instead? */ - /* ---------------------------------------------------------------------------- * Print a common/shared usage message. * Receives program name to show default test file name (<program_name>.h5). @@ -231,7 +227,7 @@ create_uc_file(options_t * opts) /* Check that the chunk index type is not version 1 B-tree. * Version 1 B-trees are not supported under SWMR. */ - if (H5D__layout_idx_type_test(dsid, &idx_type) < 0) + if (H5Dget_chunk_index_type(dsid, &idx_type) < 0) return -1; if (idx_type == H5D_CHUNK_IDX_BTREE) { HDfprintf(stderr, "ERROR: Chunk index is version 1 B-tree: aborting.\n"); diff --git a/utils/mirror_vfd/CMakeLists.txt b/utils/mirror_vfd/CMakeLists.txt index 405c420..1926352 100644 --- a/utils/mirror_vfd/CMakeLists.txt +++ b/utils/mirror_vfd/CMakeLists.txt @@ -23,22 +23,22 @@ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};mirror_server set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} mirror_server) #----------------------------------------------------------------------------- -# Add the mirror_server_halten_sie executable +# Add the mirror_server_stop executable #----------------------------------------------------------------------------- -set (mirror_server_halt_SOURCES ${HDF5_UTILS_MIRRORVFD_SOURCE_DIR}/mirror_server_halten_sie.c) -add_executable (mirror_server_halt ${mirror_server_halt_SOURCES}) -target_include_directories (mirror_server_halt PRIVATE "${HDF5_UITLS_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +set (mirror_server_stop_SOURCES ${HDF5_UTILS_MIRRORVFD_SOURCE_DIR}/mirror_server_stop.c) +add_executable (mirror_server_stop ${mirror_server_stop_SOURCES}) +target_include_directories (mirror_server_stop PRIVATE "${HDF5_UITLS_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) - TARGET_C_PROPERTIES (mirror_server_halt STATIC) - target_link_libraries (mirror_server_halt PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + TARGET_C_PROPERTIES (mirror_server_stop STATIC) + target_link_libraries (mirror_server_stop PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) else () - TARGET_C_PROPERTIES (mirror_server_halt SHARED) - target_link_libraries (mirror_server_halt PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + TARGET_C_PROPERTIES (mirror_server_stop SHARED) + target_link_libraries (mirror_server_stop PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) endif () -set_target_properties (mirror_server_halt PROPERTIES FOLDER utils) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};mirror_server_halt") -set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} mirror_server_halt) +set_target_properties (mirror_server_stop PROPERTIES FOLDER utils) +set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};mirror_server_stop") +set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} mirror_server_stop) ############################################################################## ############################################################################## diff --git a/utils/mirror_vfd/Makefile.am b/utils/mirror_vfd/Makefile.am index 448e4cd..96d3104 100644 --- a/utils/mirror_vfd/Makefile.am +++ b/utils/mirror_vfd/Makefile.am @@ -19,7 +19,7 @@ include $(top_srcdir)/config/commence.am AM_CPPFLAGS+=-I$(top_srcdir)/src -bin_PROGRAMS = mirror_server mirror_server_halten_sie +bin_PROGRAMS = mirror_server mirror_server_stop mirror_server_SOURCES = mirror_server.c mirror_writer.c mirror_remote.c #mirror_writer_SOURCES = mirror_writer.c mirror_remote.c diff --git a/utils/mirror_vfd/mirror_server.c b/utils/mirror_vfd/mirror_server.c index 314f067..2583e60 100644 --- a/utils/mirror_vfd/mirror_server.c +++ b/utils/mirror_vfd/mirror_server.c @@ -137,6 +137,27 @@ struct server_run { /* --------------------------------------------------------------------------- + * Function: mybzero + * + * Purpose: Introduce bzero without neededing it on the system. + * + * Programmer: Jacob Smith + * 2020-03-30 + * --------------------------------------------------------------------------- + */ +static void mybzero(void *dest, size_t size) +{ + size_t i = 0; + char *s = NULL; + HDassert(dest); + s = (char *)dest; + for (i = 0; i < size; i++) { + *(s+i) = 0; + } +} /* end mybzero() */ + + +/* --------------------------------------------------------------------------- * Function: usage * * Purpose: Print the usage message to stdout. @@ -187,8 +208,8 @@ parse_args(int argc, char **argv, struct op_args *args_out) args_out->log_prepend_type = 1; args_out->verbosity = MIRROR_LOG_DEFAULT_VERBOSITY; /* preset empty strings */ - HDbzero(args_out->log_path, PATH_MAX+1); - HDbzero(args_out->writer_log_path, PATH_MAX+1); + mybzero(args_out->log_path, PATH_MAX+1); + mybzero(args_out->writer_log_path, PATH_MAX+1); if (argv == NULL || *argv == NULL) { mirror_log(NULL, V_ERR, "invalid argv pointer"); diff --git a/utils/mirror_vfd/mirror_server_halten_sie.c b/utils/mirror_vfd/mirror_server_stop.c index ccd5824..ccd5824 100644 --- a/utils/mirror_vfd/mirror_server_halten_sie.c +++ b/utils/mirror_vfd/mirror_server_stop.c diff --git a/utils/mirror_vfd/mirror_writer.c b/utils/mirror_vfd/mirror_writer.c index fe5dac7..e1ab1b2 100644 --- a/utils/mirror_vfd/mirror_writer.c +++ b/utils/mirror_vfd/mirror_writer.c @@ -157,11 +157,34 @@ struct mirror_writer_opts { char *logpath; }; +static void mybzero(void *dest, size_t size); + static int do_open(struct mirror_session *session, const H5FD_mirror_xmit_open_t *xmit_open); /* --------------------------------------------------------------------------- + * Function: mybzero + * + * Purpose: Introduce bzero without neededing it on the system. + * + * Programmer: Jacob Smith + * 2020-03-30 + * --------------------------------------------------------------------------- + */ +static void mybzero(void *dest, size_t size) +{ + size_t i = 0; + char *s = NULL; + HDassert(dest); + s = (char *)dest; + for (i = 0; i < size; i++) { + *(s+i) = 0; + } +} /* end mybzero() */ + + +/* --------------------------------------------------------------------------- * Function: session_init * * Purpose: Populate mirror_session structure with default and @@ -199,7 +222,7 @@ session_init(struct mirror_writer_opts *opts) session->reply.pub.version = H5FD_MIRROR_XMIT_CURR_VERSION; session->reply.pub.op = H5FD_MIRROR_OP_REPLY; session->reply.pub.session_token = 0; - HDbzero(session->reply.message, H5FD_MIRROR_STATUS_MESSAGE_MAX); + mybzero(session->reply.message, H5FD_MIRROR_STATUS_MESSAGE_MAX); /* Options-derived population */ @@ -381,7 +404,7 @@ reply_ok(struct mirror_session *session) mirror_log(session->loginfo, V_ALL, "reply_ok()"); reply->status = H5FD_MIRROR_STATUS_OK; - HDbzero(reply->message, H5FD_MIRROR_STATUS_MESSAGE_MAX); + mybzero(reply->message, H5FD_MIRROR_STATUS_MESSAGE_MAX); return _xmit_reply(session); } /* end reply_ok() */ @@ -876,7 +899,7 @@ receive_communique( mirror_log(session->loginfo, V_INFO, "receive_communique()"); - HDbzero(comm->raw, comm->raw_size); + mybzero(comm->raw, comm->raw_size); comm->recd_die = 0; mirror_log(session->loginfo, V_INFO, "ready to receive"); /* TODO */ |