[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
@ -912,7 +912,7 @@ static int hung_up_tty_ioctl(struct inode * inode, struct file * file,
|
||||
return cmd == TIOCSPGRP ? -ENOTTY : -EIO;
|
||||
}
|
||||
|
||||
static struct file_operations tty_fops = {
|
||||
static const struct file_operations tty_fops = {
|
||||
.llseek = no_llseek,
|
||||
.read = tty_read,
|
||||
.write = tty_write,
|
||||
@ -924,7 +924,7 @@ static struct file_operations tty_fops = {
|
||||
};
|
||||
|
||||
#ifdef CONFIG_UNIX98_PTYS
|
||||
static struct file_operations ptmx_fops = {
|
||||
static const struct file_operations ptmx_fops = {
|
||||
.llseek = no_llseek,
|
||||
.read = tty_read,
|
||||
.write = tty_write,
|
||||
@ -936,7 +936,7 @@ static struct file_operations ptmx_fops = {
|
||||
};
|
||||
#endif
|
||||
|
||||
static struct file_operations console_fops = {
|
||||
static const struct file_operations console_fops = {
|
||||
.llseek = no_llseek,
|
||||
.read = tty_read,
|
||||
.write = redirected_tty_write,
|
||||
@ -947,7 +947,7 @@ static struct file_operations console_fops = {
|
||||
.fasync = tty_fasync,
|
||||
};
|
||||
|
||||
static struct file_operations hung_up_tty_fops = {
|
||||
static const struct file_operations hung_up_tty_fops = {
|
||||
.llseek = no_llseek,
|
||||
.read = hung_up_tty_read,
|
||||
.write = hung_up_tty_write,
|
||||
|
Reference in New Issue
Block a user