Messages in this thread | | | Date | Sat, 5 Dec 2009 07:27:29 -0700 | From | Matthew Wilcox <> | Subject | Re: [PATCH 02/31] Constify struct address_space_operations for 2.6.32 v1 |
| |
On Sat, Dec 05, 2009 at 01:36:56AM +0100, Emese Revfy wrote: > Matthew Wilcox wrote: > > On Fri, Dec 04, 2009 at 11:08:09PM +0100, Emese Revfy wrote: > >> - int (*writepage)(struct page *page, struct writeback_control *wbc); > >> + int (* const writepage)(struct page *page, struct writeback_control *wbc); > > > > Umm. What effect does this have? > > What changes as a result of this patch? > > My idea was that since all variables of this type are const, we might > as well have the compiler enforce it for the future if you think that > these fields should not be writable at all.
The compiler does already enforce it. We do it like this:
struct address_space { const struct address_space_operations *a_ops; /* methods */ }
-- Matthew Wilcox Intel Open Source Technology Centre "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."
| |