[PATCH] fix for prune_icache()/forced final iput() races
[safe/jmp/linux-2.6] / include / linux / fs.h
index 4edba06..3622e95 100644 (file)
@@ -674,6 +674,7 @@ struct file_lock {
        struct lock_manager_operations *fl_lmops;       /* Callbacks for lockmanagers */
        union {
                struct nfs_lock_info    nfs_fl;
+               struct nfs4_lock_info   nfs4_fl;
        } fl_u;
 };
 
@@ -1024,6 +1025,7 @@ struct super_operations {
 #define I_FREEING              16
 #define I_CLEAR                        32
 #define I_NEW                  64
+#define I_WILL_FREE            128
 
 #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
 
@@ -1341,7 +1343,7 @@ extern int fs_may_remount_ro(struct super_block *);
 
 extern int check_disk_change(struct block_device *);
 extern int invalidate_inodes(struct super_block *);
-extern int __invalidate_device(struct block_device *, int);
+extern int __invalidate_device(struct block_device *);
 extern int invalidate_partition(struct gendisk *, int);
 unsigned long invalidate_mapping_pages(struct address_space *mapping,
                                        pgoff_t start, pgoff_t end);
@@ -1657,6 +1659,52 @@ static inline void simple_transaction_set(struct file *file, size_t n)
        ar->size = n;
 }
 
+/*
+ * simple attribute files
+ *
+ * These attributes behave similar to those in sysfs:
+ *
+ * Writing to an attribute immediately sets a value, an open file can be
+ * written to multiple times.
+ *
+ * Reading from an attribute creates a buffer from the value that might get
+ * read with multiple read calls. When the attribute has been read
+ * completely, no further read calls are possible until the file is opened
+ * again.
+ *
+ * All attributes contain a text representation of a numeric value
+ * that are accessed with the get() and set() functions.
+ */
+#define DEFINE_SIMPLE_ATTRIBUTE(__fops, __get, __set, __fmt)           \
+static int __fops ## _open(struct inode *inode, struct file *file)     \
+{                                                                      \
+       __simple_attr_check_format(__fmt, 0ull);                        \
+       return simple_attr_open(inode, file, __get, __set, __fmt);      \
+}                                                                      \
+static struct file_operations __fops = {                               \
+       .owner   = THIS_MODULE,                                         \
+       .open    = __fops ## _open,                                     \
+       .release = simple_attr_close,                                   \
+       .read    = simple_attr_read,                                    \
+       .write   = simple_attr_write,                                   \
+};
+
+static inline void __attribute__((format(printf, 1, 2)))
+__simple_attr_check_format(const char *fmt, ...)
+{
+       /* don't do anything, just let the compiler check the arguments; */
+}
+
+int simple_attr_open(struct inode *inode, struct file *file,
+                    u64 (*get)(void *), void (*set)(void *, u64),
+                    const char *fmt);
+int simple_attr_close(struct inode *inode, struct file *file);
+ssize_t simple_attr_read(struct file *file, char __user *buf,
+                        size_t len, loff_t *ppos);
+ssize_t simple_attr_write(struct file *file, const char __user *buf,
+                         size_t len, loff_t *ppos);
+
+
 #ifdef CONFIG_SECURITY
 static inline char *alloc_secdata(void)
 {