Re: [PATCH v1] rust: time: rename ClockSource trait to ClockId

Andreas Hindborg <[email protected]> Wed, 05 Aug 2026 13:01:17 +0200
Newsgroups org.kernel.vger.rust-for-linux
Message-ID <[email protected]>
"FUJITA Tomonori" <[email protected]> writes:

> From: FUJITA Tomonori <[email protected]>
>
> The `ClockSource` trait has nothing to do with the C `struct clocksource`
> in `include/linux/clocksource.h`, which abstracts the hardware counter
> used as a source of time for the majority of the clockids. The trait
> instead carries a `clockid_t` `ID`, i.e. one of the IDs of "the various
> system clocks (for POSIX.1b interval timers)" as described in
> include/uapi/linux/time.h (CLOCK_MONOTONIC, CLOCK_REALTIME, ...). It thus
> plays the role of a `clockid_t`, and the `ClockSource` name overlaps
> confusingly with the C `clocksource` concept when reading across C and
> Rust code.
>
> Rename the trait to `ClockId` to reflect that it represents a
> `clockid_t`. This is a pure rename; there is no functional change.
>
> Suggested-by: John Stultz <[email protected]>
> Signed-off-by: FUJITA Tomonori <[email protected]>
> Link: https://lore.kernel.org/rust-for-linux/CANDhNCrKMdHCmL76LWCROVF2Ly-9NxmfmQ2T+P=iv34aVkO2uQ@mail.gmail.com/

Makes sense to me.

Reviewed-by: Andreas Hindborg <[email protected]>

Best regards,
Andreas Hindborg