[LWN Logo]

To:     linux-kernel@vger.rutgers.edu
From:   o.r.c@p.e.l.l.p.o.r.t.l.a.n.d.o.r.u.s (david parsons)
Subject: [PATCH] putting old-style lock handling back into 2.2.10
Date:   4 Jul 1999 16:08:59 -0700

I noticed (when it made one of my test machines blow up and die) that
2.2 doesn't support the old-style F_EXLCK locking anymore.   This little
patch (against 2.2.10) puts that locking back, so that people using a.out
gdbm programs won't have them blow up on them.

                 ____
   david parsons \bi/ Backwards compatability is good.
                  \/

--- linux-2.2.10-orig/fs/locks.c	Tue May 11 08:52:14 1999
+++ linux-2.2.10/fs/locks.c	Sun Jul  4 15:48:15 1999
@@ -441,10 +441,10 @@
 		       current->pid, current->comm);
 	}
 }
+#endif
 		if (!(filp->f_mode & 3))
 			goto out_putf;
 		break;
-#endif
 	default:
 		error = -EINVAL;
 		goto out_putf;
@@ -648,11 +648,22 @@
 	
 	fl->fl_flags = FL_POSIX;
 
+	/*
+	 * remap old-style locks into the locking method de jour
+	 */
 	switch (l->l_type) {
 	case F_RDLCK:
 	case F_WRLCK:
 	case F_UNLCK:
 		fl->fl_type = l->l_type;
+		break;
+	case F_SHLCK :
+		fl->fl_type = F_RDLCK;
+		/*fl->fl_flags |= F_BROKEN;*/
+		break;
+	case F_EXLCK :
+		fl->fl_type = F_WRLCK;
+		/*fl->fl_flags |= F_BROKEN;*/
 		break;
 	default:
 		return (0);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/