* [PATCH] Staging : lustre: Struct file_operations should be const
@ 2015-08-03 5:47 Shraddha Barke
2015-08-03 7:18 ` Sudip Mukherjee
0 siblings, 1 reply; 4+ messages in thread
From: Shraddha Barke @ 2015-08-03 5:47 UTC (permalink / raw)
To: Oleg Drokin, Al Viro, Julia Lawall, aybuke ozdemir,
Andreas Dilger, John L. Hammond, Frank Zago, Greg Kroah-Hartman,
HPDD-discuss, devel, linux-kernel
Cc: Shraddha Barke
Declare the file_operations structure ll_file_operations as const, as done
elsewhere in the kernel, as there are no modifications to its fields.
Problem found using checkpatch:
WARNING: struct file_operations should normally be const
Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
drivers/staging/lustre/lustre/llite/file.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index dcd0c6d..2c467bf 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -3116,7 +3116,7 @@ int ll_inode_permission(struct inode *inode, int mask)
}
/* -o localflock - only provides locally consistent flock locks */
-struct file_operations ll_file_operations = {
+const struct file_operations ll_file_operations = {
.read_iter = ll_file_read_iter,
.write_iter = ll_file_write_iter,
.unlocked_ioctl = ll_file_ioctl,
@@ -3129,7 +3129,7 @@ struct file_operations ll_file_operations = {
.flush = ll_flush
};
-struct file_operations ll_file_operations_flock = {
+const struct file_operations ll_file_operations_flock = {
.read_iter = ll_file_read_iter,
.write_iter = ll_file_write_iter,
.unlocked_ioctl = ll_file_ioctl,
@@ -3145,7 +3145,7 @@ struct file_operations ll_file_operations_flock = {
};
/* These are for -o noflock - to return ENOSYS on flock calls */
-struct file_operations ll_file_operations_noflock = {
+const struct file_operations ll_file_operations_noflock = {
.read_iter = ll_file_read_iter,
.write_iter = ll_file_write_iter,
.unlocked_ioctl = ll_file_ioctl,
--
2.1.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Staging : lustre: Struct file_operations should be const
2015-08-03 5:47 [PATCH] Staging : lustre: Struct file_operations should be const Shraddha Barke
@ 2015-08-03 7:18 ` Sudip Mukherjee
0 siblings, 0 replies; 4+ messages in thread
From: Sudip Mukherjee @ 2015-08-03 7:18 UTC (permalink / raw)
To: Shraddha Barke
Cc: Oleg Drokin, Al Viro, Julia Lawall, aybuke ozdemir,
Andreas Dilger, John L. Hammond, Frank Zago, Greg Kroah-Hartman,
HPDD-discuss, devel, linux-kernel
On Mon, Aug 03, 2015 at 11:17:06AM +0530, Shraddha Barke wrote:
> Declare the file_operations structure ll_file_operations as const, as done
> elsewhere in the kernel, as there are no modifications to its fields.
>
> Problem found using checkpatch:
>
> WARNING: struct file_operations should normally be const
>
> Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
> ---
You have not even build tested your patch before sending. :(
drivers/staging/lustre/lustre/llite/file.c:3119:30: error: conflicting type qualifiers for ‘ll_file_operations’
const struct file_operations ll_file_operations = {
^
In file included from drivers/staging/lustre/lustre/llite/file.c:48:0:
drivers/staging/lustre/lustre/llite/llite_internal.h:710:31: note: previous declaration of ‘ll_file_operations’ was here
extern struct file_operations ll_file_operations;
^
drivers/staging/lustre/lustre/llite/file.c:3132:30: error: conflicting type qualifiers for ‘ll_file_operations_flock’
const struct file_operations ll_file_operations_flock = {
^
In file included from drivers/staging/lustre/lustre/llite/file.c:48:0:
drivers/staging/lustre/lustre/llite/llite_internal.h:711:31: note: previous declaration of ‘ll_file_operations_flock’ was here
extern struct file_operations ll_file_operations_flock;
^
drivers/staging/lustre/lustre/llite/file.c:3148:30: error: conflicting type qualifiers for ‘ll_file_operations_noflock’
const struct file_operations ll_file_operations_noflock = {
^
In file included from drivers/staging/lustre/lustre/llite/file.c:48:0:
drivers/staging/lustre/lustre/llite/llite_internal.h:712:31: note: previous declaration of ‘ll_file_operations_noflock’ was here
extern struct file_operations ll_file_operations_noflock;
^
make[3]: *** [drivers/staging/lustre/lustre/llite/file.o] Error 1
make[2]: *** [drivers/staging/lustre/lustre/llite] Error 2
make[1]: *** [drivers/staging/lustre/lustre] Error 2
make: *** [_module_drivers/staging/lustre] Error 2
regards
sudip
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Staging : lustre: Struct file_operations should be const
2015-08-02 11:02 Shraddha Barke
@ 2015-08-02 11:26 ` Julia Lawall
0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2015-08-02 11:26 UTC (permalink / raw)
To: Shraddha Barke
Cc: Oleg Drokin, Andreas Dilger, Al Viro, Greg Kroah-Hartman,
Frank Zago, devel, linux-kernel
On Sun, 2 Aug 2015, Shraddha Barke wrote:
> This patch fixes the following checkpatch.pl warning:
>
> WARNING: struct file_operations should normally be const
This is not the good way to write the message. The information it conveys
is "checkpatch generated this warning, so I have made some change
(unspecified) that make checkpatch not complain".
A better approach would be to say:
Declare the file_operations structure ll_file_operations as const, as done
elsewhere in the kernel, as there are no modifications to its fields.
Problem found using checkpatch.
This way the reader knows what was done, and what issues were taken into
account when making the change. At the same time, you still credit
checkpatch for helping you find the problem
julia
>
> Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
> ---
> drivers/staging/lustre/lustre/llite/file.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
> index dcd0c6d..369a722 100644
> --- a/drivers/staging/lustre/lustre/llite/file.c
> +++ b/drivers/staging/lustre/lustre/llite/file.c
> @@ -3116,7 +3116,7 @@ int ll_inode_permission(struct inode *inode, int mask)
> }
>
> /* -o localflock - only provides locally consistent flock locks */
> -struct file_operations ll_file_operations = {
> +const struct file_operations ll_file_operations = {
> .read_iter = ll_file_read_iter,
> .write_iter = ll_file_write_iter,
> .unlocked_ioctl = ll_file_ioctl,
> --
> 2.1.0
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] Staging : lustre: Struct file_operations should be const
@ 2015-08-02 11:02 Shraddha Barke
2015-08-02 11:26 ` Julia Lawall
0 siblings, 1 reply; 4+ messages in thread
From: Shraddha Barke @ 2015-08-02 11:02 UTC (permalink / raw)
To: Oleg Drokin, Andreas Dilger, Al Viro, Julia Lawall,
Greg Kroah-Hartman, Frank Zago, devel, linux-kernel
Cc: Shraddha Barke
This patch fixes the following checkpatch.pl warning:
WARNING: struct file_operations should normally be const
Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
drivers/staging/lustre/lustre/llite/file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index dcd0c6d..369a722 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -3116,7 +3116,7 @@ int ll_inode_permission(struct inode *inode, int mask)
}
/* -o localflock - only provides locally consistent flock locks */
-struct file_operations ll_file_operations = {
+const struct file_operations ll_file_operations = {
.read_iter = ll_file_read_iter,
.write_iter = ll_file_write_iter,
.unlocked_ioctl = ll_file_ioctl,
--
2.1.0
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-08-03 7:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-03 5:47 [PATCH] Staging : lustre: Struct file_operations should be const Shraddha Barke
2015-08-03 7:18 ` Sudip Mukherjee
-- strict thread matches above, loose matches on Subject: below --
2015-08-02 11:02 Shraddha Barke
2015-08-02 11:26 ` Julia Lawall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®