Constify struct neigh_ops for 2.6.32-git-053fe57ac v2
Subsystems (4)
cover Constify struct neigh_ops for 2.6.32-git-053fe57ac v2
From: Emese Revfy <[email protected]>
Hello everyone!
The following patch series attempts to constify several structures that hold function pointers. This is only the initial batch, there are about over 150 candidate structures, some of which can be constified as well, I plan to submit them in the future.
The list of constified structures in this series (* marks this thread):acpi_dock_opsaddress_space_operationsbacklight_opsblock_device_operationsdma_map_opsextent_io_opsfile_lock_operationsfile_operationshv_opsintel_dvo_dev_opsitem_operationsiwl_opskgdb_archkgdb_iokset_uevent_opslock_manager_operationsmicrocode_opsmtrr_ops
* neigh_opsnlmsvc_bindingpci_raw_opsplatform_hibernation_opsplatform_suspend_opssnd_ac97_build_opssysfs_opsusb_mon_operationswd_ops
There are certain exceptions where a given instance of the structure cannot be const, they are marked with a comment in the patch.
The patches compile fine with an allyesconfig kernel on i386 and x86_64.
Please let me know if any of these structures should not be constified and any other issues you see with them.
Changelog:
----------
v1 -> v2
- updated to linus-git-053fe57
- extended comments with a reference to code that prevents constification
- split up patches by subsystem as suggested by Greg KH, Jiri Slaby
- added all Acked-by's received so far
- removed patch for super_operations for now
- removed patch for ptmx_fops
Thanks,
Emese
include/net/neighbour.h | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
PATCH 1/1 Constify struct neigh_ops for 2.6.32-git-053fe57ac v2
From: Emese Revfy <[email protected]>
--- include/net/neighbour.h | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
include/net/neighbour.h +6 -6
@@ -121,12 +121,12 @@ struct neighbour {struct neigh_ops {int family; -void (*solicit)(struct neighbour *,struct sk_buff *); -void (*error_report)(struct neighbour *,struct sk_buff *); -int (*output)(struct sk_buff *); -int (*connected_output)(struct sk_buff *); -int (*hh_output)(struct sk_buff *); -int (*queue_xmit)(struct sk_buff *); +void (*const solicit)(struct neighbour *,struct sk_buff *); +void (*const error_report)(struct neighbour *,struct sk_buff *); +int (*const output)(struct sk_buff *); +int (*const connected_output)(struct sk_buff *); +int (*const hh_output)(struct sk_buff *); +int (*const queue_xmit)(struct sk_buff *); };struct pneigh_entry {
Signature · 1 line
1.6.5.3
PATCH 1/2 Constify struct nlmsvc_binding for 2.6.32-git-053fe57ac v2
In reply to [email protected]From: Emese Revfy <[email protected]>
--- fs/lockd/svc.c | 2 +- fs/nfsd/lockd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/lockd/svc.c +1 -1
@@ -43,7 +43,7 @@static struct svc_program nlmsvc_program; -struct nlmsvc_binding * nlmsvc_ops; +const struct nlmsvc_binding * nlmsvc_ops;EXPORT_SYMBOL_GPL (nlmsvc_ops);static DEFINE_MUTEX (nlmsvc_mutex);
fs/nfsd/lockd.c +1 -1
@@ -67,7 +67,7 @@ nlm_fclose(struct file *filp)fput (filp); } -static struct nlmsvc_binding nfsd_nlm_ops = { +static const struct nlmsvc_binding nfsd_nlm_ops = { .fopen = nlm_fopen,/* open file for locking */ .fclose = nlm_fclose,/* close file */ };
Signature · 1 line
1.6.5.3
PATCH 2/2 Constify struct nlmsvc_binding for 2.6.32-git-053fe57ac v2
In reply to [email protected]From: Emese Revfy <[email protected]>
--- include/linux/lockd/bind.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
include/linux/lockd/bind.h +3 -3
@@ -23,13 +23,13 @@ struct svc_rqst;* This is the set of functions for lockd->nfsd communication */ struct nlmsvc_binding { -__be32 (*fopen)(struct svc_rqst *, +__be32 (*const fopen)(struct svc_rqst *,struct nfs_fh *,struct file **); -void (*fclose)(struct file *); +void (*const fclose)(struct file *); }; -extern struct nlmsvc_binding * nlmsvc_ops; +extern const struct nlmsvc_binding * nlmsvc_ops;/* * Similar to nfs_client_initdata, but without the NFS-specific
Signature · 1 line
1.6.5.3