diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-09-22 14:17:15 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-10-24 23:34:53 -0400 |
commit | e84f9e57b90ca89664d733a7cef19aa7ccd832f3 (patch) | |
tree | 2766cbae82e38a4356b161a7f48abfd9e4db56ce /include/linux/fs.h | |
parent | 7b00ed6fe6321547b9d51f5bfb30e7b5932e6889 (diff) | |
download | linux-stable-e84f9e57b90ca89664d733a7cef19aa7ccd832f3.tar.gz linux-stable-e84f9e57b90ca89664d733a7cef19aa7ccd832f3.tar.bz2 linux-stable-e84f9e57b90ca89664d733a7cef19aa7ccd832f3.zip |
consolidate the reassignments of ->f_op in ->open() instances
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index d80c2437d624..b09e4e1d747a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1875,6 +1875,17 @@ extern struct dentry *mount_pseudo(struct file_system_type *, char *, (((fops) && try_module_get((fops)->owner) ? (fops) : NULL)) #define fops_put(fops) \ do { if (fops) module_put((fops)->owner); } while(0) +/* + * This one is to be used *ONLY* from ->open() instances. + * fops must be non-NULL, pinned down *and* module dependencies + * should be sufficient to pin the caller down as well. + */ +#define replace_fops(f, fops) \ + do { \ + struct file *__file = (f); \ + fops_put(__file->f_op); \ + BUG_ON(!(__file->f_op = (fops))); \ + } while(0) extern int register_filesystem(struct file_system_type *); extern int unregister_filesystem(struct file_system_type *); |