Whamcloud - gitweb
LU-5418: compilation fix when using newer readline lib
[fs/lustre-release.git] / libcfs / libcfs / user-prim.c
index 7d7c059..a912c94 100644 (file)
  * Wait queue. No-op implementation.
  */
 
-void cfs_waitq_init(struct cfs_waitq *waitq)
+void init_waitqueue_head(struct cfs_waitq *waitq)
 {
-        LASSERT(waitq != NULL);
-        (void)waitq;
+       LASSERT(waitq != NULL);
+       (void)waitq;
 }
 
-void cfs_waitlink_init(struct cfs_waitlink *link)
+void init_waitqueue_entry_current(struct cfs_waitlink *link)
 {
-        LASSERT(link != NULL);
-        (void)link;
+       LASSERT(link != NULL);
+       (void)link;
 }
 
-void cfs_waitq_add(struct cfs_waitq *waitq, struct cfs_waitlink *link)
+void add_wait_queue(struct cfs_waitq *waitq, struct cfs_waitlink *link)
 {
-        LASSERT(waitq != NULL);
-        LASSERT(link != NULL);
-        (void)waitq;
-        (void)link;
+       LASSERT(waitq != NULL);
+       LASSERT(link != NULL);
+       (void)waitq;
+       (void)link;
 }
 
-void cfs_waitq_add_exclusive(struct cfs_waitq *waitq, struct cfs_waitlink *link)
+void add_wait_queue_exclusive(struct cfs_waitq *waitq, struct cfs_waitlink *link)
 {
-        LASSERT(waitq != NULL);
-        LASSERT(link != NULL);
-        (void)waitq;
-        (void)link;
+       LASSERT(waitq != NULL);
+       LASSERT(link != NULL);
+       (void)waitq;
+       (void)link;
 }
 
-void cfs_waitq_add_exclusive_head(struct cfs_waitq *waitq, struct cfs_waitlink *link)
+void add_wait_queue_exclusive_head(struct cfs_waitq *waitq, struct cfs_waitlink *link)
 {
-        cfs_waitq_add_exclusive(waitq, link);
+       add_wait_queue_exclusive(waitq, link);
 }
 
-void cfs_waitq_del(struct cfs_waitq *waitq, struct cfs_waitlink *link)
+void remove_wait_queue(struct cfs_waitq *waitq, struct cfs_waitlink *link)
 {
-        LASSERT(waitq != NULL);
-        LASSERT(link != NULL);
-        (void)waitq;
-        (void)link;
+       LASSERT(waitq != NULL);
+       LASSERT(link != NULL);
+       (void)waitq;
+       (void)link;
 }
 
-int cfs_waitq_active(struct cfs_waitq *waitq)
+int waitqueue_active(struct cfs_waitq *waitq)
 {
-        LASSERT(waitq != NULL);
-        (void)waitq;
-        return 0;
+       LASSERT(waitq != NULL);
+       (void)waitq;
+       return 0;
 }
 
-void cfs_waitq_signal(struct cfs_waitq *waitq)
+void wake_up(struct cfs_waitq *waitq)
 {
-        LASSERT(waitq != NULL);
-        (void)waitq;
+       LASSERT(waitq != NULL);
+       (void)waitq;
 }
 
-void cfs_waitq_signal_nr(struct cfs_waitq *waitq, int nr)
+void wake_up_nr(struct cfs_waitq *waitq, int nr)
 {
-        LASSERT(waitq != NULL);
-        (void)waitq;
+       LASSERT(waitq != NULL);
+       (void)waitq;
 }
 
-void cfs_waitq_broadcast(struct cfs_waitq *waitq)
+void wake_up_all(struct cfs_waitq *waitq)
 {
-        LASSERT(waitq != NULL);
-        (void)waitq;
+       LASSERT(waitq != NULL);
+       (void)waitq;
 }
 
