fsnotify: Retrieve super block from the data field
[sfrench/cifs-2.6.git] / include / linux / fsnotify_backend.h
index b323d0c4b9671f1dbafe9e4fb25730940740b41f..035438fe4a435e849b4cdfd000307af0b065971b 100644 (file)
@@ -289,6 +289,21 @@ static inline const struct path *fsnotify_data_path(const void *data,
        }
 }
 
+static inline struct super_block *fsnotify_data_sb(const void *data,
+                                                  int data_type)
+{
+       switch (data_type) {
+       case FSNOTIFY_EVENT_INODE:
+               return ((struct inode *)data)->i_sb;
+       case FSNOTIFY_EVENT_DENTRY:
+               return ((struct dentry *)data)->d_sb;
+       case FSNOTIFY_EVENT_PATH:
+               return ((const struct path *)data)->dentry->d_sb;
+       default:
+               return NULL;
+       }
+}
+
 enum fsnotify_obj_type {
        FSNOTIFY_OBJ_TYPE_INODE,
        FSNOTIFY_OBJ_TYPE_PARENT,