Skip to contentSkip to conversation

Make fs operations const

ANNOUNCE Matthew Wilcox 1 participant 1 message Oct 31, 2003 VFS

lore
Share & tools
lore
#0 lore raw

The 54k patch at http://ftp.linux.org.uk/pub/linux/willy/patches/fs-const.diff
makes many file_operations, dentry_operations, address_space_operations, inode_operations, super_operations and dquot_operations const.

This was inspired by intermezzo doing something naughty which the compiler didn't know to warn about. By making these pointers point to const structs, the compiler knows we shouldn't be doing that and will issue a warning.

As a bonus for the embedded people, this enables us to move more of the kernel into ROMmable sections. I've only done this for ext2 and a few well-known *_operations in this patch, but it could be done to many more filesystems. It only saves a few hundred bytes per filesystem, but it all adds up.

Signature · 3 lines
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk