public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Emese Revfy <re.emese@gmail.com>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 28/31] Constify struct super_operations for 2.6.32 v1
Date: Tue, 08 Dec 2009 01:06:38 +0100	[thread overview]
Message-ID: <4B1D988E.2000305@gmail.com> (raw)
In-Reply-To: <b6fcc0a0912071030y4ca0deabk1635ec2f3e7ffe26@mail.gmail.com>

Alexey Dobriyan wrote:
> On 12/6/09, Emese Revfy <re.emese@gmail.com> wrote:
>> Alexey Dobriyan wrote:
>>>> -   	struct inode *(*alloc_inode)(struct super_block *sb);
>>>> +   	struct inode *(* const alloc_inode)(struct super_block *sb);
>>> Good rule is if adding const doesn't move object from one section
>>> to another, it isn't worth it.
>>>
>>> I suggest we stick to it or risk another wave of jumbo patches.
>>>
>> If all instances of a given ops structure are const and we would like to
>> preserve this policy for the future as well, then  it is very useful
>> to give future programmers a strong hint about this policy by making
>> the compiler complain about any violation attempts. Otherwise they may
>> very well write code that modifies such structures and we will have to
>> work extra to undo that (or change the policy but in that case it is
>> good to know why we have to do that).
> 
> You may want to look what filesystems do with superblock operations.
> And after super operations were made const writes to it will be caught
> with readonly .rodata config option.
> 
> You're going too far with these modifiers.
> 
> Nothing will be caught.

DEBUG_RODATA catches the unwanted write attempt at runtime whereas
my patch will catch it at compile time. I think it's better to detect
an error as early as possible.
--
Emese

  reply	other threads:[~2009-12-08  0:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-06  5:14 [PATCH 28/31] Constify struct super_operations for 2.6.32 v1 Alexey Dobriyan
2009-12-06 14:23 ` Emese Revfy
2009-12-07 18:30   ` Alexey Dobriyan
2009-12-08  0:06     ` Emese Revfy [this message]
2009-12-08  1:51       ` Al Viro
2009-12-09  0:24         ` Emese Revfy
2009-12-09  0:47           ` Al Viro
2009-12-09  8:22             ` Olivier Galibert
2009-12-10 18:24             ` Emese Revfy
2009-12-09  1:31 ` Ralf Baechle
2009-12-09  1:45   ` Al Viro
  -- strict thread matches above, loose matches on Subject: below --
2009-12-04 22:00 [PATCH 00/31] constify various _ops structures " Emese Revfy
2009-12-04 22:47 ` [PATCH 28/31] Constify struct super_operations " Emese Revfy
2009-12-06  1:23   ` Al Viro
2009-12-06  1:41     ` Emese Revfy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B1D988E.2000305@gmail.com \
    --to=re.emese@gmail.com \
    --cc=adobriyan@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox