Whamcloud - gitweb
LU-3963 libcfs: remove cfs_hash_long
[fs/lustre-release.git] / libcfs / include / libcfs / winnt / winnt-prim.h
index cc8a3dc..7d8147f 100644 (file)
@@ -100,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 *);
@@ -132,9 +132,9 @@ 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'
@@ -155,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;
@@ -254,8 +254,8 @@ struct ctl_table
 /* the mantaner of the cfs_sysctl_table trees */
 struct ctl_table_header
 {
-       struct ctl_table *    ctl_table;
-       cfs_list_t              ctl_entry;
+       struct ctl_table *ctl_table;
+       struct list_head ctl_entry;
 };
 
 /* proc root entries, support routines */
@@ -332,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 *);
@@ -349,9 +346,9 @@ 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
@@ -387,8 +384,7 @@ typedef struct cfs_waitq {
        unsigned int            flags;
 
        spinlock_t              guard;
-       cfs_list_t              waiters;
-
+       struct list_head        waiters;
 } wait_queue_head_t;
 
 
@@ -399,12 +395,10 @@ typedef struct cfs_waitlink wait_queue_t;
 #define CFS_WAITQ_CHAN_NORMAL  (0)
 #define CFS_WAITQ_CHAN_FORWARD (1)
 
-
-
 typedef struct cfs_waitlink_channel {
-    cfs_list_t              link;
-    wait_queue_head_t *           waitq;
-    wait_queue_t *        waitl;
+       struct list_head        link;
+       wait_queue_head_t       *waitq;
+       wait_queue_t            *waitl;
 } cfs_waitlink_channel_t;
 
 struct cfs_waitlink {
@@ -412,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];
 };
@@ -454,36 +448,36 @@ typedef struct _cfs_thread_context {
  */
 #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 = kmalloc(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__));
@@ -491,14 +485,14 @@ static __inline void cfs_groups_free(cfs_group_info_t *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__));
@@ -545,7 +539,7 @@ struct vfsmount;
 
 #define NGROUPS 1
 #define CFS_CURPROC_COMM_MAX (16)
-typedef struct task_sruct{
+struct task_struct{
     mode_t                umask;
     sigset_t              blocked;
 
@@ -558,7 +552,7 @@ typedef struct task_sruct{
     int                   ngroups;
     int                   cgroups;
     gid_t                 groups[NGROUPS];
-    cfs_group_info_t     *group_info;
+    struct group_info     *group_info;
     kernel_cap_t      cap_effective,
                           cap_inheritable,
                           cap_permitted;
@@ -566,13 +560,13 @@ typedef struct task_sruct{
     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)
 {
 }
 
@@ -608,17 +602,16 @@ 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 set_current_state(s)     do {;} while (0)
 
 #define wait_event(wq, condition)                           \
@@ -685,13 +678,13 @@ do {                                                            \
 
 int     init_task_manager();
 void    cleanup_task_manager();
-cfs_task_t * cfs_current();
-int     wake_up_process(cfs_task_t * task);
+struct task_struct * current;
+int     wake_up_process(struct task_struct * task);
 void sleep_on(wait_queue_head_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)
+#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 */
@@ -761,7 +754,7 @@ extern struct module 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;
@@ -778,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;
 
@@ -792,7 +785,7 @@ typedef struct cfs_timer {
     void (*proc)(ulong_ptr_t);
     void *          arg;
 
-} cfs_timer_t;
+};
 
 /*
  *  libcfs globals initialization/cleanup
@@ -831,7 +824,7 @@ libcfs_arch_cleanup(void);
  */
 
 #define NR_IRQS                 512
-#define cfs_in_interrupt()          (0)
+#define in_interrupt()          (0)
 
 /*
  *  printk flags
@@ -1081,7 +1074,6 @@ static inline void module_put(struct module *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)
@@ -1089,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;
 }