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_ops
address_space_operations
backlight_ops
block_device_operations
dma_map_ops
extent_io_ops
file_lock_operations
file_operations
hv_ops
intel_dvo_dev_ops
item_operations
iwl_ops
kgdb_arch
kgdb_io
kset_uevent_ops
lock_manager_operations
microcode_ops
mtrr_ops
* neigh_ops
nlmsvc_binding
pci_raw_ops
platform_hibernation_ops
platform_suspend_ops
snd_ac97_build_ops
sysfs_ops
usb_mon_operations
wd_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(-)
From: Emese Revfy <[email protected]>
Signed-off-by: Emese Revfy <[email protected]>
---
include/net/neighbour.h | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 0302f31..ac37ed6 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -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 {
--
1.6.5.3
From: Emese Revfy <[email protected]>
Signed-off-by: Emese Revfy <[email protected]>
---
fs/lockd/svc.c | 2 +-
fs/nfsd/lockd.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index e50cfa3..7d89e3e 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -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);
diff --git a/fs/nfsd/lockd.c b/fs/nfsd/lockd.c
index b2786a5..f717a27 100644
--- a/fs/nfsd/lockd.c
+++ b/fs/nfsd/lockd.c
@@ -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 */
};
--
1.6.5.3
From: Emese Revfy <[email protected]>
Signed-off-by: Emese Revfy <[email protected]>
---
include/linux/lockd/bind.h | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h
index fbc48f8..0886e57 100644
--- a/include/linux/lockd/bind.h
+++ b/include/linux/lockd/bind.h
@@ -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
--
1.6.5.3