Re: patch to 2.1.81 to get a clean compile on i386

Shaw Carruthers (shaw@shawc.demon.co.uk)
Sun, 25 Jan 1998 21:01:38 +0000 (GMT)


Re the ftape patches, don't you need something like the attached so the
changes to sigsets are protected. I have been unable to test this under
2.1.81 which won't compile because of the known other problems.

diff -ur linux-2.1.81/drivers/char/ftape/zftape/zftape-init.c /usr/local/src/ftape-3.04d/ftape/zftape/zftape-init.c
--- linux-2.1.81/drivers/char/ftape/zftape/zftape-init.c Sat Jan 24 13:01:14 1998
+++ /usr/local/src/ftape-3.04d/ftape/zftape/zftape-init.c Sun Jan 25 13:35:10 1998
@@ -138,6 +138,26 @@
NULL, /* fsync */
};

+/* fix signal handling */
+
+void sigblockall( sigset_t * oldmask )
+{
+ spin_lock_irq(&current->sigmask_lock);
+ *oldmask = current->blocked;
+ sigfillset(&current->blocked);
+ recalc_sigpending(current);
+ spin_unlock_irq(&current->sigmask_lock);
+}
+
+void sigrestoreold ( sigset_t * oldmask)
+{
+ spin_lock_irq(&current->sigmask_lock);
+ current->blocked = *oldmask;
+ recalc_sigpending(current);
+ spin_unlock_irq(&current->sigmask_lock);
+}
+
+
/* Open floppy tape device
*/
static int zft_open(struct inode *ino, struct file *filep)
@@ -170,11 +190,10 @@
#endif
TRACE_ABORT(-ENXIO, ft_t_err, "failed: illegal unit nr");
}
- orig_sigmask = current->blocked;
- sigfillset(&current->blocked);
+ sigblockall(&orig_sigmask);
result = _zft_open(MINOR(ino->i_rdev), filep->f_flags & O_ACCMODE);
if (result < 0) {
- current->blocked = orig_sigmask; /* restore mask */
+ sigrestoreold( &orig_sigmask); /* restore mask */
busy_flag = 0;
#if defined(MODULE) && LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
if (!zft_dirty()) {
@@ -186,8 +205,8 @@
/* Mask signals that will disturb proper operation of the
* program that is calling.
*/
- current->blocked = orig_sigmask;
- sigaddsetmask (&current->blocked, _DO_BLOCK);
+ sigaddsetmask (&orig_sigmask, _DO_BLOCK);
+ sigrestoreold (&orig_sigmask);
TRACE_EXIT 0;
}
}
@@ -207,12 +226,12 @@
TRACE_EXIT; /* keep busy_flag !(?) */
#endif
}
- sigfillset(&current->blocked);
+ sigblockall(&orig_sigmask);
result = _zft_close();
if (result < 0) {
TRACE(ft_t_err, "_zft_close failed");
}
- current->blocked = orig_sigmask; /* restore before open state */
+ sigrestoreold( &orig_sigmask); /* restore before open state */
busy_flag = 0;
#if defined(MODULE) && LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
if (!zft_dirty()) {
@@ -239,11 +258,10 @@
TRACE_ABORT(-EIO, ft_t_err,
"failed: not busy, failure or wrong unit");
}
- old_sigmask = current->blocked; /* save mask */
- sigfillset(&current->blocked);
+ sigblockall(&old_sigmask); /* save mask */
/* This will work as long as sizeof(void *) == sizeof(long) */
result = _zft_ioctl(command, (void *) arg);
- current->blocked = old_sigmask; /* restore mask */
+ sigrestoreold(&old_sigmask); /* restore mask */
TRACE_EXIT result;
}

@@ -272,8 +290,7 @@
TRACE_ABORT(-EIO, ft_t_err,
"failed: not busy, failure or wrong unit");
}
- old_sigmask = current->blocked; /* save mask */
- sigfillset(&current->blocked);
+ sigblockall(&old_sigmask); /* save mask */
if ((result = ftape_mmap(vma)) >= 0) {
#ifndef MSYNC_BUG_WAS_FIXED
static struct vm_operations_struct dummy = { NULL, };
@@ -286,7 +303,7 @@
inode_inc_count (ino);
#endif
}
- current->blocked = old_sigmask; /* restore mask */
+ sigrestoreold(&old_sigmask); /* restore mask */
TRACE_EXIT result;
}

@@ -315,10 +332,9 @@
TRACE_ABORT(-EIO, ft_t_err,
"failed: not busy, failure or wrong unit");
}
- old_sigmask = current->blocked; /* save mask */
- sigfillset(&current->blocked);
+ sigblockall(&old_sigmask); /* save mask */
result = _zft_read(buff, req_len);
- current->blocked = old_sigmask; /* restore mask */
+ sigrestoreold(&old_sigmask); /* restore mask */
TRACE(ft_t_data_flow, "return with count: %d", result);
TRACE_EXIT result;
}
@@ -351,10 +367,9 @@
TRACE_ABORT(-EIO, ft_t_err,
"failed: not busy, failure or wrong unit");
}
- old_sigmask = current->blocked; /* save mask */
- sigfillset(&current->blocked);
+ sigblockall(&old_sigmask); /* save mask */
result = _zft_write(buff, req_len);
- current->blocked = old_sigmask; /* restore mask */
+ sigrestoreold(&old_sigmask); /* restore mask */
TRACE(ft_t_data_flow, "return with count: %d", result);
TRACE_EXIT result;
}

--
Shaw Carruthers - shaw@shawc.demon.co.uk
London SW14 7JW UK
This is not a sig( with homage to Magritte).