diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2013-11-12 23:42:47 +0100 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2013-11-12 23:44:24 +0100 |
commit | 52d1e1f342b07696210075a90ccf537edbfb1bcb (patch) | |
tree | 88e92e34cabfbb1f8e7ce5a896691a647789f289 | |
parent | 20cf32af0451364100557d47fb0c524b421b67f4 (diff) |
backports: add replace_fops()
This is needed by drivers/media/dvb-core/dvbdev.c and was added in:
commit e84f9e57b90ca89664d733a7cef19aa7ccd832f3
Author: Al Viro <viro@zeniv.linux.org.uk>
Date: Sun Sep 22 14:17:15 2013 -0400
consolidate the reassignments of ->f_op in ->open() instances
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r-- | backport/backport-include/linux/fs.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/backport/backport-include/linux/fs.h b/backport/backport-include/linux/fs.h index 9de51097..9874f815 100644 --- a/backport/backport-include/linux/fs.h +++ b/backport/backport-include/linux/fs.h @@ -38,4 +38,18 @@ extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos, const void __user *from, size_t count); #endif +#ifndef replace_fops +/* + * 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) +#endif /* replace_fops */ + #endif /* _COMPAT_LINUX_FS_H */ |