From: Steven Whitehouse <swhiteho@redhat.com>
To: Denis Cheng <crquan@gmail.com>
Cc: cluster-devel@redhat.com, linux-kernel@vger.kernel.org,
chdebra@gmail.com, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 3/3] fs/gfs2: also mark struct {dentry,vm}_operations const
Date: Tue, 31 Jul 2007 12:47:12 +0100 [thread overview]
Message-ID: <1185882433.8765.612.camel@quoit> (raw)
In-Reply-To: <1185877895769-git-send-email-crquan@gmail.com>
Hi,
On Tue, 2007-07-31 at 18:31 +0800, Denis Cheng wrote:
> these struct *_operations are all method tables, thus should be const.
>
> Signed-off-by: Denis Cheng <crquan@gmail.com>
> ---
> fs/gfs2/ops_dentry.c | 3 +--
> fs/gfs2/ops_dentry.h | 2 +-
> fs/gfs2/ops_vm.c | 4 ++--
> fs/gfs2/ops_vm.h | 4 ++--
> include/linux/dcache.h | 2 +-
> include/linux/mm.h | 2 +-
> 6 files changed, 8 insertions(+), 9 deletions(-)
>
I've applied the first two patches in the series, but I'm still not
quite sure about this one. Even though it might not produce any warnings
there are still other filesystems to change, and I think it would be a
good plan to convert them all and CC the relevant maintainers.
Steve.
> diff --git a/fs/gfs2/ops_dentry.c b/fs/gfs2/ops_dentry.c
> index 793e334..1bdf016 100644
> --- a/fs/gfs2/ops_dentry.c
> +++ b/fs/gfs2/ops_dentry.c
> @@ -108,8 +108,7 @@ static int gfs2_dhash(struct dentry *dentry, struct qstr *str)
> return 0;
> }
>
> -struct dentry_operations gfs2_dops = {
> +const struct dentry_operations gfs2_dops = {
> .d_revalidate = gfs2_drevalidate,
> .d_hash = gfs2_dhash,
> };
> -
> diff --git a/fs/gfs2/ops_dentry.h b/fs/gfs2/ops_dentry.h
> index 5caa3db..668a6bc 100644
> --- a/fs/gfs2/ops_dentry.h
> +++ b/fs/gfs2/ops_dentry.h
> @@ -12,6 +12,6 @@
>
> #include <linux/dcache.h>
>
> -extern struct dentry_operations gfs2_dops;
> +extern const struct dentry_operations gfs2_dops;
>
> #endif /* __OPS_DENTRY_DOT_H__ */
> diff --git a/fs/gfs2/ops_vm.c b/fs/gfs2/ops_vm.c
> index 927d739..baa3b20 100644
> --- a/fs/gfs2/ops_vm.c
> +++ b/fs/gfs2/ops_vm.c
> @@ -159,11 +159,11 @@ out:
> return ret;
> }
>
> -struct vm_operations_struct gfs2_vm_ops_private = {
> +const struct vm_operations_struct gfs2_vm_ops_private = {
> .fault = gfs2_private_fault,
> };
>
> -struct vm_operations_struct gfs2_vm_ops_sharewrite = {
> +const struct vm_operations_struct gfs2_vm_ops_sharewrite = {
> .fault = gfs2_sharewrite_fault,
> };
>
> diff --git a/fs/gfs2/ops_vm.h b/fs/gfs2/ops_vm.h
> index 4ae8f43..cfefd2d 100644
> --- a/fs/gfs2/ops_vm.h
> +++ b/fs/gfs2/ops_vm.h
> @@ -12,7 +12,7 @@
>
> #include <linux/mm.h>
>
> -extern struct vm_operations_struct gfs2_vm_ops_private;
> -extern struct vm_operations_struct gfs2_vm_ops_sharewrite;
> +extern const struct vm_operations_struct gfs2_vm_ops_private;
> +extern const struct vm_operations_struct gfs2_vm_ops_sharewrite;
>
> #endif /* __OPS_VM_DOT_H__ */
> diff --git a/include/linux/dcache.h b/include/linux/dcache.h
> index aab53df..9cd948e 100644
> --- a/include/linux/dcache.h
> +++ b/include/linux/dcache.h
> @@ -104,7 +104,7 @@ struct dentry {
> struct list_head d_subdirs; /* our children */
> struct list_head d_alias; /* inode alias list */
> unsigned long d_time; /* used by d_revalidate */
> - struct dentry_operations *d_op;
> + const struct dentry_operations *d_op;
> struct super_block *d_sb; /* The root of the dentry tree */
> void *d_fsdata; /* fs-specific data */
> #ifdef CONFIG_PROFILING
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 655094d..c91b684 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -96,7 +96,7 @@ struct vm_area_struct {
> struct anon_vma *anon_vma; /* Serialized by page_table_lock */
>
> /* Function pointers to deal with this struct. */
> - struct vm_operations_struct * vm_ops;
> + const struct vm_operations_struct * vm_ops;
>
> /* Information about our backing store: */
> unsigned long vm_pgoff; /* Offset (within vm_file) in PAGE_SIZE
prev parent reply other threads:[~2007-07-31 11:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-31 5:46 [PATCH] fs/gfs2: mark struct *_operations const Denis Cheng
2007-07-31 9:17 ` Steven Whitehouse
2007-07-31 9:35 ` rae l
2007-07-31 10:31 ` [PATCH 1/3] " Denis Cheng
2007-07-31 10:31 ` [PATCH 2/3] fs/gfs2: use the declaration of gfs2_dops in the header file instead Denis Cheng
2007-07-31 10:31 ` [PATCH 3/3] fs/gfs2: also mark struct {dentry,vm}_operations const Denis Cheng
2007-07-31 11:47 ` Steven Whitehouse [this message]
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=1185882433.8765.612.camel@quoit \
--to=swhiteho@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=chdebra@gmail.com \
--cc=cluster-devel@redhat.com \
--cc=crquan@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