lkml.org 
[lkml]   [2009]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 02/31] Constify struct address_space_operations for 2.6.32 v1
Matthew Wilcox wrote:
> On Fri, Dec 04, 2009 at 11:08:09PM +0100, Emese Revfy wrote:
>> struct address_space_operations {
>> - int (*writepage)(struct page *page, struct writeback_control *wbc);
>> - int (*readpage)(struct file *, struct page *);
>> - void (*sync_page)(struct page *);
>> + int (* const writepage)(struct page *page, struct writeback_control *wbc);
>> + int (* const readpage)(struct file *, struct page *);
>> + void (* const sync_page)(struct page *);
>
> 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.

> Aren't functions implicitly constant?

They are, but these are function pointer fields in a structure, not
the functions themselves.

--
Emese




\
 
 \ /
  Last update: 2009-12-05 01:37    [W:0.107 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site