[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wjdJmL22+zk3_rWAfEJJCf=oDxiJ530qk-WNk_Ji0qhxw@mail.gmail.com>
Date: Thu, 14 Jan 2021 11:09:01 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Will Deacon <will@...nel.org>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux-MM <linux-mm@...ck.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
Catalin Marinas <catalin.marinas@....com>,
Jan Kara <jack@...e.cz>, Minchan Kim <minchan@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
Vinayak Menon <vinmenon@...eaurora.org>,
Hugh Dickins <hughd@...gle.com>,
Android Kernel Team <kernel-team@...roid.com>
Subject: Re: [RFC PATCH 4/8] mm: Separate fault info out of 'struct vm_fault'
On Thu, Jan 14, 2021 at 11:00 AM Will Deacon <will@...nel.org> wrote:
>
> I tried that initially, but I found that I had to make all of the
> members const to get it to work, at which point the anonymous struct
> wasn't really adding anything. Did I just botch the syntax?
I'm not sure what you tried. But this stupid test-case sure works for me:
struct hello {
const struct {
unsigned long address;
};
unsigned int flags;
};
extern int fn(struct hello *);
int test(void)
{
struct hello a = {
.address = 1,
};
a.flags = 0;
return fn(&a);
}
and because "address" is in that unnamed constant struct, you can only
set it within that initializer, and cannot do
a.address = 0;
without an error (the way you _can_ do "a.flags = 0").
I don't see naming the struct making a difference - apart from forcing
that big rename patch, of course.
But maybe we're talking about different issues?
Linus
Powered by blists - more mailing lists