Whamcloud - gitweb
refactor dual checksum support.
[fs/lustre-release.git] / lustre / include / liblustre.h
index 2e4968f..67f0066 100644 (file)
@@ -47,9 +47,6 @@
 #ifdef HAVE_SYS_IOCTL_H
 # include <sys/ioctl.h>
 #endif
-#ifndef _IOWR
-# include "ioctl.h"
-#endif
 
 #include <stdio.h>
 #include <sys/ioctl.h>
 #include <libcfs/list.h>
 #include <lnet/lnet.h>
 #include <libcfs/kp30.h>
+#include <libcfs/user-bitops.h>
+
+#ifndef _IOWR
+# include "ioctl.h"
+#endif
 
 /* definitions for liblustre */
 
@@ -105,7 +107,7 @@ typedef unsigned short umode_t;
 
 /* 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)
@@ -188,48 +190,19 @@ typedef int (write_proc_t)(struct file *file, const char *buffer,
  * to allow the compiler to adjust the bit shifting accordingly
  */
 
-/* test if bit nr is set in bitmap addr; returns previous value of bit nr */
-static __inline__ int set_bit(int nr, long * addr)
-{
-        long    mask;
-
-        addr += nr / BITS_PER_LONG;
-        mask = 1UL << (nr & (BITS_PER_LONG - 1));
-        nr = (mask & *addr) != 0;
-        *addr |= mask;
-        return nr;
-}
-
-/* clear bit nr in bitmap addr; returns previous value of bit nr*/
-static __inline__ int clear_bit(int nr, long * addr)
-{
-        long    mask;
-
-        addr += nr / BITS_PER_LONG;
-        mask = 1UL << (nr & (BITS_PER_LONG - 1));
-        nr = (mask & *addr) != 0;
-        *addr &= ~mask;
-        return nr;
-}
-
-static __inline__ int test_bit(int nr, const long * addr)
-{
-        return ((1UL << (nr & (BITS_PER_LONG - 1))) & ((addr)[nr / BITS_PER_LONG])) != 0;
-}
-
 static __inline__ int ext2_set_bit(int nr, void *addr)
 {
-        return set_bit(nr, (long*)addr);
+        return set_bit(nr, addr);
 }
 
 static __inline__ int ext2_clear_bit(int nr, void *addr)
 {
-        return clear_bit(nr, (long*)addr);
+        return clear_bit(nr, addr);
 }
 
 static __inline__ int ext2_test_bit(int nr, void *addr)
 {
-        return test_bit(nr, (long*)addr);
+        return test_bit(nr, addr);
 }
 
 /* modules */
@@ -483,6 +456,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;
@@ -724,6 +699,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)
@@ -731,7 +707,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_sub_return(n,a) ((a)->counter -= n)
+#define atomic_dec_return(a)  atomic_sub_return(1,a)
 
 #ifndef likely
 #define likely(exp) (exp)
@@ -801,9 +781,6 @@ typedef enum {
 cap_t   cap_get_proc(void);
 int     cap_get_flag(cap_t, cap_value_t, cap_flag_t, cap_flag_value_t *);
 
-/* log related */
-static inline int llog_init_commit_master(void) { return 0; }
-static inline int llog_cleanup_commit_master(int force) { return 0; }
 static inline void libcfs_run_lbug_upcall(char *file, const char *fn,
                                            const int l){}
 
@@ -944,6 +921,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