Whamcloud - gitweb
LU-3963 libcfs: remove cfs_hash_long
[fs/lustre-release.git] / libcfs / include / libcfs / winnt / winnt-prim.h
index 998ca81..7d8147f 100644 (file)
@@ -26,6 +26,8 @@
 /*
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
 #error Do not #include this file directly. #include <libcfs/libcfs.h> instead
 #endif
 
+#ifndef EXPORT_SYMBOL
+# define EXPORT_SYMBOL(s)
+#endif
+
 /*
  * libcfs proc device object
  */
@@ -94,10 +100,10 @@ void cfs_enter_debugger(void);
 #define CFS_SYMBOL_LEN     64
 
 struct  cfs_symbol {
-       char       name[CFS_SYMBOL_LEN];
-       void      *value;
-       int        ref;
-       cfs_list_t sym_list;
+       char             name[CFS_SYMBOL_LEN];
+       void            *value;
+       int              ref;
+       struct list_head sym_list;
 };
 
 extern int      cfs_symbol_register(const char *, const void *);
@@ -107,30 +113,28 @@ extern void     cfs_symbol_put(const char *);
 extern void     cfs_symbol_clean();
 
 typedef struct file_operations cfs_file_operations_t;
-typedef struct file cfs_file_t;
 
 /*
  * Pseudo device register
  */
 
-typedef struct
-{
+typedef struct miscdevice{
     int                     minor;
     const char *            name;
     cfs_file_operations_t * fops;
-} cfs_psdev_t;
+};
 
-int cfs_psdev_register(cfs_psdev_t * psdev);
-int cfs_psdev_deregister(cfs_psdev_t * psdev);
+int misc_register(struct miscdevice *psdev);
+int misc_deregister(struct miscdevice *psdev);
 
 
 /*
  * Proc emulator file system APIs
  */
 
