Whamcloud - gitweb
LU-3963 libcfs: cleanup list operations
[fs/lustre-release.git] / libcfs / include / libcfs / linux / kp30.h
index 6319efa..e57f10c 100644 (file)
 
 #include <libcfs/linux/portals_compat25.h>
 
-#ifdef HAVE_3ARGS_INIT_WORK
-
-#define prepare_work(wq,cb,cbdata)                                            \
-do {                                                                          \
-        INIT_WORK((wq), (void *)(cb), (void *)(cbdata));                      \
-} while (0)
-
-#define cfs_get_work_data(type,field,data)   (data)
-
-#else
-
-#define prepare_work(wq,cb,cbdata)                                            \
-do {                                                                          \
-        INIT_WORK((wq), (void *)(cb));                                        \
-} while (0)
-
-#define cfs_get_work_data(type,field,data) container_of(data,type,field)
-
-#endif
-
-#define cfs_num_online_cpus() num_online_cpus()
-#define wait_on_page wait_on_page_locked
-#define our_recalc_sigpending(current) recalc_sigpending()
-#define strtok(a,b) strpbrk(a, b)
-#define work_struct_t      struct work_struct
-
-#ifdef CONFIG_SMP
-#define LASSERT_SPIN_LOCKED(lock) LASSERT(spin_is_locked(lock))
-#define LINVRNT_SPIN_LOCKED(lock) LINVRNT(spin_is_locked(lock))
-#else
-#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))
-#else
-#define SEM_COUNT(sem)          ((sem)->count)
-#endif
-
-#define LIBCFS_PANIC(msg)            panic(msg)
-
-/* ------------------------------------------------------------------- */
-
-#define PORTAL_SYMBOL_REGISTER(x)
-#define PORTAL_SYMBOL_UNREGISTER(x)
-
-#define PORTAL_SYMBOL_GET(x) symbol_get(x)
-#define PORTAL_SYMBOL_PUT(x) symbol_put(x)
-
-#define PORTAL_MODULE_USE       try_module_get(THIS_MODULE)
-#define PORTAL_MODULE_UNUSE     module_put(THIS_MODULE)
-
-
 /******************************************************************************/
 /* Module parameter support */
 #define CFS_MODULE_PARM(name, t, type, perm, desc) \
@@ -156,9 +99,6 @@ do {                                                                          \
 # define printf(format, b...) CDEBUG(D_OTHER, format , ## b)
 # define time(a) CURRENT_TIME
 
-# define cfs_num_possible_cpus() num_possible_cpus()
-# define cfs_num_present_cpus()  num_present_cpus()
-
 /******************************************************************************/
 /* Light-weight trace
  * Support for temporary event tracing with minimal Heisenberg effect. */
@@ -197,9 +137,9 @@ typedef struct {
 #  if !KLWT_SUPPORT
 
 typedef struct _lwt_page {
-        cfs_list_t               lwtp_list;
-        struct page             *lwtp_page;
-        lwt_event_t             *lwtp_events;
+       struct list_head        lwtp_list;
+       struct page             *lwtp_page;
+       lwt_event_t             *lwtp_events;
 } lwt_page_t;
 
 typedef struct {
@@ -216,7 +156,7 @@ extern lwt_cpu_t lwt_cpus[];
 
 #define LWTSTR(n)       #n
 #define LWTWHERE(f,l)   f ":" LWTSTR(l)
-#define LWT_EVENTS_PER_PAGE (CFS_PAGE_SIZE / sizeof (lwt_event_t))
+#define LWT_EVENTS_PER_PAGE (PAGE_CACHE_SIZE / sizeof(lwt_event_t))
 
 #define LWT_EVENT(p1, p2, p3, p4)                                       \
 do {                                                                    \
@@ -232,12 +172,12 @@ do {                                                                    \
                 p = cpu->lwtc_current_page;                             \
                 e = &p->lwtp_events[cpu->lwtc_current_index++];         \
                                                                         \
-                if (cpu->lwtc_current_index >= LWT_EVENTS_PER_PAGE) {   \
-                        cpu->lwtc_current_page =                        \
-                                cfs_list_entry (p->lwtp_list.next,      \
-                                                lwt_page_t, lwtp_list); \
-                        cpu->lwtc_current_index = 0;                    \
-                }                                                       \
+               if (cpu->lwtc_current_index >= LWT_EVENTS_PER_PAGE) {   \
+                       cpu->lwtc_current_page =                        \
+                               list_entry (p->lwtp_list.next,          \
+                                               lwt_page_t, lwtp_list); \
+                       cpu->lwtc_current_index = 0;                    \
+               }                                                       \
                                                                         \
                 e->lwte_when  = get_cycles();                           \
                 e->lwte_where = LWTWHERE(__FILE__,__LINE__);            \
@@ -328,43 +268,12 @@ extern int  lwt_snapshot (cfs_cycles_t *now, int *ncpu, int *total_size,
 
 #undef _LWORDSIZE
 
-/* compat macroses */
-#ifndef HAVE_SCATTERLIST_SETPAGE
-static inline void sg_set_page(struct scatterlist *sg, struct page *page,
-                               unsigned int len, unsigned int offset)
-{
-        sg->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()
-
-#ifndef get_cpu
-# ifdef CONFIG_PREEMPT
-#  define cfs_get_cpu()  ({ preempt_disable(); smp_processor_id(); })
-#  define cfs_put_cpu()  preempt_enable()
-# else
-#  define cfs_get_cpu()  smp_processor_id()
-#  define cfs_put_cpu()
-# endif
-#else
-# define cfs_get_cpu()   get_cpu()
-# 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,
+#define INIT_CTL_NAME  .ctl_name = CTL_UNNUMBERED,
+#define INIT_STRATEGY  .strategy = &sysctl_intvec,
 #else
-#define INIT_CTL_NAME(a)
-#define INIT_STRATEGY(a)
+#define INIT_CTL_NAME
+#define INIT_STRATEGY
 #endif
 
 #endif