Skip to content

Commit

Permalink
shell: output: rename struct members to avoid reserved word
Browse files Browse the repository at this point in the history
  • Loading branch information
grondo committed Jan 5, 2025
1 parent 2e0575f commit 6462018
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 30 deletions.
14 changes: 7 additions & 7 deletions src/shell/output/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,17 @@ struct output_config *output_config_create (flux_shell_t *shell)
if (!(conf = calloc (1, sizeof (*conf))))
return NULL;

conf->stdout.type = FLUX_OUTPUT_TYPE_KVS;
conf->stdout.mode = "truncate";
conf->stdout.buffer_type = "line";
if (output_stream_getopts (shell, "stdout", &conf->stdout) < 0)
conf->out.type = FLUX_OUTPUT_TYPE_KVS;
conf->out.mode = "truncate";
conf->out.buffer_type = "line";
if (output_stream_getopts (shell, "stdout", &conf->out) < 0)
goto error;

/* stderr defaults except for buffer_type inherit from stdout:
*/
conf->stderr = conf->stdout;
conf->stderr.buffer_type = "none";
if (output_stream_getopts (shell, "stderr", &conf->stderr) < 0)
conf->err = conf->out;
conf->err.buffer_type = "none";
if (output_stream_getopts (shell, "stderr", &conf->err) < 0)
goto error;

return conf;
Expand Down
4 changes: 2 additions & 2 deletions src/shell/output/conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ struct output_stream {
};

struct output_config {
struct output_stream stdout;
struct output_stream stderr;
struct output_stream out;
struct output_stream err;
};

struct output_config *output_config_create (flux_shell_t *shell);
Expand Down
2 changes: 1 addition & 1 deletion src/shell/output/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static int log_output (flux_plugin_t *p,

void shell_output_log_init (flux_plugin_t *p, struct shell_output *out)
{
if (out->conf->stderr.type == FLUX_OUTPUT_TYPE_FILE) {
if (out->conf->err.type == FLUX_OUTPUT_TYPE_FILE) {
if (flux_plugin_add_handler (p, "shell.log", log_output, out) < 0)
shell_log_errno ("failed to add shell.log handler");
flux_shell_log_setlevel (FLUX_SHELL_QUIET, "eventlog");
Expand Down
4 changes: 2 additions & 2 deletions src/shell/output/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ static int output_redirect_stream (struct shell_output *out,

static int shell_output_redirect (struct shell_output *out)
{
if (output_redirect_stream (out, "stdout", &out->conf->stdout) < 0
|| output_redirect_stream (out, "stderr", &out->conf->stderr) < 0)
if (output_redirect_stream (out, "stdout", &out->conf->out) < 0
|| output_redirect_stream (out, "stderr", &out->conf->err) < 0)
return -1;
return 0;
}
Expand Down
36 changes: 18 additions & 18 deletions src/shell/output/task.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ struct task_output {
flux_shell_task_t *task;
int rank;
char rank_str[13];
struct file_entry *stdout;
struct file_entry *stderr;
struct file_entry *stdout_fp;
struct file_entry *stderr_fp;
task_output_f stdout_f;
task_output_f stderr_f;
};
Expand All @@ -67,8 +67,8 @@ void task_output_destroy (struct task_output *to)
{
if (to) {
int saved_errno = errno;
file_entry_close (to->stdout);
file_entry_close (to->stderr);
file_entry_close (to->stdout_fp);
file_entry_close (to->stderr_fp);
free (to);
errno = saved_errno;
}
Expand Down Expand Up @@ -156,9 +156,9 @@ static int task_output_write_file (struct task_output *to,
int len,
bool eof)
{
struct file_entry *fp = to->stderr;
struct file_entry *fp = to->stderr_fp;
if (streq (stream, "stdout"))
fp = to->stdout;
fp = to->stdout_fp;
if (file_entry_write (fp, to->rank_str, data, len) < 0)
return -1;
return 0;
Expand Down Expand Up @@ -189,16 +189,16 @@ static struct task_output *task_output_create (struct shell_output *out,
/* rank 0: if stdout/err are files then task writes to file,
* otherwise KVS.
*/
if (out->conf->stdout.type == FLUX_OUTPUT_TYPE_FILE) {
if (!(to->stdout = task_open_file (out, task, &out->conf->stdout)))
if (out->conf->out.type == FLUX_OUTPUT_TYPE_FILE) {
if (!(to->stdout_fp = task_open_file (out, task, &out->conf->out)))
goto error;
to->stdout_f = task_output_write_file;
}
else
to->stdout_f = task_output_write_kvs;

if (out->conf->stderr.type == FLUX_OUTPUT_TYPE_FILE) {
if (!(to->stderr = task_open_file (out, task, &out->conf->stderr)))
if (out->conf->err.type == FLUX_OUTPUT_TYPE_FILE) {
if (!(to->stderr_fp = task_open_file (out, task, &out->conf->err)))
goto error;
to->stderr_f = task_output_write_file;
}
Expand All @@ -208,16 +208,16 @@ static struct task_output *task_output_create (struct shell_output *out,
else {
/* Other shell ranks: client writer unless per-shell output
*/
if (out->conf->stdout.per_shell) {
if (!(to->stdout = task_open_file (out, task, &out->conf->stdout)))
if (out->conf->out.per_shell) {
if (!(to->stdout_fp = task_open_file (out, task, &out->conf->out)))
goto error;
to->stdout_f = task_output_write_file;
}
else
to->stdout_f = task_output_write_client;

if (out->conf->stderr.per_shell) {
if (!(to->stderr = task_open_file (out, task, &out->conf->stderr)))
if (out->conf->err.per_shell) {
if (!(to->stderr_fp = task_open_file (out, task, &out->conf->err)))
goto error;
to->stderr_f = task_output_write_file;
}
Expand Down Expand Up @@ -366,8 +366,8 @@ struct task_output_list *task_output_list_create (struct shell_output *out)
* and add task output object to task outputs list
*/
if (!(to = task_output_create (out, task))
|| task_output_setup_stream (to, "stdout", &out->conf->stdout) < 0
|| task_output_setup_stream (to, "stderr", &out->conf->stderr) < 0
|| task_output_setup_stream (to, "stdout", &out->conf->out) < 0
|| task_output_setup_stream (to, "stderr", &out->conf->err) < 0
|| !zlistx_add_end (l->task_outputs, to))
goto error;
task = flux_shell_task_next (out->shell);
Expand All @@ -388,9 +388,9 @@ struct file_entry *task_output_file_entry (struct task_output_list *l,
to = zlistx_first (l->task_outputs);
while (to) {
if (n == index) {
struct file_entry *fp = to->stderr;
struct file_entry *fp = to->stderr_fp;
if (streq (stream, "stdout"))
fp = to->stdout;
fp = to->stdout_fp;
return filehash_entry_incref (fp);
}
to = zlistx_next (l->task_outputs);
Expand Down

0 comments on commit 6462018

Please sign in to comment.