Rename HD(f)printf() to (f)printf() (#3194)

This commit is contained in:
Dana Robinson
2023-06-28 08:31:32 -07:00
committed by GitHub
parent 7a44581a84
commit 187ea8a9ae
349 changed files with 18673 additions and 19008 deletions
+20 -20
View File
@@ -43,15 +43,15 @@ mirror_log(struct mirror_log_info *info, unsigned int level, const char *format,
}
else if (level <= verbosity) {
if (custom == true && info->prefix[0] != '\0') {
HDfprintf(stream, "%s", info->prefix);
fprintf(stream, "%s", info->prefix);
}
switch (level) {
case (V_ERR):
HDfprintf(stream, "ERROR ");
fprintf(stream, "ERROR ");
break;
case (V_WARN):
HDfprintf(stream, "WARNING ");
fprintf(stream, "WARNING ");
break;
default:
break;
@@ -64,7 +64,7 @@ mirror_log(struct mirror_log_info *info, unsigned int level, const char *format,
va_end(args);
}
HDfprintf(stream, "\n");
fprintf(stream, "\n");
HDfflush(stream);
} /* end if sufficiently verbose to print */
} /* end mirror_log() */
@@ -98,41 +98,41 @@ mirror_log_bytes(struct mirror_log_info *info, unsigned int level, size_t n_byte
/* print whole lines */
while ((n_bytes - bytes_written) >= 32) {
b = buf + bytes_written; /* point to region in buffer */
HDfprintf(stream,
"%04zX %02X%02X%02X%02X %02X%02X%02X%02X"
" %02X%02X%02X%02X %02X%02X%02X%02X"
" %02X%02X%02X%02X %02X%02X%02X%02X"
" %02X%02X%02X%02X %02X%02X%02X%02X\n",
bytes_written, b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7], b[8], b[9], b[10], b[11],
b[12], b[13], b[14], b[15], b[16], b[17], b[18], b[19], b[20], b[21], b[22], b[23],
b[24], b[25], b[26], b[27], b[28], b[29], b[30], b[31]);
fprintf(stream,
"%04zX %02X%02X%02X%02X %02X%02X%02X%02X"
" %02X%02X%02X%02X %02X%02X%02X%02X"
" %02X%02X%02X%02X %02X%02X%02X%02X"
" %02X%02X%02X%02X %02X%02X%02X%02X\n",
bytes_written, b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7], b[8], b[9], b[10], b[11],
b[12], b[13], b[14], b[15], b[16], b[17], b[18], b[19], b[20], b[21], b[22], b[23], b[24],
b[25], b[26], b[27], b[28], b[29], b[30], b[31]);
bytes_written += 32;
}
/* start partial line */
if (n_bytes > bytes_written) {
HDfprintf(stream, "%04zX ", bytes_written);
fprintf(stream, "%04zX ", bytes_written);
}
/* partial line blocks */
while ((n_bytes - bytes_written) >= 4) {
HDfprintf(stream, " %02X%02X%02X%02X", buf[bytes_written], buf[bytes_written + 1],
buf[bytes_written + 2], buf[bytes_written + 3]);
fprintf(stream, " %02X%02X%02X%02X", buf[bytes_written], buf[bytes_written + 1],
buf[bytes_written + 2], buf[bytes_written + 3]);
bytes_written += 4;
}
/* block separator before partial block */
if (n_bytes > bytes_written) {
HDfprintf(stream, " ");
fprintf(stream, " ");
}
/* partial block individual bytes */
while (n_bytes > bytes_written) {
HDfprintf(stream, "%02X", buf[bytes_written++]);
fprintf(stream, "%02X", buf[bytes_written++]);
}
/* end partial line */
HDfprintf(stream, "\n");
fprintf(stream, "\n");
} /* end if suitably verbose to log */
} /* end mirror_log_bytes() */
@@ -165,8 +165,8 @@ mirror_log_init(char *path, const char *prefix, unsigned int verbosity)
FILE *f = NULL;
f = HDfopen(path, "w");
if (NULL == f) {
HDfprintf(MIRROR_LOG_DEFAULT_STREAM, "WARN custom logging path could not be opened: %s\n",
path);
fprintf(MIRROR_LOG_DEFAULT_STREAM, "WARN custom logging path could not be opened: %s\n",
path);
info->magic += 1;
HDfree(info);
}
+19 -19
View File
@@ -139,22 +139,22 @@ struct server_run {
static void
usage(void)
{
HDfprintf(stdout,
"mirror_server [options]\n"
"\n"
"Application for providing Mirror Writer process to "
" Mirror VFD on file-open.\n"
"Listens on a dedicated socket; forks as a Writer upon receipt"
" of a valid OPEN xmit.\n"
"\n"
"Options:\n"
"--help [-h] : Print this help message and quit.\n"
"--logpath=PATH : File path for logging output "
"(default none, to stdout).\n"
"--port=PORT : Primary port (default %d).\n"
"--verbosity=NUM : Debug printing level "
"0..4, (default %d).\n",
DEFAULT_PORT, MIRROR_LOG_DEFAULT_VERBOSITY);
fprintf(stdout,
"mirror_server [options]\n"
"\n"
"Application for providing Mirror Writer process to "
" Mirror VFD on file-open.\n"
"Listens on a dedicated socket; forks as a Writer upon receipt"
" of a valid OPEN xmit.\n"
"\n"
"Options:\n"
"--help [-h] : Print this help message and quit.\n"
"--logpath=PATH : File path for logging output "
"(default none, to stdout).\n"
"--port=PORT : Primary port (default %d).\n"
"--verbosity=NUM : Debug printing level "
"0..4, (default %d).\n",
DEFAULT_PORT, MIRROR_LOG_DEFAULT_VERBOSITY);
} /* end usage() */
/* ---------------------------------------------------------------------------
@@ -562,10 +562,10 @@ handle_requests(struct server_run *run)
else if (pid == 0) { /* child process (writer side of fork) */
mirror_log(run->loginfo, V_INFO, "executing writer");
if (run_writer(connfd, xopen) < 0) {
HDprintf("can't run writer\n");
printf("can't run writer\n");
}
else {
HDprintf("writer OK\n");
printf("writer OK\n");
}
HDclose(connfd);
@@ -634,7 +634,7 @@ main(int argc, char **argv)
int
main(void)
{
HDprintf("Mirror VFD was not built -- cannot launch server.\n");
printf("Mirror VFD was not built -- cannot launch server.\n");
HDexit(EXIT_FAILURE);
}
+20 -20
View File
@@ -60,15 +60,15 @@ struct mshs_opts {
static void
usage(void)
{
HDprintf("mirror_server_stop [options]\n"
"System-independent Mirror Server shutdown program.\n"
"Sends shutdown message to Mirror Server at given IP:port\n"
"\n"
"Options:\n"
" -h | --help Print this usage message and exit.\n"
" --ip=ADDR IP Address of remote server (default %s)\n"
" --port=PORT Handshake port of remote server (default %d)\n",
MSHS_DEFAULT_IP, MSHS_DEFAULT_PORTNO);
printf("mirror_server_stop [options]\n"
"System-independent Mirror Server shutdown program.\n"
"Sends shutdown message to Mirror Server at given IP:port\n"
"\n"
"Options:\n"
" -h | --help Print this usage message and exit.\n"
" --ip=ADDR IP Address of remote server (default %s)\n"
" --port=PORT Handshake port of remote server (default %d)\n",
MSHS_DEFAULT_IP, MSHS_DEFAULT_PORTNO);
} /* end usage() */
/* ----------------------------------------------------------------------------
@@ -102,7 +102,7 @@ parse_args(int argc, char **argv, struct mshs_opts *opts)
opts->portno = HDatoi(argv[i] + 7);
}
else {
HDprintf("Unrecognized option: '%s'\n", argv[i]);
printf("Unrecognized option: '%s'\n", argv[i]);
usage();
opts->magic++; /* invalidate for sanity */
return -1;
@@ -133,13 +133,13 @@ send_shutdown(struct mshs_opts *opts)
struct sockaddr_in target_addr;
if (opts->magic != MSHS_OPTS_MAGIC) {
HDprintf("invalid options structure\n");
printf("invalid options structure\n");
return -1;
}
live_socket = socket(AF_INET, SOCK_STREAM, 0);
if (live_socket < 0) {
HDprintf("ERROR socket()\n");
printf("ERROR socket()\n");
return -1;
}
@@ -149,27 +149,27 @@ send_shutdown(struct mshs_opts *opts)
HDmemset(target_addr.sin_zero, 0, sizeof(target_addr.sin_zero));
if (connect(live_socket, (struct sockaddr *)&target_addr, (socklen_t)sizeof(target_addr)) < 0) {
HDprintf("ERROR connect() (%d)\n%s\n", errno, HDstrerror(errno));
printf("ERROR connect() (%d)\n%s\n", errno, HDstrerror(errno));
return -1;
}
if (HDwrite(live_socket, "SHUTDOWN", 9) == -1) {
HDprintf("ERROR write() (%d)\n%s\n", errno, HDstrerror(errno));
printf("ERROR write() (%d)\n%s\n", errno, HDstrerror(errno));
return -1;
}
/* Read & verify response from port connection. */
if (HDread(live_socket, &mybuf, sizeof(mybuf)) == -1) {
HDprintf("ERROR read() can't receive data\n");
printf("ERROR read() can't receive data\n");
return -1;
}
if (HDstrncmp("CLOSING", mybuf, 8)) {
HDprintf("ERROR read() didn't receive data from server\n");
printf("ERROR read() didn't receive data from server\n");
return -1;
}
if (HDclose(live_socket) < 0) {
HDprintf("ERROR close() can't close socket\n");
printf("ERROR close() can't close socket\n");
return -1;
}
@@ -183,7 +183,7 @@ main(int argc, char **argv)
struct mshs_opts opts;
if (parse_args(argc, argv, &opts) < 0) {
HDprintf("Unable to parse arguments\n");
printf("Unable to parse arguments\n");
HDexit(EXIT_FAILURE);
}
@@ -193,7 +193,7 @@ main(int argc, char **argv)
}
if (send_shutdown(&opts) < 0) {
HDprintf("Unable to send shutdown command\n");
printf("Unable to send shutdown command\n");
HDexit(EXIT_FAILURE);
}
@@ -206,7 +206,7 @@ main(int argc, char **argv)
int
main(void)
{
HDprintf("Mirror VFD not built -- unable to perform shutdown.\n");
printf("Mirror VFD not built -- unable to perform shutdown.\n");
HDexit(EXIT_FAILURE);
}
+28 -28
View File
@@ -120,7 +120,7 @@ create_default_separators(struct distribute_option *option, mfu_flist *flist, ui
double max_size_tmp;
const char *max_size_units;
mfu_format_bytes(*global_max_file_size, &max_size_tmp, &max_size_units);
HDprintf("Max File Size: %.3lf %s\n", max_size_tmp, max_size_units);
printf("Max File Size: %.3lf %s\n", max_size_tmp, max_size_units);
/* round next_pow_2 to next multiple of 10 */
uint64_t max_magnitude_bin = (uint64_t)((ceil(log2((double)(*global_max_file_size)) / 10)) * 10);
@@ -213,15 +213,15 @@ print_flist_distribution(int file_histogram, struct distribute_option *option, m
uint64_t number;
double size_tmp;
const char *size_units;
HDprintf("%-27s %s\n", "Range", "Number");
printf("%-27s %s\n", "Range", "Number");
for (size_t i = 0; i <= separators; i++) {
HDprintf("%s", "[ ");
printf("%s", "[ ");
if (i == 0) {
HDprintf("%7.3lf %3s", 0.000, "B");
printf("%7.3lf %3s", 0.000, "B");
}
else {
mfu_format_bytes((uint64_t)option->separators[i - 1], &size_tmp, &size_units);
HDprintf("%7.3lf %3s", size_tmp, size_units);
printf("%7.3lf %3s", size_tmp, size_units);
}
printf("%s", " - ");
@@ -230,17 +230,17 @@ print_flist_distribution(int file_histogram, struct distribute_option *option, m
mfu_format_bytes((uint64_t)option->separators[i], &size_tmp, &size_units);
number = disttotal[i];
mfu_format_bytes((uint64_t)option->separators[i], &size_tmp, &size_units);
HDprintf("%7.3lf %3s ) %" PRIu64 "\n", size_tmp, size_units, number);
printf("%7.3lf %3s ) %" PRIu64 "\n", size_tmp, size_units, number);
}
else {
if (i == separators) {
number = disttotal[i];
HDprintf("%10s ) %" PRIu64 "\n", "MAX", number);
printf("%10s ) %" PRIu64 "\n", "MAX", number);
}
else {
number = disttotal[i];
mfu_format_bytes((uint64_t)option->separators[i], &size_tmp, &size_units);
HDprintf("%7.3lf %3s ) %" PRIu64 "\n", size_tmp, size_units, number);
printf("%7.3lf %3s ) %" PRIu64 "\n", size_tmp, size_units, number);
}
}
}
@@ -268,7 +268,7 @@ distribute_separator_add(struct distribute_option *option, uint64_t separator)
count = option->separator_number;
option->separator_number++;
if (option->separator_number > MAX_DISTRIBUTE_SEPARATORS) {
HDprintf("Too many separators");
printf("Too many separators");
return -1;
}
@@ -340,13 +340,13 @@ distribution_parse(struct distribute_option *option, const char *string)
}
if (mfu_abtoull(ptr, &separator) != MFU_SUCCESS) {
HDprintf("Invalid separator \"%s\"\n", ptr);
printf("Invalid separator \"%s\"\n", ptr);
status = -1;
goto out;
}
if (distribute_separator_add(option, separator)) {
HDprintf("Duplicated separator \"%llu\"\n", separator);
printf("Duplicated separator \"%llu\"\n", separator);
status = -1;
goto out;
}
@@ -450,8 +450,8 @@ print_file(mfu_flist flist, uint64_t idx)
const char *size_units;
mfu_format_bytes(size, &size_tmp, &size_units);
HDprintf("%s %s %s %7.3f %3s %s %s\n", mode_format, username, groupname, size_tmp, size_units,
modify_s, file);
printf("%s %s %s %7.3f %3s %s %s\n", mode_format, username, groupname, size_tmp, size_units, modify_s,
file);
}
else {
/* get type */
@@ -467,7 +467,7 @@ print_file(mfu_flist flist, uint64_t idx)
type_str = type_str_link;
}
HDprintf("Type=%s File=%s\n", type_str, file);
printf("Type=%s File=%s\n", type_str, file);
}
}
@@ -521,8 +521,8 @@ print_file_text(mfu_flist flist, uint64_t idx, char *buffer, size_t bufsize)
const char *size_units;
mfu_format_bytes(size, &size_tmp, &size_units);
numbytes = (size_t)snHDprintf(buffer, bufsize, "%s %s %s %7.3f %3s %s %s\n", mode_format, username,
groupname, size_tmp, size_units, modify_s, file);
numbytes = (size_t)snprintf(buffer, bufsize, "%s %s %s %7.3f %3s %s %s\n", mode_format, username,
groupname, size_tmp, size_units, modify_s, file);
}
else {
/* get type */
@@ -538,7 +538,7 @@ print_file_text(mfu_flist flist, uint64_t idx, char *buffer, size_t bufsize)
type_str = type_str_link;
}
numbytes = (size_t)snHDprintf(buffer, bufsize, "Type=%s File=%s\n", type_str, file);
numbytes = (size_t)snprintf(buffer, bufsize, "Type=%s File=%s\n", type_str, file);
}
return numbytes;
@@ -606,7 +606,7 @@ dh5tool_flist_write_text(const char *name, mfu_flist bflist)
/* change number of ranks to string to pass to MPI_Info */
char str_buf[12];
HDprintf(str_buf, "%d", ranks);
printf(str_buf, "%d", ranks);
/* no. of I/O devices for lustre striping is number of ranks */
MPI_Info_set(info, "striping_factor", str_buf);
@@ -924,7 +924,7 @@ run_command(int argc __attribute__((unused)), char **argv, char *cmdline, const
int use_stdout = 0;
#ifdef H5_HAVE_WINDOWS
HDprintf("ERROR: %s %s: Unable to support fork/exec on WINDOWS\n", PROGRAMNAME, __func__);
printf("ERROR: %s %s: Unable to support fork/exec on WINDOWS\n", PROGRAMNAME, __func__);
h5dwalk_exit(EXIT_FAILURE);
#else
@@ -943,7 +943,7 @@ run_command(int argc __attribute__((unused)), char **argv, char *cmdline, const
buf_cache = bufs;
#ifdef VERBOSE
if (buft_count == 0) {
HDprintf("[%d] Initial buf_cache allocation: buft_count=%d\n", sg_mpi_rank, buft_count);
printf("[%d] Initial buf_cache allocation: buft_count=%d\n", sg_mpi_rank, buft_count);
}
#endif
bufs[buft_count++] = thisbuft = (buf_t *)MFU_CALLOC(1, sizeof(buf_t));
@@ -1006,7 +1006,7 @@ run_command(int argc __attribute__((unused)), char **argv, char *cmdline, const
/* Create a new read buffer */
#ifdef VERBOSE
HDprintf("[%d] Allocate-1 a new read buffer:: buft_count=%d\n", sg_mpi_rank, buft_count);
printf("[%d] Allocate-1 a new read buffer:: buft_count=%d\n", sg_mpi_rank, buft_count);
#endif
bufs[buft_count++] = thisbuft = (buf_t *)MFU_CALLOC(1, sizeof(buf_t));
assert(thisbuft != NULL);
@@ -1033,8 +1033,8 @@ run_command(int argc __attribute__((unused)), char **argv, char *cmdline, const
thisbuft->count = 0;
thisbuft->chars += read_bytes;
#ifdef VERBOSE
HDprintf("[%d] Allocate-2 a new read buffer:: buft_count=%d\n", sg_mpi_rank,
buft_count);
printf("[%d] Allocate-2 a new read buffer:: buft_count=%d\n", sg_mpi_rank,
buft_count);
#endif
bufs[buft_count++] = thisbuft = (buf_t *)MFU_CALLOC(1, sizeof(buf_t));
assert(thisbuft != NULL);
@@ -1109,7 +1109,7 @@ run_command(int argc __attribute__((unused)), char **argv, char *cmdline, const
HDstrcpy(&logErrors[log_len - 3], "err");
}
if (mfu_debug_level == MFU_LOG_VERBOSE) {
HDprintf("\tCreating logfile: %s\n", logpath);
printf("\tCreating logfile: %s\n", logpath);
fflush(stdout);
}
pid = fork();
@@ -1191,8 +1191,8 @@ MFU_PRED_EXEC(mfu_flist flist, uint64_t idx, void *arg)
buf += sizeof(mfu_flist *) + 2;
fname_arg = mfu_flist_file_get_name(flist_arg, idx);
if (fname_arg == NULL) {
HDprintf("[%d] Warning: Unable to resolve file_substitution %d (idx=%ld)\n", sg_mpi_rank,
file_substituted, idx);
printf("[%d] Warning: Unable to resolve file_substitution %d (idx=%ld)\n", sg_mpi_rank,
file_substituted, idx);
argv[k] = HDstrdup(fname);
}
else {
@@ -1224,7 +1224,7 @@ int
MFU_PRED_PRINT(mfu_flist flist, uint64_t idx, void *arg __attribute__((unused)))
{
const char *name = mfu_flist_file_get_name(flist, idx);
HDprintf("%s\n", name);
printf("%s\n", name);
return 1;
}
@@ -1517,7 +1517,7 @@ main(int argc, char *argv[])
}
}
if (count1 != count2) {
HDprintf("config files have different file counts: (1) %d and (2) %d\n", count1, count2);
printf("config files have different file counts: (1) %d and (2) %d\n", count1, count2);
}
}
else if (numpaths > 0) {