-void cfs_waitq_wait(struct cfs_waitlink *link, cfs_task_state_t state)
+void waitq_wait(struct cfs_waitlink *link, long state)
 {
-        LASSERT(link != NULL);
-        (void)link;
+       LASSERT(link != NULL);
+       (void)link;
 
-        /* well, wait for something to happen */
+       /* well, wait for something to happen */
        call_wait_handler(0);
 }
 
-int64_t cfs_waitq_timedwait(struct cfs_waitlink *link, cfs_task_state_t state,
-                            int64_t timeout)
+int64_t waitq_timedwait(struct cfs_waitlink *link, long state,
+                       int64_t timeout)
 {
-        LASSERT(link != NULL);
-        (void)link;
+       LASSERT(link != NULL);
+       (void)link;
        call_wait_handler(timeout);
-        return 0;
+       return 0;
 }
 
-void cfs_schedule_timeout_and_set_state(cfs_task_state_t state, int64_t timeout)
+void schedule_timeout_and_set_state(long state, int64_t timeout)
 {
-        cfs_waitlink_t    l;
-        /* sleep(timeout) here instead? */
-        cfs_waitq_timedwait(&l, state, timeout);
+       wait_queue_t    l;
+       /* sleep(timeout) here instead? */
+       waitq_timedwait(&l, state, timeout);
 }
 
 void
 cfs_pause(cfs_duration_t d)
 {
-        struct timespec s;
+       struct timespec s;
 
-        cfs_duration_nsec(d, &s);
-        nanosleep(&s, NULL);
+       cfs_duration_nsec(d, &s);
+       nanosleep(&s, NULL);
 }
 
-int cfs_need_resched(void)
+int need_resched(void)
 {
-        return 0;
+       return 0;
 }
 
-void cfs_cond_resched(void)
+void cond_resched(void)
 {
 }
 
@@ -166,38 +166,38 @@ void cfs_cond_resched(void)
  * Timer
  */
 
-void cfs_init_timer(cfs_timer_t *t)
+void cfs_init_timer(struct timer_list *t)
 {
-        CFS_INIT_LIST_HEAD(&t->tl_list);
+       INIT_LIST_HEAD(&t->tl_list);
 }
 
-void cfs_timer_init(cfs_timer_t *l, cfs_timer_func_t *func, void *arg)
+void cfs_timer_init(struct timer_list *l, cfs_timer_func_t *func, void *arg)
 {
-        CFS_INIT_LIST_HEAD(&l->tl_list);
-        l->function = func;
-        l->data = (ulong_ptr_t)arg;
-        return;
+       INIT_LIST_HEAD(&l->tl_list);
+       l->function = func;
+       l->data = (ulong_ptr_t)arg;
+       return;
 }
 
-int cfs_timer_is_armed(cfs_timer_t *l)
+int cfs_timer_is_armed(struct timer_list *l)
 {
-        if (cfs_time_before(cfs_time_current(), l->expires))
-                return 1;
-        else
-                return 0;
+       if (cfs_time_before(cfs_time_current(), l->expires))
+               return 1;
+       else
+               return 0;
 }
 
-void cfs_timer_arm(cfs_timer_t *l, cfs_time_t deadline)
+void cfs_timer_arm(struct timer_list *l, cfs_time_t deadline)
 {
-        l->expires = deadline;
+       l->expires = deadline;
 }
 
-void cfs_timer_disarm(cfs_timer_t *l)
+void cfs_timer_disarm(struct timer_list *l)
 {
 }
-cfs_time_t cfs_timer_deadline(cfs_timer_t *l)
+cfs_time_t cfs_timer_deadline(struct timer_list *l)
 {
-        return l->expires;
+       return l->expires;
 }
 
 
@@ -245,6 +245,9 @@ void *kthread_run(cfs_thread_t func, void *arg, const char namefmt[], ...)
 }
 #endif
 
+struct user_namespace init_user_ns __read_mostly;
+EXPORT_SYMBOL(init_user_ns);
+
 uid_t current_uid(void)
 {
         return getuid();
@@ -265,32 +268,6 @@ gid_t current_fsgid(void)
         return getgid();
 }
 