-typedef int cfs_read_proc_t(char *page, char **start, off_t off,
+typedef int read_proc_t(char *page, char **start, off_t off,
                             int count, int *eof, void *data);
-typedef int cfs_write_proc_t(struct file *file, const char *buffer,
+typedef int write_proc_t(struct file *file, const char *buffer,
                              unsigned long count, void *data);
 
 #define CFS_PROC_ENTRY_MAGIC 'CPEM'
@@ -151,8 +155,8 @@ typedef struct cfs_proc_entry
     struct cfs_proc_entry  *parent;
 
     struct _file_entry {                // proc file / leaf entry
-           cfs_read_proc_t  *  read_proc;
-           cfs_write_proc_t *  write_proc;
+           read_proc_t  *  read_proc;
+           write_proc_t *  write_proc;
     };
 
     mode_t                  mode;
@@ -186,31 +190,24 @@ struct proc_dir_entry *PDE(const struct inode *inode);
 /*
  * Sysctl register
  */
+typedef int ctl_handler(struct ctl_table *table,
+                       int *name,  int nlen,
+                       void *oldval, size_t *oldlenp,
+                       void *newval, size_t newlen,
+                       void **context);
 
-typedef struct ctl_table                cfs_sysctl_table_t;
-typedef struct ctl_table_header         cfs_sysctl_table_header_t;
-
+typedef int proc_handler (struct ctl_table *ctl,
+                         int write, struct file *filp,
+                         void *buffer, size_t *lenp);
 
-typedef int ctl_handler (
-            cfs_sysctl_table_t *table,
-            int *name,  int nlen,
-            void *oldval, size_t *oldlenp,
-            void *newval, size_t newlen, 
-            void **context );
 
-typedef int proc_handler (
-            cfs_sysctl_table_t *ctl,
-            int write, struct file * filp,
-            void *buffer, size_t *lenp );
-
-
-int proc_dointvec(cfs_sysctl_table_t *table, int write, struct file *filp,
+int proc_dointvec(struct ctl_table *table, int write, struct file *filp,
                     void *buffer, size_t *lenp);
 
-int proc_dostring(cfs_sysctl_table_t *table, int write, struct file *filp,
+int proc_dostring(struct ctl_table *table, int write, struct file *filp,
                  void *buffer, size_t *lenp);
 
-int sysctl_string(cfs_sysctl_table_t *table, int *name, int nlen,
+int sysctl_string(struct ctl_table *table, int *name, int nlen,
                  void *oldval, size_t *oldlenp,
                  void *newval, size_t newlen, void **context);
 
@@ -245,7 +242,7 @@ struct ctl_table
        void *data;
        int maxlen;
        mode_t mode;
-       cfs_sysctl_table_t *child;
+       struct ctl_table *child;
        proc_handler *proc_handler;     /* text formatting callback */
        ctl_handler *strategy;          /* read / write callback functions */
        cfs_proc_entry_t *de;   /* proc entry block */
@@ -257,8 +254,8 @@ struct ctl_table
 /* the mantaner of the cfs_sysctl_table trees */
 struct ctl_table_header
 {
-       cfs_sysctl_table_t *    ctl_table;
-       cfs_list_t              ctl_entry;
+       struct ctl_table *ctl_table;
+       struct list_head ctl_entry;
 };
 
 /* proc root entries, support routines */
@@ -284,12 +281,8 @@ cfs_proc_entry_t *proc_mkdir(const char *name,
 #define cfs_free_proc_entry   proc_free_entry
 #define cfs_remove_proc_entry remove_proc_entry
 
-struct ctl_table_header *register_sysctl_table(cfs_sysctl_table_t * table,
-                                               int insert_at_head);
-void unregister_sysctl_table(struct ctl_table_header * header);
-
-#define cfs_register_sysctl_table(t, a)   register_sysctl_table(t, a)
-#define cfs_unregister_sysctl_table(t)    unregister_sysctl_table(t)
+struct ctl_table_header *register_sysctl_table(struct ctl_table *table);
+void unregister_sysctl_table(struct ctl_table_header *header);
 
 /*
  * seq device (linux/seq_file.h)
@@ -319,7 +312,7 @@ struct seq_file {
        size_t count;
        loff_t index;
        u32    version;
-       cfs_mutex_t lock;
+       struct mutex            lock;
        const struct seq_operations *op;
        void *private;
 };
@@ -339,9 +332,6 @@ int seq_escape(struct seq_file *, const char *, const char *);
 int seq_putc(struct seq_file *m, char c);
 int seq_puts(struct seq_file *m, const char *s);
 
-int seq_printf(struct seq_file *, const char *, ...)
-       __attribute__ ((format (printf,2,3)));
-
 int seq_path(struct seq_file *, struct path *, char *);
 
 int single_open(struct file *, int (*)(struct seq_file *, void *), void *);
@@ -356,82 +346,59 @@ int seq_release_private(struct inode *, struct file *);
  * Helpers for iteration over list_head-s in seq_files
  */
 
-extern cfs_list_t *seq_list_start(cfs_list_t *head, loff_t pos);
-extern cfs_list_t *seq_list_start_head(cfs_list_t *head, loff_t pos);
-extern cfs_list_t *seq_list_next(void *v, cfs_list_t *head, loff_t *ppos);
+extern struct list_head *seq_list_start(struct list_head *head, loff_t pos);
+extern struct list_head *seq_list_start_head(struct list_head *head, loff_t pos);
+extern struct list_head *seq_list_next(void *v, struct list_head *head, loff_t *ppos);
 
 /*
  *  declaration of proc kernel process routines
  */
 
-cfs_file_t *
-lustre_open_file(char * filename);
+struct file *lustre_open_file(char *filename);
 
-int
-lustre_close_file(cfs_file_t * fh);
+int lustre_close_file(struct file *fh);
 
-int
-lustre_do_ioctl( cfs_file_t * fh,
-                 unsigned long cmd,
-                 ulong_ptr_t arg );
+int lustre_do_ioctl(struct file *fh, unsigned long cmd, ulong_ptr_t arg);
 
-int
-lustre_ioctl_file( cfs_file_t * fh,
-                   PCFS_PROC_IOCTL devctl);
-
-size_t
-lustre_read_file( cfs_file_t *    fh,
-                  loff_t          offl,
-                  size_t          size,
-                  char *          buf
-                  );
-
-size_t
-lustre_write_file( cfs_file_t *    fh,
-                   loff_t          off,
-                   size_t          size,
-                   char *          buf
-                   );
+int lustre_ioctl_file(struct file *fh, PCFS_PROC_IOCTL devctl);
+
+size_t lustre_read_file(struct file *fh, loff_t offl, size_t size, char *buf);
+
+size_t lustre_write_file(struct file *fh, loff_t off, size_t size, char *buf);
 
 /*
  * Wait Queue
  */
 
 
-typedef int cfs_task_state_t;
-
-#define CFS_TASK_INTERRUPTIBLE  0x00000001
-#define CFS_TASK_UNINT          0x00000002
-#define CFS_TASK_RUNNING         0x00000003
-#define CFS_TASK_UNINTERRUPTIBLE CFS_TASK_UNINT
+#define TASK_INTERRUPTIBLE      0x00000001
+#define TASK_UNINTERRUPTIBLE            0x00000002
+#define TASK_RUNNING         0x00000003
+#define CFS_TASK_UNINTERRUPTIBLE TASK_UNINTERRUPTIBLE
 
 #define CFS_WAITQ_MAGIC     'CWQM'
 #define CFS_WAITLINK_MAGIC  'CWLM'
 
 typedef struct cfs_waitq {
+       unsigned int            magic;
+       unsigned int            flags;
 
-    unsigned int            magic;
-    unsigned int            flags;
-
-    cfs_spinlock_t          guard;
-    cfs_list_t              waiters;
+       spinlock_t              guard;
+       struct list_head        waiters;
+} wait_queue_head_t;
 
-} cfs_waitq_t;
 
-
-typedef struct cfs_waitlink cfs_waitlink_t;
+typedef struct cfs_waitlink wait_queue_t;
 
 #define CFS_WAITQ_CHANNELS     (2)
 
 #define CFS_WAITQ_CHAN_NORMAL  (0)
 #define CFS_WAITQ_CHAN_FORWARD (1)
 
-
-
 typedef struct cfs_waitlink_channel {
-    cfs_list_t              link;
-    cfs_waitq_t *           waitq;
-    cfs_waitlink_t *        waitl;
+       struct list_head        link;
+       wait_queue_head_t       *waitq;
+       wait_queue_t            *waitl;
 } cfs_waitlink_channel_t;
 
 struct cfs_waitlink {
@@ -439,7 +406,7 @@ struct cfs_waitlink {
     unsigned int            magic;
     int                     flags;
     event_t  *              event;
-    cfs_atomic_t *          hits;
+    atomic_t *          hits;
 
     cfs_waitlink_channel_t  waitq[CFS_WAITQ_CHANNELS];
 };
@@ -448,7 +415,7 @@ enum {
        CFS_WAITQ_EXCLUSIVE = 1
 };
 
-#define CFS_DECL_WAITQ(name) cfs_waitq_t name
+#define CFS_DECL_WAITQ(name) wait_queue_head_t name
 
 /* Kernel thread */
 
@@ -459,8 +426,6 @@ typedef struct _cfs_thread_context {
     void *              arg;
 } cfs_thread_context_t;
 
-int cfs_create_thread(int (*func)(void *), void *arg, unsigned long flag);
-
 /*
  * thread creation flags from Linux, not used in winnt
  */
@@ -478,56 +443,56 @@ int cfs_create_thread(int (*func)(void *), void *arg, unsigned long flag);
 
 #define CLONE_SIGNAL    (CLONE_SIGHAND | CLONE_THREAD)
 
-#define CFS_DAEMON_FLAGS (CLONE_VM|CLONE_FILES)
-
 /*
  * group_info: linux/sched.h
  */
 #define NGROUPS_SMALL           32
 #define NGROUPS_PER_BLOCK       ((int)(PAGE_SIZE / sizeof(gid_t)))
-typedef struct cfs_group_info {
-        int ngroups;
-        cfs_atomic_t usage;
-        gid_t small_block[NGROUPS_SMALL];
-        int nblocks;
-        gid_t *blocks[0];
-} cfs_group_info_t;
-
-#define cfs_get_group_info(group_info) do { \
-        cfs_atomic_inc(&(group_info)->usage); \
+struct group_info {
+       int ngroups;
+       atomic_t usage;
+       gid_t small_block[NGROUPS_SMALL];
+       int nblocks;
+       gid_t *blocks[0];
+};
+
+#define get_group_info(group_info) do { \
+       atomic_inc(&(group_info)->usage); \
 } while (0)
 
-#define cfs_put_group_info(group_info) do { \
-        if (cfs_atomic_dec_and_test(&(group_info)->usage)) \
-                cfs_groups_free(group_info); \
+#define put_group_info(group_info) do { \
+       if (atomic_dec_and_test(&(group_info)->usage)) \
+               groups_free(group_info); \
 } while (0)
 
-static __inline cfs_group_info_t *cfs_groups_alloc(int gidsetsize)
+static __inline struct group_info *groups_alloc(int gidsetsize)
 {
-    cfs_group_info_t * groupinfo;
+    struct group_info * groupinfo;
     KdPrint(("%s(%d): %s NOT implemented.\n", __FILE__, __LINE__, __FUNCTION__));
-    groupinfo =
-        (cfs_group_info_t *)cfs_alloc(sizeof(cfs_group_info_t), 0);
+    groupinfo = kmalloc(sizeof(struct group_info), 0);
 
     if (groupinfo) {
-        memset(groupinfo, 0, sizeof(cfs_group_info_t));
+       memset(groupinfo, 0, sizeof(struct group_info));
     }
     return groupinfo;
 }
-static __inline void cfs_groups_free(cfs_group_info_t *group_info)
+
+static __inline void groups_free(struct group_info *group_info)
 {
-    KdPrint(("%s(%d): %s NOT implemented.\n", __FILE__, __LINE__,
-            __FUNCTION__));
-    cfs_free(group_info);
+       KdPrint(("%s(%d): %s NOT implemented.\n", __FILE__, __LINE__,
+               __FUNCTION__));
+       kfree(group_info);
 }
+
 static __inline int
-cfs_set_current_groups(cfs_group_info_t *group_info)
+set_current_groups(struct group_info *group_info)
 {
     KdPrint(("%s(%d): %s NOT implemented.\n", __FILE__, __LINE__,
              __FUNCTION__));
     return 0;
 }
-static __inline int groups_search(cfs_group_info_t *group_info,
+
+static __inline int groups_search(struct group_info *group_info,
                                   gid_t grp) {
     KdPrint(("%s(%d): %s NOT implemented.\n", __FILE__, __LINE__,
             __FUNCTION__));
@@ -556,7 +521,7 @@ static __inline int groups_search(cfs_group_info_t *group_info,
  *  capabilities support 
  */
 
-typedef __u32 cfs_kernel_cap_t;
+typedef __u32 kernel_cap_t;
 
 #define cap_raise(c, flag)  do {} while(0)
 #define cap_lower(c, flag)  do {} while(0)
@@ -567,14 +532,14 @@ typedef __u32 cfs_kernel_cap_t;
  * Task struct
  */
 
-#define CFS_MAX_SCHEDULE_TIMEOUT     ((long_ptr_t)(~0UL>>12))
-#define cfs_schedule_timeout(t)      cfs_schedule_timeout_and_set_state(0, t)
+#define MAX_SCHEDULE_TIMEOUT     ((long_ptr_t)(~0UL>>12))
+#define schedule_timeout(t)      schedule_timeout_and_set_state(0, t)
 
 struct vfsmount;
 
 #define NGROUPS 1
 #define CFS_CURPROC_COMM_MAX (16)
-typedef struct task_sruct{
+struct task_struct{
     mode_t                umask;
     sigset_t              blocked;
 
@@ -587,21 +552,21 @@ typedef struct task_sruct{
     int                   ngroups;
     int                   cgroups;
     gid_t                 groups[NGROUPS];
-    cfs_group_info_t     *group_info;
-    cfs_kernel_cap_t      cap_effective,
+    struct group_info     *group_info;
+    kernel_cap_t      cap_effective,
                           cap_inheritable,
                           cap_permitted;
 
     char                  comm[CFS_CURPROC_COMM_MAX];
     void                 *journal_info;
     struct vfsmount      *fs;
-}  cfs_task_t;
+};
 
-static inline void task_lock(cfs_task_t *t)
+static inline void task_lock(struct task_struct *t)
 {
 }
 
-static inline void task_unlock(cfs_task_t *t)
+static inline void task_unlock(struct task_struct *t)
 {
 }
 
@@ -613,17 +578,15 @@ static inline void task_unlock(cfs_task_t *t)
 #define TASKSLT_MAGIC  'TSLT'   /* Task Slot */
 
 typedef struct _TASK_MAN {
+       ULONG           Magic;          /* Magic and Flags */
+       ULONG           Flags;
 
-    ULONG           Magic;      /* Magic and Flags */
-    ULONG           Flags;
-
-    cfs_spinlock_t  Lock;       /* Protection lock */
+       spinlock_t      Lock;           /* Protection lock */
 
-    cfs_mem_cache_t *slab; /* Memory slab for task slot */
-
-    ULONG           NumOfTasks; /* Total tasks (threads) */
-    LIST_ENTRY      TaskList;   /* List of task slots */
+       struct kmem_cache       *slab;          /* Memory slab for task slot */
 
+       ULONG           NumOfTasks;     /* Total tasks (threads) */
+       LIST_ENTRY      TaskList;       /* List of task slots */
 } TASK_MAN, *PTASK_MAN;
 
 typedef struct _TASK_SLOT {
@@ -639,55 +602,54 @@ typedef struct _TASK_SLOT {
     HANDLE          Tid;        /* Thread id */
     PETHREAD        Tet;        /* Pointer to ethread */
 
-    cfs_atomic_t    count;      /* refer count */
-    cfs_atomic_t    hits;       /* times of waken event singaled */
+    atomic_t    count;      /* refer count */
+    atomic_t    hits;       /* times of waken event singaled */
 
     KIRQL           irql;       /* irql for rwlock ... */
 
-    cfs_task_t      task;       /* linux task part */
+    struct task_struct      task;       /* linux task part */
 
 } TASK_SLOT, *PTASK_SLOT;
 
 
-#define current                      cfs_current()
-#define cfs_set_current_state(s)     do {;} while (0)
-#define cfs_set_current_state(state) cfs_set_current_state(state)
+#define set_current_state(s)     do {;} while (0)
 
-#define cfs_wait_event(wq, condition)                           \
+#define wait_event(wq, condition)                           \
 do {                                                            \
-        cfs_waitlink_t __wait;                                  \
-                                                                \
-        cfs_waitlink_init(&__wait);                             \
-        while (TRUE) {                                          \
-            cfs_waitq_add(&wq, &__wait);                        \
-            if (condition) {                                    \
-                break;                                          \
-            }                                                   \
-            cfs_waitq_wait(&__wait, CFS_TASK_INTERRUPTIBLE);    \
-            cfs_waitq_del(&wq, &__wait);                       \
-        }                                                      \
-        cfs_waitq_del(&wq, &__wait);                           \
+       wait_queue_t __wait;                                    \
+                                                               \
+       init_waitqueue_entry_current(&__wait);                  \
+       while (TRUE) {                                          \
+           add_wait_queue(&wq, &__wait);                        \
+           if (condition) {                                    \
+               break;                                          \
+           }                                                   \
+           waitq_wait(&__wait, TASK_INTERRUPTIBLE);            \
+           remove_wait_queue(&wq, &__wait);                    \
+                                                             \
+       remove_wait_queue(&wq, &__wait);                        \
 } while(0)
 
-#define cfs_wait_event_interruptible(wq, condition, __ret)      \
-do {                                                            \
-        cfs_waitlink_t __wait;                                 \
-                                                                \
-        __ret = 0;                                              \
-        cfs_waitlink_init(&__wait);                             \
-        while (TRUE) {                                          \
-            cfs_waitq_add(&wq, &__wait);                       \
-            if (condition) {                                    \
-                break;                                          \
-            }                                                   \
-            cfs_waitq_wait(&__wait, CFS_TASK_INTERRUPTIBLE);    \
-            cfs_waitq_del(&wq, &__wait);                       \
-        }                                                       \
-        cfs_waitq_del(&wq, &__wait);                            \
-} while(0)
+#define wait_event_interruptible(wq, condition)                 \
+{                                                               \
+       wait_queue_t __wait;                                    \
+                                                               \
+       __ret = 0;                                              \
+       init_waitqueue_entry_current(&__wait);                             \
+       while (TRUE) {                                          \
+               add_wait_queue(&wq, &__wait);                   \
+               if (condition) {                                \
+                       break;                                  \
+               }                                               \
+               waitq_wait(&__wait, TASK_INTERRUPTIBLE);\
+               remove_wait_queue(&wq, &__wait);                        \
+       }                                                       \
+       remove_wait_queue(&wq, &__wait);                            \
+       __ret;                                                  \
+}
 
-# define cfs_wait_event_interruptible_exclusive(wq, condition, rc)  \
-         cfs_wait_event_interruptible(wq, condition, rc)
+# define wait_event_interruptible_exclusive(wq, condition)  \
+        wait_event_interruptible(wq, condition)
 
 /*
    retval == 0; condition met; we're good.
@@ -695,41 +657,34 @@ do {                                                            \
    retval > 0; timed out.
 */
 
-#define cfs_waitq_wait_event_interruptible_timeout(             \
-                        wq, condition, timeout, rc)             \
+#define wait_event_interruptible_timeout(wq, condition, timeout)\
 do {                                                            \
-        cfs_waitlink_t __wait;                                  \
-                                                                \
-        rc = 0;                                                 \
-        cfs_waitlink_init(&__wait);                            \
-        while (TRUE) {                                          \
-            cfs_waitq_add(&wq, &__wait);                        \
-            if (condition) {                                    \
-                break;                                          \
-            }                                                   \
-            if (cfs_waitq_timedwait(&__wait,                    \
-                CFS_TASK_INTERRUPTIBLE, timeout) == 0) {        \
-                rc = TRUE;                                      \
-                break;                                          \
-            }                                                   \
-            cfs_waitq_del(&wq, &__wait);                       \
-        }                                                      \
-        cfs_waitq_del(&wq, &__wait);                           \
+       wait_queue_t __wait;                                    \
+                                                               \
+       init_waitqueue_entry_current(&__wait);                  \
+       while (TRUE) {                                          \
+           add_wait_queue(&wq, &__wait);                       \
+           if (condition) {                                    \
+               break;                                          \
+           }                                                   \
+           if (waitq_timedwait(&__wait,                        \
+               TASK_INTERRUPTIBLE, timeout) == 0) {            \
+               break;                                          \
+           }                                                   \
+           remove_wait_queue(&wq, &__wait);                    \
+       }                                                       \
+       remove_wait_queue(&wq, &__wait);                        \
 } while(0)
 
-
-#define cfs_waitq_wait_event_timeout                            \
-        cfs_waitq_wait_event_interruptible_timeout
-
 int     init_task_manager();
 void    cleanup_task_manager();
-cfs_task_t * cfs_current();
-int     wake_up_process(cfs_task_t * task);
-void sleep_on(cfs_waitq_t *waitq);
-#define cfs_might_sleep() do {} while(0)
-#define CFS_DECL_JOURNAL_DATA  
-#define CFS_PUSH_JOURNAL           do {;} while(0)
-#define CFS_POP_JOURNAL                    do {;} while(0)
+struct task_struct * current;
+int     wake_up_process(struct task_struct * task);
+void sleep_on(wait_queue_head_t *waitq);
+#define might_sleep() do {} while(0)
+#define DECL_JOURNAL_DATA
+#define PUSH_JOURNAL       do {;} while(0)
+#define POP_JOURNAL                do {;} while(0)
 
 
 /* module related definitions */
@@ -741,15 +696,14 @@ void sleep_on(cfs_waitq_t *waitq);
 #define __init
 #endif
 
-typedef struct cfs_module {
+struct module{
     const char *name;
-} cfs_module_t;
+};
 
-extern cfs_module_t libcfs_global_module;
+extern struct module libcfs_global_module;
 #define THIS_MODULE  &libcfs_global_module
 
-#define cfs_request_module(x, y) (0)
-#define EXPORT_SYMBOL(s)
+#define request_module(x, y) (0)
 #define MODULE_AUTHOR(s)
 #define MODULE_DESCRIPTION(s)
 #define MODULE_LICENSE(s)
@@ -773,7 +727,7 @@ extern cfs_module_t libcfs_global_module;
 #define cfs_module(name, version, init, fini) \
         module_init(init);                    \
         module_exit(fini)
-#define cfs_module_refcount(x) (1)
+#define module_refcount(x) (1)
 
 /*
  * typecheck
@@ -800,7 +754,7 @@ extern cfs_module_t libcfs_global_module;
 #define GOLDEN_RATIO_PRIME_32 0x9e370001UL
 
 #if 0 /* defined in libcfs/libcfs_hash.h */
-static inline u32 cfs_hash_long(u32 val, unsigned int bits)
+static inline u32 hash_long(u32 val, unsigned int bits)
 {
        /* On some cpus multiply is faster, on others gcc will do shifts */
        u32 hash = val * GOLDEN_RATIO_PRIME_32;
@@ -817,7 +771,7 @@ static inline u32 cfs_hash_long(u32 val, unsigned int bits)
 #define CFS_TIMER_FLAG_INITED   0x00000001  // Initialized already
 #define CFS_TIMER_FLAG_TIMERED  0x00000002  // KeSetTimer is called
 
-typedef struct cfs_timer {
+struct timer_list {
 
     KSPIN_LOCK      Lock;
 
@@ -831,7 +785,7 @@ typedef struct cfs_timer {
     void (*proc)(ulong_ptr_t);
     void *          arg;
 
-} cfs_timer_t;
+};
 
 /*
  *  libcfs globals initialization/cleanup
@@ -847,7 +801,7 @@ libcfs_arch_cleanup(void);
  *  cache alignment size
  */
 
-#define CFS_L1_CACHE_ALIGN(x) (x)
+#define L1_CACHE_ALIGN(x) (x)
 
 #define __cacheline_aligned
 
@@ -857,11 +811,11 @@ libcfs_arch_cleanup(void);
 
 
 #define SMP_CACHE_BYTES             128
-#define CFS_NR_CPUS                 (32)
+#define NR_CPUS                 (32)
 #define smp_num_cpus                ((CCHAR)KeNumberProcessors)
-#define cfs_num_possible_cpus()     smp_num_cpus
-#define cfs_num_online_cpus()       smp_num_cpus
-#define cfs_smp_processor_id()     ((USHORT)KeGetCurrentProcessorNumber())
+#define num_possible_cpus()     smp_num_cpus
+#define num_online_cpus()       smp_num_cpus
+#define smp_processor_id()         ((USHORT)KeGetCurrentProcessorNumber())
 #define smp_call_function(f, a, n, w)          do {} while(0)
 #define smp_rmb()                   do {} while(0)
 
@@ -869,21 +823,21 @@ libcfs_arch_cleanup(void);
  *  Irp related
  */
 
-#define CFS_NR_IRQS                 512
-#define cfs_in_interrupt()          (0)
+#define NR_IRQS                 512
+#define in_interrupt()          (0)
 
 /*
  *  printk flags
  */
 
-#define CFS_KERN_EMERG      "<0>"   /* system is unusable                   */
-#define CFS_KERN_ALERT      "<1>"   /* action must be taken immediately     */
-#define CFS_KERN_CRIT       "<2>"   /* critical conditions                  */
-#define CFS_KERN_ERR        "<3>"   /* error conditions                     */
-#define CFS_KERN_WARNING    "<4>"   /* warning conditions                   */
-#define CFS_KERN_NOTICE     "<5>"   /* normal but significant condition     */
-#define CFS_KERN_INFO       "<6>"   /* informational                        */
-#define CFS_KERN_DEBUG      "<7>"   /* debug-level messages                 */
+#define KERN_EMERG      "<0>"   /* system is unusable                   */
+#define KERN_ALERT      "<1>"   /* action must be taken immediately     */
+#define KERN_CRIT       "<2>"   /* critical conditions                  */
+#define KERN_ERR        "<3>"   /* error conditions                     */
+#define KERN_WARNING    "<4>"   /* warning conditions                   */
+#define KERN_NOTICE     "<5>"   /* normal but significant condition     */
+#define KERN_INFO       "<6>"   /* informational                        */
+#define KERN_DEBUG      "<7>"   /* debug-level messages                 */
 
 /*
  * Misc
@@ -899,14 +853,9 @@ libcfs_arch_cleanup(void);
 #define unlikely(exp) (exp)
 #endif
 
-#define cfs_lock_kernel()               do {} while(0)
-#define cfs_unlock_kernel()             do {} while(0)
-
 #define local_irq_save(x)
 #define local_irq_restore(x)
 
-#define THREAD_NAME
-
 #define va_copy(_d, _s)                 (_d = _s)
 
 char *strnchr(const char *s, size_t count, int c);
@@ -953,9 +902,9 @@ void cfs_enter_debugger();
 #define PTHREAD_RECURSIVE_MUTEX_INITIALIZER ((pthread_mutex_t) -2)
 #define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER ((pthread_mutex_t) -3)
 
-typedef struct file {
-    int foo;
-} cfs_file_t;
+struct file {
+       int foo;
+};
 
 #include "../user-prim.h"
 #include "../user-lock.h"
@@ -1108,16 +1057,16 @@ void globfree(glob_t *__pglog);
  *  module routines
  */
 
-static inline void __cfs_module_get(cfs_module_t *module)
+static inline void __module_get(struct module *module)
 {
 }
 
-static inline int cfs_try_module_get(cfs_module_t *module)
+static inline int try_module_get(struct module *module)
 {
-    return 1;
+       return 1;
 }
 
-static inline void cfs_module_put(cfs_module_t *module)
+static inline void module_put(struct module *module)
 {
 }
 
@@ -1125,7 +1074,6 @@ static inline void cfs_module_put(cfs_module_t *module)
  *  sigset_t routines 
  */
 
-typedef sigset_t cfs_sigset_t;
 #define sigaddset(what,sig) (*(what) |= (1<<(sig)), 0)
 #define sigdelset(what,sig) (*(what) &= ~(1<<(sig)), 0)
 #define sigemptyset(what)   (*(what) = 0, 0)
@@ -1133,11 +1081,11 @@ typedef sigset_t cfs_sigset_t;
 #define sigismember(what,sig) (((*(what)) & (1<<(sig))) != 0)
 
 static __inline int
-sigprocmask(int sig, cfs_sigset_t *w1, cfs_sigset_t *w2) {
+sigprocmask(int sig, sigset_t *w1, sigset_t *w2) {
     return 0;
 }
 static __inline int
-sigpending(cfs_sigset_t *what) {
+sigpending(sigset_t *what) {
     return 0;
 }
 
@@ -1176,12 +1124,6 @@ sigpending(cfs_sigset_t *what) {
 
 
 /*
- *  Linux kernel version definition
- */
-
-#define KERNEL_VERSION(a,b,c) ((a)*100+(b)*10+c)
-
-/*
  *  linux ioctl coding definitions
  */