Whamcloud - gitweb
- landed b_hd_cray_merge3
[fs/lustre-release.git] / lustre / include / linux / lustre_compat25.h
index db19c01..2adb2bd 100644 (file)
@@ -29,7 +29,7 @@
 #error sorry, lustre requires at least 2.5.69
 #endif
 
-#include <linux/portals_compat25.h>
+#include <libcfs/linux/portals_compat25.h>
 
 /*
  * groups_info related staff
@@ -63,7 +63,6 @@ int groups_search(struct group_info *ginfo, gid_t grp);
         } while (0)
 
 #define groups_sort(gi) do {} while (0)
-
 #define GROUP_AT(gi, i) ((gi)->small_block[(i)])
 
 static inline int cleanup_group_info(void)
@@ -99,6 +98,16 @@ static inline int cleanup_group_info(void)
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 
+/* New (actually old) intent naming */
+#define lookup_intent open_intent
+
+/* And internals */
+#define it_flags flags
+#define it_op op
+#define it_magic magic
+#define it_op_release op_release
+#define it_create_mode create_mode
+
 /*
  * OBD need working random driver, thus all our
  * initialization routines must be called after device
@@ -164,6 +173,10 @@ static inline void lustre_daemonize_helper(void)
                 page->private = 0; \
         } while(0)
 
+#ifndef smp_num_cpus
+#define smp_num_cpus    num_online_cpus()
+#endif
+
 #define kiobuf bio
 
 #include <linux/proc_fs.h>
@@ -247,7 +260,11 @@ static inline void cond_resched(void)
 
 static inline int mapping_mapped(struct address_space *mapping)
 {
-        return mapping->i_mmap_shared ? 1 : 0;
+        if (mapping->i_mmap_shared)
+                return 1;
+        if (mapping->i_mmap)
+                return 1;
+        return 0;
 }
 
 /* to find proc_dir_entry from inode. 2.6 has native one -bzzz */
@@ -317,6 +334,12 @@ static inline int mapping_has_pages(struct address_space *mapping)
 #define ll_vfs_symlink(dir, dentry, path, mode) vfs_symlink(dir, dentry, path, mode)
 #endif
 
+#ifndef container_of
+#define container_of(ptr, type, member) ({                      \
+                const typeof( ((type *)0)->member ) *__mptr = (ptr); \
+                (type *)( (char *)__mptr - offsetof(type,member) );})
+#endif
+
 #ifdef HAVE_I_ALLOC_SEM
 #define UP_WRITE_I_ALLOC_SEM(i) do { up_write(&(i)->i_alloc_sem); } while (0)
 #define DOWN_WRITE_I_ALLOC_SEM(i) do { down_write(&(i)->i_alloc_sem); } while(0)