[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wiafEyX7UgOeZgvd6fvuByE5WXUPh9599kwOc_d-pdeug@mail.gmail.com>
Date: Thu, 9 Jan 2025 10:24:05 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Linux Trace Kernel <linux-trace-kernel@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Masami Hiramatsu <mhiramat@...nel.org>, Mark Rutland <mark.rutland@....com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>, Andrew Morton <akpm@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>, Masahiro Yamada <masahiroy@...nel.org>,
Nathan Chancellor <nathan@...nel.org>, Nicolas Schier <nicolas@...sle.eu>,
Zheng Yejian <zhengyejian1@...wei.com>, Martin Kelly <martin.kelly@...wdstrike.com>,
Christophe Leroy <christophe.leroy@...roup.eu>, Josh Poimboeuf <jpoimboe@...hat.com>,
Stephen Rothwell <sfr@...b.auug.org.au>
Subject: Re: [PATCH v2] scripts/sorttable: Move code from sorttable.h into sorttable.c
On Tue, 7 Jan 2025 at 19:30, Steven Rostedt <rostedt@...dmis.org> wrote:
>
> +
> +static int (*compare_extable)(const void *a, const void *b);
> +static uint64_t (*ehdr_shoff)(Elf_Ehdr *ehdr);
> +static uint16_t (*ehdr_shstrndx)(Elf_Ehdr *ehdr);
...
Side note - and independently of the pure code movement - wouldn't it
be nice to just make this a structure of function pointers, and then
instead of this:
> case ELFCLASS32:
> + compare_extable = compare_extable_32;
> + ehdr_shoff = ehdr32_shoff;
> + ehdr_shentsize = ehdr32_shentsize;
> + ehdr_shstrndx = ehdr32_shstrndx;
> + ehdr_shnum = ehdr32_shnum;
...
> case ELFCLASS64:
> - {
> + compare_extable = compare_extable_64;
> + ehdr_shoff = ehdr64_shoff;
> + ehdr_shentsize = ehdr64_shentsize;
> + ehdr_shstrndx = ehdr64_shstrndx;
> + ehdr_shnum = ehdr64_shnum;
...
just pick one of two static structure pointers with these things.
Linus
Powered by blists - more mailing lists