Whamcloud - gitweb
b=16776
[fs/lustre-release.git] / lustre / include / linux / lustre_compat25.h
index af535d2..b6c1496 100644 (file)
@@ -1,23 +1,37 @@
 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
  * vim:expandtab:shiftwidth=8:tabstop=8:
  *
- *  Copyright (c) 2003 Cluster File Systems, Inc.
+ * GPL HEADER START
  *
- *   This file is part of Lustre, http://www.lustre.org.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
  *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
  *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU General Public License
+ * 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
+ * have any questions.
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Use is subject to license terms.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
  */
 
 #ifndef _LINUX_COMPAT25_H
@@ -241,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
@@ -384,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
@@ -558,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 */