[PATCH] fs.h: introduce functions to get/set file->private_data

H Hartley Sweeten
2010-08-16T18:38:34Z

The symbol 'private_data' is commonly used and makes grep'ing for
specific uses difficult. Introduce the wrapper functions file_get_privdata
and file_set_privdata to help with the struct file uses.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Matthew Wilcox <matthew@wil.cx>

---

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 9a96b4d..b357a17 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -961,6 +961,16 @@ extern spinlock_t files_lock;
#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1)
#define file_count(x) atomic_long_read(&(x)->f_count)

+static inline void *file_get_privdata(struct file *file)
+{
+ return file->private_data;
+}
+
+static inline void file_set_privdata(struct file *file, void *data)
+{
+ file->private_data = data;
+}
+
#ifdef CONFIG_DEBUG_WRITECOUNT
static inline void file_take_write(struct file *f)
{