-#ifndef HAVE_STRLCPY /* not in glibc for RHEL 5.x, remove when obsolete */
-size_t strlcpy(char *tgt, const char *src, size_t tgt_len)
-{
-       int src_len = strlen(src);
-
-       strncpy(tgt, src, tgt_len - 1);
-       tgt[tgt_len - 1] = '\0';
-
-       return src_len + 1;
-}
-#endif
-
-#ifndef HAVE_STRLCAT /* not in glibc for RHEL 5.x, remove when obsolete */
-size_t strlcat(char *tgt, const char *src, size_t size)
-{
-       size_t tgt_len = strlen(tgt);
-
-       if (size > tgt_len) {
-               strncat(tgt, src, size - tgt_len - 1);
-               tgt[size - 1] = '\0';
-       }
-
-       return tgt_len + strlen(src);
-}
-#endif
-
 /* Read the environment variable of current process specified by @key. */
 int cfs_get_environ(const char *key, char *value, int *val_len)
 {
@@ -320,10 +297,10 @@ int unshare_fs_struct()
        return 0;
 }
 
-cfs_sigset_t cfs_block_allsigs(void)
+sigset_t cfs_block_allsigs(void)
 {
-       cfs_sigset_t   all;
-       cfs_sigset_t   old;
+       sigset_t   all;
+       sigset_t   old;
        int            rc;
 
        sigfillset(&all);
@@ -333,10 +310,10 @@ cfs_sigset_t cfs_block_allsigs(void)
        return old;
 }
 
-cfs_sigset_t cfs_block_sigs(unsigned long sigs)
+sigset_t cfs_block_sigs(unsigned long sigs)
 {
-       cfs_sigset_t   old;
-       cfs_sigset_t   blocks = { { sigs } }; /* kludge */
+       sigset_t   old;
+       sigset_t   blocks = { { sigs } }; /* kludge */
        int   rc;
 
        rc = sigprocmask(SIG_BLOCK, &blocks, &old);
@@ -347,37 +324,37 @@ cfs_sigset_t cfs_block_sigs(unsigned long sigs)
 
 /* Block all signals except for the @sigs. It's only used in
  * Linux kernel, just a dummy here. */
-cfs_sigset_t cfs_block_sigsinv(unsigned long sigs)
+sigset_t cfs_block_sigsinv(unsigned long sigs)
 {
-        cfs_sigset_t old;
-        int rc;
+       sigset_t old;
+       int rc;
 
-        /* Return old blocked sigs */
-        rc = sigprocmask(SIG_SETMASK, NULL, &old);
-        LASSERT(rc == 0);
+       /* Return old blocked sigs */
+       rc = sigprocmask(SIG_SETMASK, NULL, &old);
+       LASSERT(rc == 0);
 
-        return old;
+       return old;
 }
 
-void cfs_restore_sigs(cfs_sigset_t old)
+void cfs_restore_sigs(sigset_t old)
 {
-        int   rc = sigprocmask(SIG_SETMASK, &old, NULL);
+       int   rc = sigprocmask(SIG_SETMASK, &old, NULL);
 
-        LASSERT (rc == 0);
+       LASSERT (rc == 0);
 }
 
 int cfs_signal_pending(void)
 {
-        cfs_sigset_t    empty;
-        cfs_sigset_t    set;
-        int  rc;
+       sigset_t    empty;
+       sigset_t    set;
+       int  rc;
 
-        rc = sigpending(&set);
-        LASSERT (rc == 0);
+       rc = sigpending(&set);
+       LASSERT (rc == 0);
 
-        sigemptyset(&empty);
+       sigemptyset(&empty);
 
-        return !memcmp(&empty, &set, sizeof(set));
+       return !memcmp(&empty, &set, sizeof(set));
 }
 
 void cfs_clear_sigpending(void)