kern_lockf.c (41059) | kern_lockf.c (43301) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Scooter Morris at Genentech Inc. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * @(#)ufs_lockf.c 8.3 (Berkeley) 1/6/94 | 1/* 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Scooter Morris at Genentech Inc. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * @(#)ufs_lockf.c 8.3 (Berkeley) 1/6/94 |
37 * $Id: kern_lockf.c,v 1.19 1998/07/29 17:38:14 bde Exp $ | 37 * $Id: kern_lockf.c,v 1.20 1998/11/10 09:16:29 peter Exp $ |
38 */ 39 40#include "opt_debug_lockf.h" 41 42#include <sys/param.h> 43#include <sys/systm.h> 44#include <sys/kernel.h> 45#include <sys/lock.h> --- 309 unchanged lines hidden (view full) --- 355 /* 356 * If downgrading lock, others may be able to 357 * acquire it, otherwise take the list. 358 */ 359 if (lock->lf_type == F_RDLCK && 360 overlap->lf_type == F_WRLCK) { 361 lf_wakelock(overlap); 362 } else { | 38 */ 39 40#include "opt_debug_lockf.h" 41 42#include <sys/param.h> 43#include <sys/systm.h> 44#include <sys/kernel.h> 45#include <sys/lock.h> --- 309 unchanged lines hidden (view full) --- 355 /* 356 * If downgrading lock, others may be able to 357 * acquire it, otherwise take the list. 358 */ 359 if (lock->lf_type == F_RDLCK && 360 overlap->lf_type == F_WRLCK) { 361 lf_wakelock(overlap); 362 } else { |
363 while (ltmp = overlap->lf_blkhd.tqh_first) { | 363 while ((ltmp = overlap->lf_blkhd.tqh_first) != NULL) { |
364 TAILQ_REMOVE(&overlap->lf_blkhd, ltmp, 365 lf_block); 366 TAILQ_INSERT_TAIL(&lock->lf_blkhd, 367 ltmp, lf_block); 368 } 369 } 370 /* 371 * Add the new lock if necessary and delete the overlap. --- 340 unchanged lines hidden (view full) --- 712 * Wakeup a blocklist 713 */ 714static void 715lf_wakelock(listhead) 716 struct lockf *listhead; 717{ 718 register struct lockf *wakelock; 719 | 364 TAILQ_REMOVE(&overlap->lf_blkhd, ltmp, 365 lf_block); 366 TAILQ_INSERT_TAIL(&lock->lf_blkhd, 367 ltmp, lf_block); 368 } 369 } 370 /* 371 * Add the new lock if necessary and delete the overlap. --- 340 unchanged lines hidden (view full) --- 712 * Wakeup a blocklist 713 */ 714static void 715lf_wakelock(listhead) 716 struct lockf *listhead; 717{ 718 register struct lockf *wakelock; 719 |
720 while (wakelock = listhead->lf_blkhd.tqh_first) { | 720 while ((wakelock = listhead->lf_blkhd.tqh_first) != NULL) { |
721 TAILQ_REMOVE(&listhead->lf_blkhd, wakelock, lf_block); 722 wakelock->lf_next = NOLOCKF; 723#ifdef LOCKF_DEBUG 724 if (lockf_debug & 2) 725 lf_print("lf_wakelock: awakening", wakelock); 726#endif /* LOCKF_DEBUG */ 727 wakeup((caddr_t)wakelock); 728 } --- 78 unchanged lines hidden --- | 721 TAILQ_REMOVE(&listhead->lf_blkhd, wakelock, lf_block); 722 wakelock->lf_next = NOLOCKF; 723#ifdef LOCKF_DEBUG 724 if (lockf_debug & 2) 725 lf_print("lf_wakelock: awakening", wakelock); 726#endif /* LOCKF_DEBUG */ 727 wakeup((caddr_t)wakelock); 728 } --- 78 unchanged lines hidden --- |