Re: [PATCH/RFC] module: replace module_layout with module_memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 18, 2023 at 9:35 PM Christoph Hellwig <hch@xxxxxx> wrote:
>
> On Wed, Jan 18, 2023 at 01:52:51PM -0800, Song Liu wrote:
> > In this way we can use the array in the for loops, and use mod->core_text,
> > etc. when we only need to access one of them.
>
> Just use the array please instead of making it too ugly.  If that
> is the only sensible way to iterate we have a good argument for the
> array and can live with it.

Hmm.. I think it won't be ugly outside of the struct definition...
Alternatively, how about use something like

#define core_text mod_mem[MOD_MEM_TYPE_TEXT]
...

which is similar to

struct sock {
        /*
         * Now struct inet_timewait_sock also uses sock_common, so please just
         * don't add nothing before this first member (__sk_common) --acme
         */
        struct sock_common      __sk_common;
#define sk_node                 __sk_common.skc_node
#define sk_nulls_node           __sk_common.skc_nulls_node
...
};

?

Thanks,
Song



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux