[PATCH] struct seq_operations and struct file_operations constification

- move some file_operations structs into the .rodata section

 - move static strings from policy_types[] array into the .rodata section

 - fix generic seq_operations usages, so that those structs may be defined
   as "const" as well

[akpm@osdl.org: couple of fixes]
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Helge Deller
2006-12-06 20:40:36 -08:00
committed by Linus Torvalds
parent 4a08a9f681
commit 15ad7cdcfd
25 changed files with 40 additions and 40 deletions
+2 -2
View File
@@ -1707,8 +1707,8 @@ void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new)
* Display pages allocated per node and memory policy via /proc.
*/
static const char *policy_types[] = { "default", "prefer", "bind",
"interleave" };
static const char * const policy_types[] =
{ "default", "prefer", "bind", "interleave" };
/*
* Convert a mempolicy into a string.
+1 -1
View File
@@ -83,7 +83,7 @@ int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1] = {
EXPORT_SYMBOL(totalram_pages);
static char *zone_names[MAX_NR_ZONES] = {
static char * const zone_names[MAX_NR_ZONES] = {
"DMA",
#ifdef CONFIG_ZONE_DMA32
"DMA32",
+2 -2
View File
@@ -177,7 +177,7 @@ static inline void shmem_unacct_blocks(unsigned long flags, long pages)
static struct super_operations shmem_ops;
static const struct address_space_operations shmem_aops;
static struct file_operations shmem_file_operations;
static const struct file_operations shmem_file_operations;
static struct inode_operations shmem_inode_operations;
static struct inode_operations shmem_dir_inode_operations;
static struct inode_operations shmem_special_inode_operations;
@@ -2319,7 +2319,7 @@ static const struct address_space_operations shmem_aops = {
.migratepage = migrate_page,
};
static struct file_operations shmem_file_operations = {
static const struct file_operations shmem_file_operations = {
.mmap = shmem_mmap,
#ifdef CONFIG_TMPFS
.llseek = generic_file_llseek,
+2 -2
View File
@@ -4142,7 +4142,7 @@ static int s_show(struct seq_file *m, void *p)
* + further values on SMP and with statistics enabled
*/
struct seq_operations slabinfo_op = {
const struct seq_operations slabinfo_op = {
.start = s_start,
.next = s_next,
.stop = s_stop,
@@ -4340,7 +4340,7 @@ static int leaks_show(struct seq_file *m, void *p)
return 0;
}
struct seq_operations slabstats_op = {
const struct seq_operations slabstats_op = {
.start = leaks_start,
.next = s_next,
.stop = s_stop,
+2 -2
View File
@@ -1368,7 +1368,7 @@ static int swap_show(struct seq_file *swap, void *v)
return 0;
}
static struct seq_operations swaps_op = {
static const struct seq_operations swaps_op = {
.start = swap_start,
.next = swap_next,
.stop = swap_stop,
@@ -1380,7 +1380,7 @@ static int swaps_open(struct inode *inode, struct file *file)
return seq_open(file, &swaps_op);
}
static struct file_operations proc_swaps_operations = {
static const struct file_operations proc_swaps_operations = {
.open = swaps_open,
.read = seq_read,
.llseek = seq_lseek,
+4 -4
View File
@@ -430,7 +430,7 @@ static int frag_show(struct seq_file *m, void *arg)
return 0;
}
struct seq_operations fragmentation_op = {
const struct seq_operations fragmentation_op = {
.start = frag_start,
.next = frag_next,
.stop = frag_stop,
@@ -452,7 +452,7 @@ struct seq_operations fragmentation_op = {
#define TEXTS_FOR_ZONES(xx) xx "_dma", TEXT_FOR_DMA32(xx) xx "_normal", \
TEXT_FOR_HIGHMEM(xx)
static char *vmstat_text[] = {
static const char * const vmstat_text[] = {
/* Zoned VM counters */
"nr_anon_pages",
"nr_mapped",
@@ -597,7 +597,7 @@ static int zoneinfo_show(struct seq_file *m, void *arg)
return 0;
}
struct seq_operations zoneinfo_op = {
const struct seq_operations zoneinfo_op = {
.start = frag_start, /* iterate over all zones. The same as in
* fragmentation. */
.next = frag_next,
@@ -660,7 +660,7 @@ static void vmstat_stop(struct seq_file *m, void *arg)
m->private = NULL;
}
struct seq_operations vmstat_op = {
const struct seq_operations vmstat_op = {
.start = vmstat_start,
.next = vmstat_next,
.stop = vmstat_stop,