Whamcloud - gitweb
LU-1346 libcfs: cleanup macros in portals_compat25.h
[fs/lustre-release.git] / libcfs / libcfs / linux / linux-prim.c
index afb4465..27d95e9 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Intel Corporation.
+ * Copyright (c) 2011, 2013, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -259,48 +259,18 @@ void cfs_enter_debugger(void)
 #endif
 }
 
-void cfs_daemonize(char *str) {
-        unsigned long flags;
-
-        daemonize(str);
-        SIGNAL_MASK_LOCK(current, flags);
-        sigfillset(&current->blocked);
-        RECALC_SIGPENDING;
-        SIGNAL_MASK_UNLOCK(current, flags);
-}
-
-int cfs_daemonize_ctxt(char *str) {
-
-        cfs_daemonize(str);
-#ifndef HAVE_UNSHARE_FS_STRUCT
-        {
-        struct task_struct *tsk = current;
-        struct fs_struct *fs = NULL;
-        fs = copy_fs_struct(tsk->fs);
-        if (fs == NULL)
-                return -ENOMEM;
-        exit_fs(tsk);
-        tsk->fs = fs;
-        }
-#else
-        unshare_fs_struct();
-#endif
-        return 0;
-}
-
 sigset_t
 cfs_block_allsigs(void)
 {
-        unsigned long          flags;
-        sigset_t        old;
-
-        SIGNAL_MASK_LOCK(current, flags);
-        old = current->blocked;
-        sigfillset(&current->blocked);
-        RECALC_SIGPENDING;
-        SIGNAL_MASK_UNLOCK(current, flags);
+       unsigned long   flags;
+       sigset_t        old;
 
-        return old;
+       spin_lock_irqsave(&current->sighand->siglock, flags);
+       old = current->blocked;
+       sigfillset(&current->blocked);
+       recalc_sigpending();
+       spin_unlock_irqrestore(&current->sighand->siglock, flags);
+       return old;
 }
 
 sigset_t cfs_block_sigs(unsigned long sigs)
@@ -308,11 +278,11 @@ sigset_t cfs_block_sigs(unsigned long sigs)
        unsigned long  flags;
        sigset_t        old;
 
-       SIGNAL_MASK_LOCK(current, flags);
+       spin_lock_irqsave(&current->sighand->siglock, flags);
        old = current->blocked;
        sigaddsetmask(&current->blocked, sigs);
-       RECALC_SIGPENDING;
-       SIGNAL_MASK_UNLOCK(current, flags);
+       recalc_sigpending();
+       spin_unlock_irqrestore(&current->sighand->siglock, flags);
        return old;
 }
 
@@ -322,40 +292,39 @@ sigset_t cfs_block_sigsinv(unsigned long sigs)
        unsigned long flags;
        sigset_t old;
 
-       SIGNAL_MASK_LOCK(current, flags);
+       spin_lock_irqsave(&current->sighand->siglock, flags);
        old = current->blocked;
        sigaddsetmask(&current->blocked, ~sigs);
-       RECALC_SIGPENDING;
-       SIGNAL_MASK_UNLOCK(current, flags);
-
+       recalc_sigpending();
+       spin_unlock_irqrestore(&current->sighand->siglock, flags);
        return old;
 }
 
 void
 cfs_restore_sigs (cfs_sigset_t old)
 {
-        unsigned long  flags;
+       unsigned long  flags;
 
-        SIGNAL_MASK_LOCK(current, flags);
-        current->blocked = old;
-        RECALC_SIGPENDING;
-        SIGNAL_MASK_UNLOCK(current, flags);
+       spin_lock_irqsave(&current->sighand->siglock, flags);
+       current->blocked = old;
+       recalc_sigpending();
+       spin_unlock_irqrestore(&current->sighand->siglock, flags);
 }
 
 int
 cfs_signal_pending(void)
 {
-        return signal_pending(current);
+       return signal_pending(current);
 }
 
 void
 cfs_clear_sigpending(void)
 {
-        unsigned long flags;
+       unsigned long flags;
 
-        SIGNAL_MASK_LOCK(current, flags);
-        CLEAR_SIGPENDING;
-        SIGNAL_MASK_UNLOCK(current, flags);
+       spin_lock_irqsave(&current->sighand->siglock, flags);
+       clear_tsk_thread_flag(current, TIF_SIGPENDING);
+       spin_unlock_irqrestore(&current->sighand->siglock, flags);
 }
 
 int
@@ -373,8 +342,6 @@ libcfs_arch_cleanup(void)
 EXPORT_SYMBOL(libcfs_arch_init);
 EXPORT_SYMBOL(libcfs_arch_cleanup);
 EXPORT_SYMBOL(cfs_enter_debugger);
-EXPORT_SYMBOL(cfs_daemonize);
-EXPORT_SYMBOL(cfs_daemonize_ctxt);
 EXPORT_SYMBOL(cfs_block_allsigs);
 EXPORT_SYMBOL(cfs_block_sigs);
 EXPORT_SYMBOL(cfs_block_sigsinv);