Whamcloud - gitweb
LU-2221 ptlrpc: kerberos support for kernel>=2.6.24
[fs/lustre-release.git] / libcfs / include / libcfs / linux / kp30.h
index 71d88c3..205fdfd 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,6 +26,8 @@
 /*
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2011, 2012, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -38,9 +38,6 @@
 #define __LIBCFS_LINUX_KP30_H__
 
 
-#ifndef AUTOCONF_INCLUDED
-# include <linux/config.h>
-#endif
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/string.h>
@@ -48,7 +45,6 @@
 #include <linux/init.h>
 #include <linux/errno.h>
 #include <linux/unistd.h>
-#include <asm/system.h>
 #include <linux/kmod.h>
 #include <linux/notifier.h>
 #include <linux/fs.h>
@@ -60,7 +56,6 @@
 #include <linux/highmem.h>
 #include <linux/module.h>
 #include <linux/version.h>
-#include <linux/smp_lock.h>
 #include <asm/atomic.h>
 #include <asm/uaccess.h>
 #include <linux/rwsem.h>
@@ -111,7 +106,9 @@ do {                                                                          \
 #define LASSERT_SPIN_LOCKED(lock) do {(void)sizeof(lock);} while(0)
 #define LINVRNT_SPIN_LOCKED(lock) do {(void)sizeof(lock);} while(0)
 #endif
+
 #define LASSERT_SEM_LOCKED(sem) LASSERT(down_trylock(sem) != 0)
+#define LASSERT_MUTEX_LOCKED(x) LASSERT(mutex_is_locked(x))
 
 #ifdef HAVE_SEM_COUNT_ATOMIC
 #define SEM_COUNT(sem)          (atomic_read(&(sem)->count))
@@ -159,11 +156,8 @@ do {                                                                          \
 # define printf(format, b...) CDEBUG(D_OTHER, format , ## b)
 # define time(a) CURRENT_TIME
 
-#ifndef num_possible_cpus
-#define cfs_num_possible_cpus() NR_CPUS
-#else
-#define cfs_num_possible_cpus() num_possible_cpus()
-#endif
+# define cfs_num_possible_cpus() num_possible_cpus()
+# define cfs_num_present_cpus()  num_present_cpus()
 
 /******************************************************************************/
 /* Light-weight trace
@@ -301,16 +295,18 @@ extern int  lwt_snapshot (cfs_cycles_t *now, int *ncpu, int *total_size,
 
 #if (defined(__KERNEL__) && defined(HAVE_KERN__U64_LONG_LONG)) || \
     (!defined(__KERNEL__) && defined(HAVE_USER__U64_LONG_LONG))
-# define LPU64 "%Lu"
-# define LPD64 "%Ld"
-# define LPX64 "%#Lx"
-# define LPX64i "%Lx"
+# define LPU64 "%llu"
+# define LPD64 "%lld"
+# define LPX64 "%#llx"
+# define LPX64i "%llx"
+# define LPO64 "%#llo"
 # define LPF64 "L"
 #else
 # define LPU64 "%lu"
 # define LPD64 "%ld"
 # define LPX64 "%#lx"
 # define LPX64i "%lx"
+# define LPO64 "%#lo"
 # define LPF64 "l"
 #endif
 
@@ -341,6 +337,11 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page,
         sg->offset = offset;
         sg->length = len;
 }
+
+static inline void sg_assign_page(struct scatterlist *sg, struct page *page)
+{
+       sg->page = page;
+}
 #endif
 
 #define cfs_smp_processor_id()  smp_processor_id()
@@ -358,4 +359,12 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page,
 # define cfs_put_cpu()   put_cpu()
 #endif /* get_cpu & put_cpu */
 
+#ifdef HAVE_SYSCTL_CTLNAME
+#define INIT_CTL_NAME(a) .ctl_name = a,
+#define INIT_STRATEGY(a) .strategy = a,
+#else
+#define INIT_CTL_NAME(a)
+#define INIT_STRATEGY(a)
+#endif
+
 #endif