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) |
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 *, | |||
1875 | (((fops) && try_module_get((fops)->owner) ? (fops) : NULL)) | 1875 | (((fops) && try_module_get((fops)->owner) ? (fops) : NULL)) |
1876 | #define fops_put(fops) \ | 1876 | #define fops_put(fops) \ |
1877 | do { if (fops) module_put((fops)->owner); } while(0) | 1877 | do { if (fops) module_put((fops)->owner); } while(0) |
1878 | /* | ||
1879 | * This one is to be used *ONLY* from ->open() instances. | ||
1880 | * fops must be non-NULL, pinned down *and* module dependencies | ||
1881 | * should be sufficient to pin the caller down as well. | ||
1882 | */ | ||
1883 | #define replace_fops(f, fops) \ | ||
1884 | do { \ | ||
1885 | struct file *__file = (f); \ | ||
1886 | fops_put(__file->f_op); \ | ||
1887 | BUG_ON(!(__file->f_op = (fops))); \ | ||
1888 | } while(0) | ||
1878 | 1889 | ||
1879 | extern int register_filesystem(struct file_system_type *); | 1890 | extern int register_filesystem(struct file_system_type *); |
1880 | extern int unregister_filesystem(struct file_system_type *); | 1891 | extern int unregister_filesystem(struct file_system_type *); |