* [PATCH iproute2-next 1/2] dpll: align help and man notation with actual option parsing
@ 2026-05-12 13:52 Petr Oros
2026-05-12 13:52 ` [PATCH iproute2-next 2/2] dpll: monitor: add -t/--timestamp and --tshort options Petr Oros
2026-05-12 15:25 ` [PATCH iproute2-next 1/2] dpll: align help and man notation with actual option parsing Ivan Vecera
0 siblings, 2 replies; 4+ messages in thread
From: Petr Oros @ 2026-05-12 13:52 UTC (permalink / raw)
To: netdev; +Cc: ivecera, dsahern, stephen, vgrinber, Petr Oros
dpll uses getopt_long(), which only accepts long options with the
"--" prefix. The iproute2-wide "-X[name]" shorthand used in the
help text and man page implies a single-dash long form
(e.g. -Version, -json, -pretty) that getopt_long does not parse;
only -V/--Version, -j/--json and -p/--pretty actually work.
Replace the misleading shorthand with explicit "-V | --Version"
style so the documented forms match what the parser accepts, and
drop the redundant second usage line in help() that listed only a
subset of the options and implied dpll could be invoked without an
OBJECT. No functional change.
Signed-off-by: Petr Oros <poros@redhat.com>
---
dpll/dpll.c | 3 +--
man/man8/dpll.8 | 12 ++++++------
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/dpll/dpll.c b/dpll/dpll.c
index febf2a5d1fbdf4..81caa510078830 100644
--- a/dpll/dpll.c
+++ b/dpll/dpll.c
@@ -534,9 +534,8 @@ static void dpll_pr_freq_range(__u64 freq_min, __u64 freq_max)
static void help(void)
{
pr_err("Usage: dpll [ OPTIONS ] OBJECT { COMMAND | help }\n"
- " dpll [ -j[son] ] [ -p[retty] ]\n"
"where OBJECT := { device | pin | monitor }\n"
- " OPTIONS := { -V[ersion] | -j[son] | -p[retty] }\n");
+ " OPTIONS := { -V | --Version | -j | --json | -p | --pretty }\n");
}
static int cmd_device(struct dpll *dpll);
diff --git a/man/man8/dpll.8 b/man/man8/dpll.8
index c0d4b9caef2a6c..6b52970972f41a 100644
--- a/man/man8/dpll.8
+++ b/man/man8/dpll.8
@@ -27,9 +27,9 @@ dpll \- Digital Phase Locked Loop (DPLL) subsystem management
.ti -8
.IR OPTIONS " := { "
-\fB\-V\fR[\fIersion\fR] |
-\fB\-j\fR[\fIson\fR] |
-\fB\-p\fR[\fIretty\fR] }
+\fB\-V\fR | \fB\-\-Version\fR |
+\fB\-j\fR | \fB\-\-json\fR |
+\fB\-p\fR | \fB\-\-pretty\fR }
.SH DESCRIPTION
The
@@ -44,17 +44,17 @@ internal oscillators.
.SH OPTIONS
.TP
-.BR "\-V" , " \-Version"
+.BR "\-V" , " \-\-Version"
Print the version of the
.B dpll
utility and exit.
.TP
-.BR "\-j" , " \-json"
+.BR "\-j" , " \-\-json"
Output results in JavaScript Object Notation (JSON).
.TP
-.BR "\-p" , " \-pretty"
+.BR "\-p" , " \-\-pretty"
When combined with \-j, generates a pretty JSON output with indentation
and newlines for better human readability.
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH iproute2-next 2/2] dpll: monitor: add -t/--timestamp and --tshort options
2026-05-12 13:52 [PATCH iproute2-next 1/2] dpll: align help and man notation with actual option parsing Petr Oros
@ 2026-05-12 13:52 ` Petr Oros
2026-05-12 15:26 ` Ivan Vecera
2026-05-12 15:25 ` [PATCH iproute2-next 1/2] dpll: align help and man notation with actual option parsing Ivan Vecera
1 sibling, 1 reply; 4+ messages in thread
From: Petr Oros @ 2026-05-12 13:52 UTC (permalink / raw)
To: netdev; +Cc: ivecera, dsahern, stephen, vgrinber, Petr Oros
Bring dpll monitor in line with the rest of iproute2 by allowing each
received notification to be prefixed with a wall-clock timestamp.
-t / --timestamp emit a separate "Timestamp:" line before each event,
using the default text form of print_timestamp()
(matches ip / bridge / tc -t monitor)
--tshort emit a compact ISO 8601 prefix
"[YYYY-MM-DDTHH:MM:SS.uuuuuu]" inline instead
(matches ip -ts monitor)
When combined with -j, the timestamp shows up as a "timestamp" /
"timestamp_short" field on each notification object, the same way
ip -j -t mptcp monitor integrates the helper.
The flag is parsed globally but only consulted from the monitor
callback, so passing -t to non-monitor commands is a no-op.
--tshort has no short alias, so its long_options entry uses an
identifier above the ASCII range (OPT_TSHORT = 256) following the
iproute2 convention used in misc/ss.c, instead of consuming an
ASCII letter that could later collide with a real short option.
Signed-off-by: Petr Oros <poros@redhat.com>
---
bash-completion/dpll | 8 ++++++--
dpll/dpll.c | 21 +++++++++++++++++++--
man/man8/dpll.8 | 23 ++++++++++++++++++++++-
3 files changed, 47 insertions(+), 5 deletions(-)
diff --git a/bash-completion/dpll b/bash-completion/dpll
index 7ddcf529d429db..f615d69147d140 100644
--- a/bash-completion/dpll
+++ b/bash-completion/dpll
@@ -299,7 +299,7 @@ _dpll_monitor()
_dpll()
{
local cur prev words cword
- local opt='--Version --json --pretty'
+ local opt='--Version --json --pretty --timestamp --tshort'
local objects="device pin monitor"
_init_completion || return
@@ -326,7 +326,11 @@ _dpll()
return 0
;;
-j|--json)
- COMPREPLY=( $( compgen -W "--pretty $objects" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "--pretty --timestamp --tshort $objects" -- "$cur" ) )
+ return 0
+ ;;
+ -t|--timestamp|--tshort)
+ COMPREPLY=( $( compgen -W "monitor" -- "$cur" ) )
return 0
;;
*)
diff --git a/dpll/dpll.c b/dpll/dpll.c
index 81caa510078830..a3cda2c2903f71 100644
--- a/dpll/dpll.c
+++ b/dpll/dpll.c
@@ -29,7 +29,10 @@
#define pr_err(args...) fprintf(stderr, ##args)
+#define OPT_TSHORT 256
+
int json;
+int timestamp;
struct dpll {
struct mnlu_gen_socket nlg;
@@ -535,7 +538,8 @@ static void help(void)
{
pr_err("Usage: dpll [ OPTIONS ] OBJECT { COMMAND | help }\n"
"where OBJECT := { device | pin | monitor }\n"
- " OPTIONS := { -V | --Version | -j | --json | -p | --pretty }\n");
+ " OPTIONS := { -V | --Version | -j | --json | -p | --pretty |\n"
+ " -t | --timestamp | --tshort }\n");
}
static int cmd_device(struct dpll *dpll);
@@ -599,9 +603,11 @@ int main(int argc, char **argv)
{ "Version", no_argument, NULL, 'V' },
{ "json", no_argument, NULL, 'j' },
{ "pretty", no_argument, NULL, 'p' },
+ { "timestamp", no_argument, NULL, 't' },
+ { "tshort", no_argument, NULL, OPT_TSHORT },
{ NULL, 0, NULL, 0 }
};
- const char *opt_short = "Vjp";
+ const char *opt_short = "Vjpt";
struct dpll *dpll;
int err, opt, ret;
@@ -624,6 +630,13 @@ int main(int argc, char **argv)
case 'p':
pretty = true;
break;
+ case 't':
+ timestamp = 1;
+ break;
+ case OPT_TSHORT:
+ timestamp = 1;
+ timestamp_short = 1;
+ break;
default:
pr_err("Unknown option.\n");
help();
@@ -2305,6 +2318,8 @@ static int cmd_monitor_cb(const struct nlmsghdr *nlh, void *data)
new_json_obj_plain(json);
open_json_object(NULL);
+ if (timestamp)
+ print_timestamp(stdout);
print_string(PRINT_JSON, "name", NULL, json_name);
open_json_object("msg");
print_string(PRINT_FP, NULL, "[%s] ", cmd_name);
@@ -2334,6 +2349,8 @@ static int cmd_monitor_cb(const struct nlmsghdr *nlh, void *data)
new_json_obj_plain(json);
open_json_object(NULL);
+ if (timestamp)
+ print_timestamp(stdout);
print_string(PRINT_JSON, "name", NULL, json_name);
open_json_object("msg");
print_string(PRINT_FP, NULL, "[%s] ", cmd_name);
diff --git a/man/man8/dpll.8 b/man/man8/dpll.8
index 6b52970972f41a..43daa0cac2d5d2 100644
--- a/man/man8/dpll.8
+++ b/man/man8/dpll.8
@@ -29,7 +29,9 @@ dpll \- Digital Phase Locked Loop (DPLL) subsystem management
.IR OPTIONS " := { "
\fB\-V\fR | \fB\-\-Version\fR |
\fB\-j\fR | \fB\-\-json\fR |
-\fB\-p\fR | \fB\-\-pretty\fR }
+\fB\-p\fR | \fB\-\-pretty\fR |
+\fB\-t\fR | \fB\-\-timestamp\fR |
+\fB\-\-tshort\fR }
.SH DESCRIPTION
The
@@ -58,6 +60,25 @@ Output results in JavaScript Object Notation (JSON).
When combined with \-j, generates a pretty JSON output with indentation
and newlines for better human readability.
+.TP
+.BR "\-t" , " \-\-timestamp"
+When used with the
+.B monitor
+object, print a
+.B Timestamp:
+line before each received notification, in the same format used by
+.BR "ip monitor" .
+
+.TP
+.B "\-\-tshort"
+Like
+.BR \-t ,
+but emits a more compact, ISO 8601 inline prefix
+.RB \(lq [ YYYY-MM-DD T HH:MM:SS . uuuuuu ] \(rq
+in front of each notification instead of a separate
+.B Timestamp:
+line.
+
.SH DEVICE COMMANDS
.SS dpll device show [ id ID ] [ module-name NAME ] [ clock-id ID ] [ type TYPE ] [ mode MODE ] [ lock-status STATUS ]
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH iproute2-next 1/2] dpll: align help and man notation with actual option parsing
2026-05-12 13:52 [PATCH iproute2-next 1/2] dpll: align help and man notation with actual option parsing Petr Oros
2026-05-12 13:52 ` [PATCH iproute2-next 2/2] dpll: monitor: add -t/--timestamp and --tshort options Petr Oros
@ 2026-05-12 15:25 ` Ivan Vecera
1 sibling, 0 replies; 4+ messages in thread
From: Ivan Vecera @ 2026-05-12 15:25 UTC (permalink / raw)
To: Petr Oros, netdev; +Cc: dsahern, stephen, vgrinber
On 5/12/26 3:52 PM, Petr Oros wrote:
> dpll uses getopt_long(), which only accepts long options with the
> "--" prefix. The iproute2-wide "-X[name]" shorthand used in the
> help text and man page implies a single-dash long form
> (e.g. -Version, -json, -pretty) that getopt_long does not parse;
> only -V/--Version, -j/--json and -p/--pretty actually work.
>
> Replace the misleading shorthand with explicit "-V | --Version"
> style so the documented forms match what the parser accepts, and
> drop the redundant second usage line in help() that listed only a
> subset of the options and implied dpll could be invoked without an
> OBJECT. No functional change.
>
> Signed-off-by: Petr Oros <poros@redhat.com>
> ---
> dpll/dpll.c | 3 +--
> man/man8/dpll.8 | 12 ++++++------
> 2 files changed, 7 insertions(+), 8 deletions(-)
Reviewed-by: Ivan Vecera <ivecera@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH iproute2-next 2/2] dpll: monitor: add -t/--timestamp and --tshort options
2026-05-12 13:52 ` [PATCH iproute2-next 2/2] dpll: monitor: add -t/--timestamp and --tshort options Petr Oros
@ 2026-05-12 15:26 ` Ivan Vecera
0 siblings, 0 replies; 4+ messages in thread
From: Ivan Vecera @ 2026-05-12 15:26 UTC (permalink / raw)
To: Petr Oros, netdev; +Cc: dsahern, stephen, vgrinber
On 5/12/26 3:52 PM, Petr Oros wrote:
> Bring dpll monitor in line with the rest of iproute2 by allowing each
> received notification to be prefixed with a wall-clock timestamp.
>
> -t / --timestamp emit a separate "Timestamp:" line before each event,
> using the default text form of print_timestamp()
> (matches ip / bridge / tc -t monitor)
> --tshort emit a compact ISO 8601 prefix
> "[YYYY-MM-DDTHH:MM:SS.uuuuuu]" inline instead
> (matches ip -ts monitor)
>
> When combined with -j, the timestamp shows up as a "timestamp" /
> "timestamp_short" field on each notification object, the same way
> ip -j -t mptcp monitor integrates the helper.
>
> The flag is parsed globally but only consulted from the monitor
> callback, so passing -t to non-monitor commands is a no-op.
>
> --tshort has no short alias, so its long_options entry uses an
> identifier above the ASCII range (OPT_TSHORT = 256) following the
> iproute2 convention used in misc/ss.c, instead of consuming an
> ASCII letter that could later collide with a real short option.
>
> Signed-off-by: Petr Oros <poros@redhat.com>
> ---
> bash-completion/dpll | 8 ++++++--
> dpll/dpll.c | 21 +++++++++++++++++++--
> man/man8/dpll.8 | 23 ++++++++++++++++++++++-
> 3 files changed, 47 insertions(+), 5 deletions(-)
>
Reviewed-by: Ivan Vecera <ivecera@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-05-12 15:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-12 13:52 [PATCH iproute2-next 1/2] dpll: align help and man notation with actual option parsing Petr Oros
2026-05-12 13:52 ` [PATCH iproute2-next 2/2] dpll: monitor: add -t/--timestamp and --tshort options Petr Oros
2026-05-12 15:26 ` Ivan Vecera
2026-05-12 15:25 ` [PATCH iproute2-next 1/2] dpll: align help and man notation with actual option parsing Ivan Vecera
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox