Added "--discard" option.

This commit is contained in:
Andrew Wood
2023-08-28 21:05:45 +01:00
parent 2cd74c7ff7
commit 9e5bdeb3a4
12 changed files with 45 additions and 12 deletions
+3
View File
@@ -377,6 +377,9 @@ void display_help(void)
{ "-K", "--direct-io", NULL,
N_("use direct I/O to bypass cache"),
{ 0, 0, 0, 0} },
{ "-X", "--discard", NULL,
N_("discard input instead of writing to output"),
{ 0, 0, 0, 0} },
#ifdef HAVE_IPC
{ "-R", "--remote", N_("PID"),
N_("update settings of process PID"),
+1
View File
@@ -273,6 +273,7 @@ int main(int argc, char **argv)
pv_state_stop_at_size_set(state, opts->stop_at_size);
pv_state_sync_after_write_set(state, opts->sync_after_write);
pv_state_direct_io_set(state, opts->direct_io);
pv_state_discard_input_set(state, opts->discard_input);
pv_state_rate_limit_set(state, opts->rate_limit);
pv_state_target_buffer_size_set(state, opts->buffer_size);
pv_state_no_splice_set(state, opts->no_splice);
+6 -1
View File
@@ -172,6 +172,7 @@ opts_t opts_parse(unsigned int argc, char **argv)
{ "stop-at-size", 0, NULL, (int) 'S' },
{ "sync", 0, NULL, (int) 'Y' },
{ "direct-io", 0, NULL, (int) 'K' },
{ "discard", 0, NULL, (int) 'X' },
{ "remote", 1, NULL, (int) 'R' },
{ "pidfile", 1, NULL, (int) 'P' },
{ "watchfd", 1, NULL, (int) 'd' },
@@ -184,7 +185,7 @@ opts_t opts_parse(unsigned int argc, char **argv)
/*@+nullassign@ */
int option_index = 0;
#endif /* HAVE_GETOPT_LONG */
char *short_options = "hVpteIrab8TA:fnqcWD:s:l0i:w:H:N:F:L:B:CESYKR:P:d:m:"
char *short_options = "hVpteIrab8TA:fnqcWD:s:l0i:w:H:N:F:L:B:CESYKXR:P:d:m:"
#ifdef ENABLE_DEBUGGING
"!:"
#endif
@@ -464,6 +465,10 @@ opts_t opts_parse(unsigned int argc, char **argv)
case 'K':
opts->direct_io = true;
break;
case 'X':
opts->discard_input = true;
opts->no_splice = true;
break;
case 'R':
opts->remote = pv_getnum_ui(optarg);
break;