On Tue, Mar 1, 2022 at 10:27 AM <crash-utility-request@redhat.com> wrote:
Date: Tue, 1 Mar 2022 02:26:32 +0000
From: HAGIO KAZUHITO(?????)     <k-hagio-ab@nec.com>
To: lijiang <lijiang@redhat.com>
Cc: "Discussion list for crash utility usage,   maintenance and
        development" <crash-utility@redhat.com>
Subject: Re: [Crash-utility] [PATCH 1/2] ps: Add support to "ps -l" to
        properly display process list
Message-ID:
        <TYYPR01MB6777F039D25FAFD0A6486D81DD029@TYYPR01MB6777.jpnprd01.prod.outlook.com>

Content-Type: text/plain; charset="utf-8"

Hi Lianbo,

-----Original Message-----
> >> diff --git a/defs.h b/defs.h
> >> index 7d386d2..ed2f5ca 100644
> >> --- a/defs.h
> >> +++ b/defs.h
> >> @@ -1768,6 +1768,8 @@ struct offset_table {                    /* stash of commonly-used offsets */
> >>         long vcpu_struct_rq;
> >>         long task_struct_sched_info;
> >>         long sched_info_last_arrival;
> >> +       long task_struct_sched_entity;
> >> +       long se_exec_start;
> >
> >
> > This can be only appended to the end of the offset_table.
> > For more details, refer to the section "writing patches" in wiki:
> > https://github.com/crash-utility/crash/wiki

Seeing this exchange and thought of something like this:

--- a/defs.h
+++ b/defs.h
@@ -1215,8 +1215,8 @@ struct reference {
        void *refp;
 };

-struct offset_table {                    /* stash of commonly-used offsets */
-       long list_head_next;             /* add new entries to end of table */
+struct offset_table {          /* NOTE: add new entries to end of table [1] */
+       long list_head_next;    /* [1] https://github.com/crash-utility/crash/wiki */
        long list_head_prev;
        long task_struct_pid;
        long task_struct_state;


With this patch, a patch trying to add an entry to the middle of the table:

diff --git a/defs.h b/defs.h
index 938e39ca4baf..c0814482abaa 100644
--- a/defs.h
+++ b/defs.h
@@ -2007,6 +2007,7 @@ struct offset_table {             /* NOTE: add new entries to end of table [1] */
        long mm_struct_mm_count;
        long task_struct_thread_reg29;
        long task_struct_thread_reg31;
+       long foo_bar;
        long pt_regs_regs;
        long pt_regs_cp0_badvaddr;
        long address_space_page_tree;


Having this even only for the offset_table, size_table and array_table
might be effective to let developers notice that rule. 

That might help, but it may still be ignored.

 
What do you think?  Attached a patch.

Tried to add the contribution guidelines at the end of email, like this:
--
Crash-utility mailing list
Crash-utility@redhat.com
https://listman.redhat.com/mailman/listinfo/crash-utility
Contribution Guidlines: https://github.com/crash-utility/crash/wiki

Or do we have a script to check the patch rules? Just like the checkpatch.pl in the kernel?

Thanks.
Lianbo