[Ocfs2-commits] mfasheh commits r1381 - trunk/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Aug 24 19:20:50 CDT 2004


Author: mfasheh
Date: 2004-08-24 19:20:48 -0500 (Tue, 24 Aug 2004)
New Revision: 1381

Modified:
   trunk/src/file.c
   trunk/src/util.c
   trunk/src/util.h
Log:
* combine our signal functions



Modified: trunk/src/file.c
===================================================================
--- trunk/src/file.c	2004-08-24 23:56:18 UTC (rev 1380)
+++ trunk/src/file.c	2004-08-25 00:20:48 UTC (rev 1381)
@@ -85,56 +85,13 @@
 	return sync_mapping_buffers(inode->i_mapping);
 }
 
-static void ocfs_block_sigs(sigset_t *oldsigs)
-{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-	sigset_t tmpsig;
-
-	siginitsetinv(&tmpsig, SHUTDOWN_SIGS);
-	sigprocmask(SIG_BLOCK, &tmpsig, oldsigs);
-#else
-#ifdef HAVE_NPTL
-	spin_lock_irq (&current->sighand->siglock);
-	*oldsigs = current->blocked;
-	siginitsetinv (&current->blocked, SHUTDOWN_SIGS);
-	recalc_sigpending ();
-	spin_unlock_irq (&current->sighand->siglock);
-#else
-	spin_lock_irq (&current->sigmask_lock);
-	*oldsigs = current->blocked;
-	siginitsetinv (&current->blocked, SHUTDOWN_SIGS);
-	recalc_sigpending (current);
-	spin_unlock_irq (&current->sigmask_lock);
-#endif
-#endif
-}
-
-static void ocfs_unblock_sigs(sigset_t newsig)
-{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-	sigprocmask(SIG_SETMASK, &newsig, NULL);
-#else
-#ifdef HAVE_NPTL
-       	spin_lock_irq (&current->sighand->siglock);
-	current->blocked = newsig;
-	recalc_sigpending ();
-	spin_unlock_irq (&current->sighand->siglock);
-#else
-	spin_lock_irq (&current->sigmask_lock);
-	current->blocked = newsig;
-	recalc_sigpending (current);
-	spin_unlock_irq (&current->sigmask_lock);
-#endif
-#endif
-}
-
 static inline int ocfs_wait_on_first_open(ocfs_super *osb, 
 					   struct inode *inode) 
 {
 	int status = 0;
 	sigset_t tmpsig;
 
-	ocfs_block_sigs(&tmpsig);
+	ocfs_block_sigs(&tmpsig, SHUTDOWN_SIGS);
 again:
 	if (signal_pending(current)) {
 		status = -EINTR;

Modified: trunk/src/util.c
===================================================================
--- trunk/src/util.c	2004-08-24 23:56:18 UTC (rev 1380)
+++ trunk/src/util.c	2004-08-25 00:20:48 UTC (rev 1381)
@@ -46,6 +46,53 @@
 
 static void ocfs_timeout_func(unsigned long data);
 
+/* block all but 'mask' sigs, optionally saving off our previous
+ * signal state. */
+void ocfs_block_sigs(sigset_t *oldsigs, unsigned long mask)
+{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+	sigset_t tmpsig;
+
+	siginitsetinv(&tmpsig, mask);
+	sigprocmask(SIG_BLOCK, &tmpsig, oldsigs);
+#else
+#ifdef HAVE_NPTL
+	spin_lock_irq (&current->sighand->siglock);
+	if (oldsigs)
+		*oldsigs = current->blocked;
+	siginitsetinv (&current->blocked, mask);
+	recalc_sigpending ();
+	spin_unlock_irq (&current->sighand->siglock);
+#else
+	spin_lock_irq (&current->sigmask_lock);
+	if (oldsigs)
+		*oldsigs = current->blocked;
+	siginitsetinv (&current->blocked, mask);
+	recalc_sigpending (current);
+	spin_unlock_irq (&current->sigmask_lock);
+#endif
+#endif
+}
+
+void ocfs_unblock_sigs(sigset_t newsig)
+{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+	sigprocmask(SIG_SETMASK, &newsig, NULL);
+#else
+#ifdef HAVE_NPTL
+       	spin_lock_irq (&current->sighand->siglock);
+	current->blocked = newsig;
+	recalc_sigpending ();
+	spin_unlock_irq (&current->sighand->siglock);
+#else
+	spin_lock_irq (&current->sigmask_lock);
+	current->blocked = newsig;
+	recalc_sigpending (current);
+	spin_unlock_irq (&current->sigmask_lock);
+#endif
+#endif
+}
+
 /*
  * ocfs_daemonize() 
  *
@@ -68,21 +115,6 @@
 	return;
 }				/* ocfs_daemonize */
 #else
-
-static inline void ocfs_block_sigs(unsigned long mask)
-{
-#ifdef HAVE_NPTL
-	spin_lock_irq (&current->sighand->siglock);
-	siginitsetinv (&current->blocked, mask);
-	recalc_sigpending ();
-	spin_unlock_irq (&current->sighand->siglock);
-#else
-	spin_lock_irq (&current->sigmask_lock);
-	siginitsetinv (&current->blocked, mask);
-	recalc_sigpending (current);
-	spin_unlock_irq (&current->sigmask_lock);
-#endif
-}
 void ocfs_daemonize (char *name, int len, int shutdown_sigs)
 {
 	daemonize ();
@@ -96,9 +128,9 @@
 	}
 
 	if (shutdown_sigs)
-		ocfs_block_sigs(SHUTDOWN_SIGS);
+		ocfs_block_sigs(NULL, SHUTDOWN_SIGS);
 	else
-		ocfs_block_sigs(0);
+		ocfs_block_sigs(NULL, 0);
 	return;
 }				/* ocfs_daemonize */
 #endif

Modified: trunk/src/util.h
===================================================================
--- trunk/src/util.h	2004-08-24 23:56:18 UTC (rev 1380)
+++ trunk/src/util.h	2004-08-25 00:20:48 UTC (rev 1381)
@@ -38,6 +38,8 @@
 int ocfs_sleep(__u32 ms);
 void ocfs_truncate_inode_pages(struct inode *inode, loff_t off);
 int __ocfs_wait_atomic_eq(wait_queue_head_t *wq, atomic_t *var, int val, int ms);
+void ocfs_block_sigs(sigset_t *oldsigs, unsigned long mask);
+void ocfs_unblock_sigs(sigset_t newsig);
 
 /* exits when var == val, or on timeout */
 static inline int ocfs_wait_atomic_eq(wait_queue_head_t *wq, atomic_t *var, int val, int timeout)



More information about the Ocfs2-commits mailing list