Whamcloud - gitweb
b=16776
[fs/lustre-release.git] / lustre / include / linux / lustre_compat25.h
index 7bd28db..b6c1496 100644 (file)
@@ -16,8 +16,8 @@
  * in the LICENSE file that accompanied this code).
  *
  * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see [sun.com URL with a
- * copy of GPLv2].
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
  *
  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  * CA 95054 USA or visit www.sun.com if you need additional information or
@@ -255,7 +255,13 @@ static inline int mapping_has_pages(struct address_space *mapping)
                 dentry->d_flags |= flags; \
                 spin_unlock(&dentry->d_lock); \
         } while(0)
-#define ll_vfs_symlink(dir, dentry, path, mode) vfs_symlink(dir, dentry, path, mode)
+#ifdef HAVE_SECURITY_PLUG
+#define ll_vfs_symlink(dir, dentry, mnt, path, mode) \
+                vfs_symlink(dir, dentry, mnt, path, mode)
+#else
+#define ll_vfs_symlink(dir, dentry, mnt, path, mode) \
+                vfs_symlink(dir, dentry, path, mode)
+#endif
 #endif
 
 #ifndef container_of
@@ -398,18 +404,6 @@ int ll_unregister_blkdev(unsigned int dev, const char *name)
 #define ll_inode_blksize(a)     (1<<(a)->i_blkbits)
 #endif
 
-#ifndef HAVE_EXPORT_NR_FREE_BUFFER_PAGES
-static inline unsigned int ll_nr_free_buffer_pages(void)
-{
-        struct sysinfo si;
-
-        si_meminfo(&si);
-        return (unsigned int)(si.freeram - si.freehigh);
-}
-#else
-#define ll_nr_free_buffer_pages()      nr_free_buffer_pages()
-#endif
-
 #ifdef HAVE_FS_RENAME_DOES_D_MOVE
 #define LL_RENAME_DOES_D_MOVE  FS_RENAME_DOES_D_MOVE
 #else
@@ -572,5 +566,66 @@ static inline int ll_crypto_hmac(struct crypto_tfm *tfm,
 #define ll_crypto_free_blkcipher(tfm)   crypto_free_tfm(tfm)
 #endif /* HAVE_ASYNC_BLOCK_CIPHER */
 
+#ifdef HAVE_SECURITY_PLUG
+#define ll_remove_suid(inode,mnt)               remove_suid(inode,mnt)
+#define ll_vfs_rmdir(dir,entry,mnt)             vfs_rmdir(dir,entry,mnt)
+#define ll_vfs_mkdir(inode,dir,mnt,mode)        vfs_mkdir(inode,dir,mnt,mode)
+#define ll_vfs_link(old,mnt,dir,new,mnt1)       vfs_link(old,mnt,dir,new,mnt1)
+#define ll_vfs_unlink(inode,entry,mnt)          vfs_unlink(inode,entry,mnt)
+#define ll_vfs_mknod(dir,entry,mnt,mode,dev)            \
+                vfs_mknod(dir,entry,mnt,mode,dev)
+#define ll_security_inode_unlink(dir,entry,mnt)         \
+                security_inode_unlink(dir,entry,mnt)     
+#define ll_vfs_rename(old,old_dir,mnt,new,new_dir,mnt1) \
+                vfs_rename(old,old_dir,mnt,new,new_dir,mnt1)
+#else
+#define ll_remove_suid(inode,mnt)               remove_suid(inode)
+#define ll_vfs_rmdir(dir,entry,mnt)             vfs_rmdir(dir,entry)
+#define ll_vfs_mkdir(inode,dir,mnt,mode)        vfs_mkdir(inode,dir,mode)
+#define ll_vfs_link(old,mnt,dir,new,mnt1)       vfs_link(old,dir,new)
+#define ll_vfs_unlink(inode,entry,mnt)          vfs_unlink(inode,entry)
+#define ll_vfs_mknod(dir,entry,mnt,mode,dev)    vfs_mknod(dir,entry,mode,dev)
+#define ll_security_inode_unlink(dir,entry,mnt) security_inode_unlink(dir,entry)     
+#define ll_vfs_rename(old,old_dir,mnt,new,new_dir,mnt1) \
+                vfs_rename(old,old_dir,new,new_dir)
+#endif
+
+#ifndef get_cpu
+#ifdef CONFIG_PREEMPT
+#define get_cpu()       ({ preempt_disable(); smp_processor_id(); })
+#define put_cpu()       preempt_enable()
+#else
+#define get_cpu()       smp_processor_id()
+#define put_cpu()
+#endif
+#endif /* get_cpu & put_cpu */
+
+#ifndef for_each_possible_cpu
+#define for_each_possible_cpu(i) for_each_cpu(i)
+#endif
+
+#ifndef cpu_to_node
+#define cpu_to_node(cpu)         0
+#endif
+
+#ifndef abs
+static inline int abs(int x)
+{
+        return (x < 0) ? -x : x;
+}
+#endif
+
+#ifndef labs
+static inline long labs(long x)
+{
+        return (x < 0) ? -x : x;
+}
+#endif
+
+/* Using kernel fls(). Userspace will use one defined in user-bitops.h. */
+#ifndef __fls
+#define __fls fls
+#endif
+
 #endif /* __KERNEL__ */
 #endif /* _COMPAT25_H */