diff options
-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 */ |