Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fat: constify fatent_operations structures

The fatent_operations structures are never modified, so declare them as
const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Julia Lawall and committed by
Linus Torvalds
8992de4c 28016128

+13 -13
+1 -1
fs/fat/fat.h
··· 87 87 unsigned int vol_id; /*volume ID*/ 88 88 89 89 int fatent_shift; 90 - struct fatent_operations *fatent_ops; 90 + const struct fatent_operations *fatent_ops; 91 91 struct inode *fat_inode; 92 92 struct inode *fsinfo_inode; 93 93
+12 -12
fs/fat/fatent.c
··· 99 99 static int fat_ent_bread(struct super_block *sb, struct fat_entry *fatent, 100 100 int offset, sector_t blocknr) 101 101 { 102 - struct fatent_operations *ops = MSDOS_SB(sb)->fatent_ops; 102 + const struct fatent_operations *ops = MSDOS_SB(sb)->fatent_ops; 103 103 104 104 WARN_ON(blocknr < MSDOS_SB(sb)->fat_start); 105 105 fatent->fat_inode = MSDOS_SB(sb)->fat_inode; ··· 246 246 return 0; 247 247 } 248 248 249 - static struct fatent_operations fat12_ops = { 249 + static const struct fatent_operations fat12_ops = { 250 250 .ent_blocknr = fat12_ent_blocknr, 251 251 .ent_set_ptr = fat12_ent_set_ptr, 252 252 .ent_bread = fat12_ent_bread, ··· 255 255 .ent_next = fat12_ent_next, 256 256 }; 257 257 258 - static struct fatent_operations fat16_ops = { 258 + static const struct fatent_operations fat16_ops = { 259 259 .ent_blocknr = fat_ent_blocknr, 260 260 .ent_set_ptr = fat16_ent_set_ptr, 261 261 .ent_bread = fat_ent_bread, ··· 264 264 .ent_next = fat16_ent_next, 265 265 }; 266 266 267 - static struct fatent_operations fat32_ops = { 267 + static const struct fatent_operations fat32_ops = { 268 268 .ent_blocknr = fat_ent_blocknr, 269 269 .ent_set_ptr = fat32_ent_set_ptr, 270 270 .ent_bread = fat_ent_bread, ··· 320 320 int offset, sector_t blocknr) 321 321 { 322 322 struct msdos_sb_info *sbi = MSDOS_SB(sb); 323 - struct fatent_operations *ops = sbi->fatent_ops; 323 + const struct fatent_operations *ops = sbi->fatent_ops; 324 324 struct buffer_head **bhs = fatent->bhs; 325 325 326 326 /* Is this fatent's blocks including this entry? */ ··· 349 349 { 350 350 struct super_block *sb = inode->i_sb; 351 351 struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); 352 - struct fatent_operations *ops = sbi->fatent_ops; 352 + const struct fatent_operations *ops = sbi->fatent_ops; 353 353 int err, offset; 354 354 sector_t blocknr; 355 355 ··· 407 407 int new, int wait) 408 408 { 409 409 struct super_block *sb = inode->i_sb; 410 - struct fatent_operations *ops = MSDOS_SB(sb)->fatent_ops; 410 + const struct fatent_operations *ops = MSDOS_SB(sb)->fatent_ops; 411 411 int err; 412 412 413 413 ops->ent_put(fatent, new); ··· 432 432 static inline int fat_ent_read_block(struct super_block *sb, 433 433 struct fat_entry *fatent) 434 434 { 435 - struct fatent_operations *ops = MSDOS_SB(sb)->fatent_ops; 435 + const struct fatent_operations *ops = MSDOS_SB(sb)->fatent_ops; 436 436 sector_t blocknr; 437 437 int offset; 438 438 ··· 463 463 { 464 464 struct super_block *sb = inode->i_sb; 465 465 struct msdos_sb_info *sbi = MSDOS_SB(sb); 466 - struct fatent_operations *ops = sbi->fatent_ops; 466 + const struct fatent_operations *ops = sbi->fatent_ops; 467 467 struct fat_entry fatent, prev_ent; 468 468 struct buffer_head *bhs[MAX_BUF_PER_PAGE]; 469 469 int i, count, err, nr_bhs, idx_clus; ··· 551 551 { 552 552 struct super_block *sb = inode->i_sb; 553 553 struct msdos_sb_info *sbi = MSDOS_SB(sb); 554 - struct fatent_operations *ops = sbi->fatent_ops; 554 + const struct fatent_operations *ops = sbi->fatent_ops; 555 555 struct fat_entry fatent; 556 556 struct buffer_head *bhs[MAX_BUF_PER_PAGE]; 557 557 int i, err, nr_bhs; ··· 636 636 static void fat_ent_reada(struct super_block *sb, struct fat_entry *fatent, 637 637 unsigned long reada_blocks) 638 638 { 639 - struct fatent_operations *ops = MSDOS_SB(sb)->fatent_ops; 639 + const struct fatent_operations *ops = MSDOS_SB(sb)->fatent_ops; 640 640 sector_t blocknr; 641 641 int i, offset; 642 642 ··· 649 649 int fat_count_free_clusters(struct super_block *sb) 650 650 { 651 651 struct msdos_sb_info *sbi = MSDOS_SB(sb); 652 - struct fatent_operations *ops = sbi->fatent_ops; 652 + const struct fatent_operations *ops = sbi->fatent_ops; 653 653 struct fat_entry fatent; 654 654 unsigned long reada_blocks, reada_mask, cur_block; 655 655 int err = 0, free;