Whamcloud - gitweb
LU-2446 build: Update Whamcloud copyright messages for Intel
[fs/lustre-release.git] / libcfs / libcfs / linux / linux-prim.c
index a376d4e..d8a9117 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,7 +27,7 @@
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, Whamcloud, Inc.
+ * Copyright (c) 2011, 2012, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -37,9 +35,6 @@
  */
 
 #define DEBUG_SUBSYSTEM S_LNET
-#ifndef AUTOCONF_INCLUDED
-#include <linux/config.h>
-#endif
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/fs_struct.h>
@@ -110,11 +105,11 @@ EXPORT_SYMBOL(cfs_waitq_add_exclusive);
 void
 cfs_waitq_add_exclusive_head(cfs_waitq_t *waitq, cfs_waitlink_t *link)
 {
-        unsigned long flags;
+       unsigned long flags;
 
-        spin_lock_irqsave(&LINUX_WAITQ_HEAD(waitq)->lock, flags);
-        __add_wait_queue_exclusive(LINUX_WAITQ_HEAD(waitq), LINUX_WAITQ(link));
-        spin_unlock_irqrestore(&LINUX_WAITQ_HEAD(waitq)->lock, flags);
+       spin_lock_irqsave(&LINUX_WAITQ_HEAD(waitq)->lock, flags);
+       __add_wait_queue_exclusive(LINUX_WAITQ_HEAD(waitq), LINUX_WAITQ(link));
+       spin_unlock_irqrestore(&LINUX_WAITQ_HEAD(waitq)->lock, flags);
 }
 EXPORT_SYMBOL(cfs_waitq_add_exclusive_head);
 
@@ -269,13 +264,11 @@ void cfs_enter_debugger(void)
 void cfs_daemonize(char *str) {
         unsigned long flags;
 
-        lock_kernel();
         daemonize(str);
         SIGNAL_MASK_LOCK(current, flags);
         sigfillset(&current->blocked);
         RECALC_SIGPENDING;
         SIGNAL_MASK_UNLOCK(current, flags);
-        unlock_kernel();
 }
 
 int cfs_daemonize_ctxt(char *str) {
@@ -312,34 +305,32 @@ cfs_block_allsigs(void)
         return old;
 }
 
-sigset_t
-cfs_block_sigs(sigset_t bits)
+sigset_t cfs_block_sigs(unsigned long sigs)
 {
-        unsigned long  flags;
-        sigset_t        old;
+       unsigned long  flags;
+       sigset_t        old;
 
-        SIGNAL_MASK_LOCK(current, flags);
-        old = current->blocked;
-        current->blocked = bits;
-        RECALC_SIGPENDING;
-        SIGNAL_MASK_UNLOCK(current, flags);
-        return old;
+       SIGNAL_MASK_LOCK(current, flags);
+       old = current->blocked;
+       sigaddsetmask(&current->blocked, sigs);
+       RECALC_SIGPENDING;
+       SIGNAL_MASK_UNLOCK(current, flags);
+       return old;
 }
 
 /* Block all signals except for the @sigs */
-cfs_sigset_t
-cfs_block_sigsinv(unsigned long sigs)
+sigset_t cfs_block_sigsinv(unsigned long sigs)
 {
-        unsigned long flags;
-        cfs_sigset_t old;
+       unsigned long flags;
+       sigset_t old;
 
-        SIGNAL_MASK_LOCK(current, flags);
-        old = current->blocked;
-        siginitsetinv(&current->blocked, sigs);
-        RECALC_SIGPENDING;
-        SIGNAL_MASK_UNLOCK(current, flags);
+       SIGNAL_MASK_LOCK(current, flags);
+       old = current->blocked;
+       sigaddsetmask(&current->blocked, ~sigs);
+       RECALC_SIGPENDING;
+       SIGNAL_MASK_UNLOCK(current, flags);
 
-        return old;
+       return old;
 }
 
 void