[PATCH] make more file_operation structs static
Mark the static struct file_operations in drivers/char as const. Making them const prevents accidental bugs, and moves them to the .rodata section so that they no longer do any false sharing; in addition with the proper debug option they are then protected against corruption.. [akpm@osdl.org: build fix] Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:

committed by
Linus Torvalds

parent
d459ec0baa
commit
62322d2554
@@ -30,7 +30,7 @@ struct raw_device_data {
|
||||
static struct class *raw_class;
|
||||
static struct raw_device_data raw_devices[MAX_RAW_MINORS];
|
||||
static DEFINE_MUTEX(raw_mutex);
|
||||
static struct file_operations raw_ctl_fops; /* forward declaration */
|
||||
static const struct file_operations raw_ctl_fops; /* forward declaration */
|
||||
|
||||
/*
|
||||
* Open/close code for raw IO.
|
||||
@@ -261,7 +261,7 @@ static ssize_t raw_file_aio_write(struct kiocb *iocb, const char __user *buf,
|
||||
}
|
||||
|
||||
|
||||
static struct file_operations raw_fops = {
|
||||
static const struct file_operations raw_fops = {
|
||||
.read = generic_file_read,
|
||||
.aio_read = generic_file_aio_read,
|
||||
.write = raw_file_write,
|
||||
@@ -274,7 +274,7 @@ static struct file_operations raw_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static struct file_operations raw_ctl_fops = {
|
||||
static const struct file_operations raw_ctl_fops = {
|
||||
.ioctl = raw_ctl_ioctl,
|
||||
.open = raw_open,
|
||||
.owner = THIS_MODULE,
|
||||
|
Reference in New Issue
Block a user