[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a2813fab9089cf89d6ac60998abe4fa3f226d9d7.camel@redhat.com>
Date: Thu, 04 Sep 2025 10:39:31 +0200
From: Gabriele Monaco <gmonaco@...hat.com>
To: Nam Cao <namcao@...utronix.de>
Cc: linux-kernel@...r.kernel.org, Steven Rostedt <rostedt@...dmis.org>,
linux-trace-kernel@...r.kernel.org, Tomas Glozar <tglozar@...hat.com>, Juri
Lelli <jlelli@...hat.com>, Clark Williams <williams@...hat.com>, John Kacur
<jkacur@...hat.com>
Subject: Re: [RFC PATCH 16/17] verification/rvgen: Add support for per-obj
monitors
On Thu, 2025-09-04 at 10:20 +0200, Nam Cao wrote:
> On Thu, Aug 14, 2025 at 05:08:08PM +0200, Gabriele Monaco wrote:
> > + def fill_per_obj_definitions(self) -> list:
> > + if self.monitor_type == "per_obj":
> > + return ["""
> > +/*
> > + * da_get_id - Get the id from a target
> > + */
> > +static inline da_id_type da_get_id(monitor_target target)
> > +{
> > + return /* XXX: define how to get an id from the target */;
> > +}
> > +"""]
> > + return []
> > +
>
> I know this is the existing style that we have. But I think this is
> not something we should keep. How about something like:
>
> import textwrap
>
> def fill_per_obj_definitions(self) -> list:
> if self.monitor_type == "per_obj":
> return [textwrap.dedent("""
> /*
> * da_get_id - Get the id from a target
> */
> static inline da_id_type da_get_id(monitor_target target)
> {
> return /* XXX: define how to get an id from the
> target */;
> }
> """)]
> return []
Mmh, I see what you mean.
I wasn't aware of this textwrap, but what immediately comes to mind is
that we'd end up mixing spaces (python indentation) and tabs (C
indentation).
While textwrap may handle the case, it doesn't look too readable to me.
I'd say we can (slowly) transition to using textwrap here but mandate
having \t for tabs to make them explicit (didn't test).
What do you think?
Thanks,
Gabriele
Powered by blists - more mailing lists