mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <linux@weissschuh.net>
To: Joel Granados <j.granados@samsung.com>
Cc: Luis Chamberlain <mcgrof@kernel.org>, Kees Cook <kees@kernel.org>,
	 Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] sysctl: treewide: constify the ctl_table argument of proc_handlers
Date: Wed, 24 Jul 2024 20:43:08 +0200	[thread overview]
Message-ID: <28c3d8b8-201e-45b9-b7eb-4da3e0acf7cc@t-8ch.de> (raw)
In-Reply-To: <20240724182058.svxh3ux23p4fnqqf@joelS2.panther.com>

On 2024-07-24 20:20:58+0000, Joel Granados wrote:
> On Wed, Jul 24, 2024 at 11:32:26AM +0200, Thomas Weißschuh wrote:
> > On 2024-07-24 11:18:17+0000, Joel Granados wrote:
> ...
> > > > > ```
> > > > 
> > > > Yes, IIRC I got told during one review to drop it.
> > > > But for me it is also necessary.
> > > I also remember a comment from the XFS part of the patches where you
> > > changed the formatting on some functions. What did you do to address
> > > this? Did you change them manually? Or do you have a script?
> > 
> > Yes, the style fixes were done manually.
> Ok. I have created some sed scripts to automate this.
> 
> > 
> > > > Thinking back, there were other "virtual" lines, too.
> ...
> > >   int , void *, size_t *, loff_t *);
> > > ```
> > > 
> > > > 
> > > > (It doesn't find anything else, though)
> > > Maybe you are missing running it with --include-headers?
> > 
> > There seems to be a slight misunderstanding.
> > I meant that it does not find anything *new* on top of the existing
> > patch, not that it can fully recreate the patch.
> Sorry, misunderstood you.
> 
> > 
> > (I used --include-headers, undid one header hunk from the patch and
> > validated that the hunk gets recreated)
> ok. That means that "--include-headers" is active.
> 
> I actually made further changes on the cocci script for it to catch all
> the corner cases that you did by hand. The patch changes substantially
> as now there are much less formatting issues introduced by the script.
> I'll include you as co-developed-by and in that way give you proper
> credit for your work.

Ok.

I ran the scripts and for the result:

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

> In order to reproduce what I did you need to run [1] with this cocci
> script [2] and then run [3] with this sed script [4]. I have checked to
> see that the same files are changed. The difference between what you and
> I did is mainly that coccinelle does not make any formatting decisions.
> 
> Will create and send the PR shortly.

Ack.

> Best
> 
> 
> [1]
> ```
>   make coccicheck  MODE=patch SPFLAGS="--in-place --include-headers --smpl-spacing --jobs=8" COCCI=SCRIPT.cocci
> ```
> 
> [2]
> ```
>   virtual patch
> 
>   @r1@
>   identifier ctl, write, buffer, lenp, ppos;
>   identifier func !~ "appldata_(timer|interval)_handler|sched_(rt|rr)_handler|rds_tcp_skbuf_handler|proc_sctp_do_(hmac_alg|rto_min|rto_max|udp_port|alpha_beta|auth|probe_interval)";
>   @@
> 
>   int func(
>   - struct ctl_table *ctl
>   + const struct ctl_table *ctl
>     ,int write, void *buffer, size_t *lenp, loff_t *ppos);
> 
>   @r2@
>   identifier func, ctl, write, buffer, lenp, ppos;
>   @@
> 
>   int func(
>   - struct ctl_table *ctl
>   + const struct ctl_table *ctl
>     ,int write, void *buffer, size_t *lenp, loff_t *ppos)
>   { ... }
> 
>   @r3@
>   identifier func;
>   @@
> 
>   int func(
>   - struct ctl_table *
>   + const struct ctl_table *
>     ,int , void *, size_t *, loff_t *);
> 
>   @r4@
>   identifier func, ctl;
>   @@
> 
>   int func(
>   - struct ctl_table *ctl
>   + const struct ctl_table *ctl
>     ,int , void *, size_t *, loff_t *);
> 
>   @r5@
>   identifier func, write, buffer, lenp, ppos;
>   @@
> 
>   int func(
>   - struct ctl_table *
>   + const struct ctl_table *
>     ,int write, void *buffer, size_t *lenp, loff_t *ppos);
> ```
> 
> [3] 
> ```
>  sed --in-place -f /tmp/constfy_formating.sed fs/xfs/xfs_sysctl.c kernel/watchdog.c
> ```
> 
> [4]
> ```
> s/^xfs_stats_clear_proc_handler(const struct ctl_table \*ctl,$/xfs_stats_clear_proc_handler(\
> \tconst struct ctl_table\t*ctl,/
> s/^xfs_panic_mask_proc_handler(const struct ctl_table \*ctl,$/xfs_panic_mask_proc_handler(\
> \tconst struct ctl_table\t*ctl,/
> s/^xfs_deprecated_dointvec_minmax(const struct ctl_table \*ctl,$/xfs_deprecated_dointvec_minmax(\
> \tconst struct ctl_table\t*ctl,/
> s/proc_watchdog_common(int which, struct ctl_table \*table/proc_watchdog_common(int which, const struct ctl_table *table/
> 
> ```
> 
> -- 
> 
> Joel Granados

      reply	other threads:[~2024-07-24 18:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20240619100941eucas1p25d522dca3b74c899434b97b0c0dc78a0@eucas1p2.samsung.com>
2024-06-19 10:09 ` Thomas Weißschuh
2024-06-19 20:51   ` Kees Cook
2024-07-24 21:05     ` Joel Granados
2024-07-24 21:29       ` Kees Cook
2024-06-20  8:22   ` Joel Granados
2024-06-20 10:34   ` Joel Granados
2024-06-20 14:34     ` Thomas Weißschuh
2024-06-20 23:45   ` Luis Chamberlain
2024-07-15 20:23   ` Joel Granados
2024-07-15 20:58     ` Thomas Weißschuh
2024-07-16 15:27       ` Joel Granados
2024-07-17 15:26         ` Thomas Weißschuh
2024-07-17 19:57           ` Joel Granados
2024-07-22  7:41             ` Thomas Weißschuh
2024-07-23  8:33               ` Joel Granados
2024-07-24  8:41               ` Joel Granados
2024-07-24  8:56                 ` Thomas Weißschuh
2024-07-24  9:18                   ` Joel Granados
2024-07-24  9:32                     ` Thomas Weißschuh
2024-07-24 18:20                       ` Joel Granados
2024-07-24 18:43                         ` Thomas Weißschuh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=28c3d8b8-201e-45b9-b7eb-4da3e0acf7cc@t-8ch.de \
    --to=linux@weissschuh.net \
    --cc=akpm@linux-foundation.org \
    --cc=j.granados@samsung.com \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®