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

[PATCH] shmem and simple const super_operations

shmem's super_operations were missed from the recent const-ification;
and simple_fill_super()'s, which can share with get_sb_pseudo()'s.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Acked-by: Josef 'Jeff' Sipek <jsipek@cs.sunysb.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Hugh Dickins and committed by
Linus Torvalds
759b9775 cc2cccae

+8 -6
+6 -4
fs/libfs.c
··· 190 190 .lookup = simple_lookup, 191 191 }; 192 192 193 + static const struct super_operations simple_super_operations = { 194 + .statfs = simple_statfs, 195 + }; 196 + 193 197 /* 194 198 * Common helper for pseudo-filesystems (sockfs, pipefs, bdev - stuff that 195 199 * will never be mountable) ··· 203 199 struct vfsmount *mnt) 204 200 { 205 201 struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL); 206 - static const struct super_operations default_ops = {.statfs = simple_statfs}; 207 202 struct dentry *dentry; 208 203 struct inode *root; 209 204 struct qstr d_name = {.name = name, .len = strlen(name)}; ··· 215 212 s->s_blocksize = 1024; 216 213 s->s_blocksize_bits = 10; 217 214 s->s_magic = magic; 218 - s->s_op = ops ? ops : &default_ops; 215 + s->s_op = ops ? ops : &simple_super_operations; 219 216 s->s_time_gran = 1; 220 217 root = new_inode(s); 221 218 if (!root) ··· 362 359 363 360 int simple_fill_super(struct super_block *s, int magic, struct tree_descr *files) 364 361 { 365 - static struct super_operations s_ops = {.statfs = simple_statfs}; 366 362 struct inode *inode; 367 363 struct dentry *root; 368 364 struct dentry *dentry; ··· 370 368 s->s_blocksize = PAGE_CACHE_SIZE; 371 369 s->s_blocksize_bits = PAGE_CACHE_SHIFT; 372 370 s->s_magic = magic; 373 - s->s_op = &s_ops; 371 + s->s_op = &simple_super_operations; 374 372 s->s_time_gran = 1; 375 373 376 374 inode = new_inode(s);
+2 -2
mm/shmem.c
··· 175 175 vm_unacct_memory(pages * VM_ACCT(PAGE_CACHE_SIZE)); 176 176 } 177 177 178 - static struct super_operations shmem_ops; 178 + static const struct super_operations shmem_ops; 179 179 static const struct address_space_operations shmem_aops; 180 180 static const struct file_operations shmem_file_operations; 181 181 static const struct inode_operations shmem_inode_operations; ··· 2383 2383 #endif 2384 2384 }; 2385 2385 2386 - static struct super_operations shmem_ops = { 2386 + static const struct super_operations shmem_ops = { 2387 2387 .alloc_inode = shmem_alloc_inode, 2388 2388 .destroy_inode = shmem_destroy_inode, 2389 2389 #ifdef CONFIG_TMPFS