Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / include / liblustre.h
index 1f99cbc..0fbd5bd 100644 (file)
@@ -65,6 +65,7 @@
 #include <assert.h>
 
 #include <libcfs/list.h>
+#include <libcfs/user-bitops.h>
 #include <lnet/lnet.h>
 #include <libcfs/kp30.h>
 
@@ -96,13 +97,16 @@ typedef unsigned short umode_t;
 #ifndef smp_processor_id
 #define smp_processor_id() 0
 #endif
-#ifndef smp_num_cpus
-#define smp_num_cpus 1
+#ifndef num_online_cpus
+#define num_online_cpus() 1
+#endif
+#ifndef num_possible_cpus
+#define num_possible_cpus() 1
 #endif
 
 /* always adopt 2.5 definitions */
 #define KERNEL_VERSION(a,b,c) ((a)*100+(b)*10+c)
-#define LINUX_VERSION_CODE KERNEL_VERSION(2,5,0)
+#define LINUX_VERSION_CODE KERNEL_VERSION(2,6,5)
 
 #ifndef page_private
 #define page_private(page) ((page)->private)
@@ -423,8 +427,10 @@ static inline cfs_page_t *alloc_pages(int mask, unsigned long order)
         }
         return pg;
 }
+#define cfs_alloc_pages(mask, order)  alloc_pages((mask), (order))
 
-#define alloc_page(mask) alloc_pages((mask), 0)
+#define alloc_page(mask)      alloc_pages((mask), 0)
+#define cfs_alloc_page(mask)  alloc_page(mask)
 
 static inline void __free_pages(cfs_page_t *pg, int what)
 {
@@ -435,9 +441,11 @@ static inline void __free_pages(cfs_page_t *pg, int what)
 #endif
         free(pg);
 }
+#define __cfs_free_pages(pg, order)  __free_pages((pg), (order))
 
 #define __free_page(page) __free_pages((page), 0)
 #define free_page(page) __free_page(page)
+#define __cfs_free_page(page)  __cfs_free_pages((page), 0)
 
 static inline cfs_page_t* __grab_cache_page(unsigned long index)
 {
@@ -476,6 +484,8 @@ static inline cfs_page_t* __grab_cache_page(unsigned long index)
 #define ATTR_FROM_OPEN  0x1000  /* called from open path, ie O_TRUNC */
 #define ATTR_CTIME_SET  0x2000
 #define ATTR_BLOCKS     0x4000
+#define ATTR_KILL_SUID  0
+#define ATTR_KILL_SGID  0
 
 struct iattr {
         unsigned int    ia_valid;
@@ -717,6 +727,7 @@ static inline void del_timer(struct timer_list *l)
 typedef struct { volatile int counter; } atomic_t;
 
 #define ATOMIC_INIT(i) { (i) }
+
 #define atomic_read(a) ((a)->counter)
 #define atomic_set(a,b) do {(a)->counter = b; } while (0)
 #define atomic_dec_and_test(a) ((--((a)->counter)) == 0)
@@ -724,8 +735,11 @@ typedef struct { volatile int counter; } atomic_t;
 #define atomic_inc(a)  (((a)->counter)++)
 #define atomic_dec(a)  do { (a)->counter--; } while (0)
 #define atomic_add(b,a)  do {(a)->counter += b;} while (0)
+#define atomic_add_return(n,a) ((a)->counter = n)
+#define atomic_inc_return(a) atomic_add_return(1,a)
 #define atomic_sub(b,a)  do {(a)->counter -= b;} while (0)
-#define ATOMIC_INIT(i) { i }
+#define atomic_sub_return(n,a) ((a)->counter -= n)
+#define atomic_dec_return(a)  atomic_sub_return(1,a)
 
 #ifndef likely
 #define likely(exp) (exp)
@@ -938,6 +952,21 @@ void posix_acl_release(struct posix_acl *acl)
 {
 }
 
+#ifdef LIBLUSTRE_POSIX_ACL
+# ifndef posix_acl_xattr_entry 
+#  define posix_acl_xattr_entry xattr_acl_entry
+# endif
+# ifndef posix_acl_xattr_header 
+#  define posix_acl_xattr_header xattr_acl_header
+# endif
+# ifndef posix_acl_xattr_size
+#  define posix_acl_xattr_size(entry) xattr_acl_size(entry)
+# endif
+# ifndef CONFIG_FS_POSIX_ACL
+#  define CONFIG_FS_POSIX_ACL 1
+# endif
+#endif
+
 #ifndef ENOTSUPP
 #define ENOTSUPP ENOTSUP
 #endif