lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <875xhc6b8r.fsf@kernel.org>
Date: Tue, 03 Jun 2025 18:28:04 +0200
From: Andreas Hindborg <a.hindborg@...nel.org>
To: "FUJITA Tomonori" <fujita.tomonori@...il.com>
Cc: <rust-for-linux@...r.kernel.org>,  <boqun.feng@...il.com>,
  <frederic@...nel.org>,  <lyude@...hat.com>,  <tglx@...utronix.de>,
  <anna-maria@...utronix.de>,  <jstultz@...gle.com>,  <sboyd@...nel.org>,
  <ojeda@...nel.org>,  <alex.gaynor@...il.com>,  <gary@...yguo.net>,
  <bjorn3_gh@...tonmail.com>,  <benno.lossin@...ton.me>,
  <aliceryhl@...gle.com>,  <tmgross@...ch.edu>,  <dakr@...nel.org>,
  <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1 3/5] rust: time: Add HrTimerExpires trait

"FUJITA Tomonori" <fujita.tomonori@...il.com> writes:

> On Fri, 30 May 2025 15:04:00 +0200
> Andreas Hindborg <a.hindborg@...nel.org> wrote:
>
>>> +/// Defines a new `HrTimerMode` implementation with a given expiration type and C mode.
>>> +#[doc(hidden)]
>>> +macro_rules! define_hrtimer_mode {
>>> +    (
>>> +        $(#[$meta:meta])*
>>> +        $vis:vis struct $name:ident<$clock:ident> {
>>> +            c = $mode:ident,
>>> +            expires = $expires:ty
>>> +        }
>>> +    ) => {
>>> +        $(#[$meta])*
>>> +        $vis struct $name<$clock: $crate::time::ClockSource>(
>>> +            ::core::marker::PhantomData<$clock>
>>> +        );
>>
>> I think a macro is too much here. The code would be easier to read
>> without the macro, and the macro does not remove much code here.
>>
>> Could you try to do the trait implementations without the macro?
>
> Something like the following, right? If so, I'll do in the next
> version. I'm also fine with that way.
>
> /// Timer that expires at a fixed point in time.
> pub struct AbsoluteMode<C: ClockSource>(PhantomData<C>);
>
> impl<C: ClockSource> HrTimerMode for AbsoluteMode<C> {
>     const C_MODE: bindings::hrtimer_mode = bindings::hrtimer_mode_HRTIMER_MODE_ABS;
>
>     type Clock = C;
>     type Expires = Instant<C>;
> }

OK, let's do that then 👍


Best regards,
Andreas Hindborg




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