summaryrefslogtreecommitdiffstats
path: root/utils/mirror_vfd
diff options
context:
space:
mode:
authorJacob Smith <jake.smith@hdfgroup.org>2020-04-07 15:16:48 (GMT)
committerJacob Smith <jake.smith@hdfgroup.org>2020-04-07 15:20:44 (GMT)
commitd97c00013dd5b13b618d08d9b6d6517176674a4e (patch)
treec972bbe7858f771f2c17b93f93db8f17b528f1ee /utils/mirror_vfd
parentf771958d757e388d9b9cebb21ca03f00505ada5b (diff)
downloadhdf5-d97c00013dd5b13b618d08d9b6d6517176674a4e.zip
hdf5-d97c00013dd5b13b618d08d9b6d6517176674a4e.tar.gz
hdf5-d97c00013dd5b13b618d08d9b6d6517176674a4e.tar.bz2
Tidying of Mirror VFD.
* Rename server-stop utility to mirror_server_stop. * Remove external dependency on bzero(). * Modify test/use_common to use only the public API. * Rename internal bitswap macro to follow convention.
Diffstat (limited to 'utils/mirror_vfd')
-rw-r--r--utils/mirror_vfd/CMakeLists.txt22
-rw-r--r--utils/mirror_vfd/Makefile.am2
-rw-r--r--utils/mirror_vfd/mirror_server.c25
-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.c29
5 files changed, 61 insertions, 17 deletions
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 */