Staging : lustre: Struct file_operations should be const
PATCH 1/1 Staging : lustre: Struct file_operations should be const
This patch fixes the following checkpatch.pl warning:
WARNING: struct file_operations should normally be const
--- drivers/staging/lustre/lustre/llite/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/llite/file.c +1 -1
@@ -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,
Signature · 1 line
2.1.0
Quoted 3 lines · Shraddha Barke
This patch fixes the following checkpatch.pl warning:
WARNING: struct
file_operationsshould 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
Quoted 23 lines
Signed-off-by Shraddha Barke <[email protected]>--- drivers/staging/lustre/lustre/llite/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/lustre/lustre/llite/file.c +1
-1@@ -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,Signature · 1 line
2.1.0
PATCH v2 1/1 Revert "Staging : lustre: Struct file_operations should be const"
In reply to Shraddha BarkeDeclare 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.
---
Changes in v2:
- Make the commit message more clearer.
drivers/staging/lustre/lustre/llite/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/llite/file.c +1 -1
@@ -3116,7 +3116,7 @@ int ll_inode_permission(struct inode *inode, int mask) }/* -o localflock - only provides locally consistent flock locks */ -const struct file_operations ll_file_operations = { +struct file_operations ll_file_operations = { .read_iter = ll_file_read_iter, .write_iter = ll_file_write_iter, .unlocked_ioctl = ll_file_ioctl,
Signature · 1 line
2.1.0
Re: [PATCH v2] Revert "Staging : lustre: Struct file_operations should be const"
On Sun, Aug 02, 2015 at 11:04:22PM +0530, Shraddha Barke wrote:
Your subject says 'Revert "Staging : lustre: Struct file_operations should be const"'. This patch reverts which commit?
Quoted 18 lines
Declare the
file_operationsstructurell_file_operationsas const, as done elsewhere in the kernel, as there are no modifications to its fields.Problem found using checkpatch.
Signed-off-by Shraddha Barke <[email protected]>---
Changes in v2:
- Make the commit message more clearer.drivers/staging/lustre/lustre/llite/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/lustre/lustre/llite/file.c +0
-0
drivers/staging/lustre/lustre/llite/file.c int ll_inode_permission(struct inode *inode, int mask) · line 3119
Quoted 5 lines
drivers/staging/lustre/lustre/llite/file.c +1
-1@@ -3116,7 +3116,7 @@ int ll_inode_permission(struct inode *inode, int mask) }/* -o localflock - only provides locally consistent flock locks */ -const struct file_operations ll_file_operations = { +struct file_operations ll_file_operations = {
Your commit message says "Declare the file_operations structure ll_file_operations as const" but your patch is removing the const.
regards
sudip