/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 1999,2001-2002 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License"). You may not use this file except in compliance with the
- * License. Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
-/* (c) 1997-1998 Apple Computer, Inc. All Rights Reserved */
+/* (c) 1997-1998,2001 Apple Computer, Inc. All Rights Reserved */
/*
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
#include <sys/malloc.h>
#include <sys/fcntl.h>
+#include "hfs_cnode.h"
#include "hfs_lockf.h"
-#include "hfs.h"
/*
* This variable controls the maximum number of processes that will
register struct hfslockf *lock;
{
register struct hfslockf *block;
- struct hfsnode *hp = lock->lf_hfsnode;
+ struct filefork *fork = lock->lf_fork;
struct hfslockf **prev, *overlap, *ltmp;
static char lockstr[] = "hfslockf";
int ovcase, priority, needtolink, error;
* Skip over locks owned by other processes.
* Handle any locks that overlap and are owned by ourselves.
*/
- prev = &hp->h_lockf;
- block = hp->h_lockf;
+ prev = &fork->ff_lockf;
+ block = fork->ff_lockf;
needtolink = 1;
for (;;) {
if ((ovcase = hfs_findoverlap(block, lock, SELF, &prev, &overlap)))
}
/*
- * Remove a byte-range lock on an hfsnode.
+ * Remove a file fork's byte-range lock.
*
* Generally, find the lock (or an overlap to that lock)
* and remove it (or shrink it), then wakeup anyone we can.
hfs_clearlock(unlock)
register struct hfslockf *unlock;
{
- struct hfsnode *hp = unlock->lf_hfsnode;
- register struct hfslockf *lf = hp->h_lockf;
+ struct filefork *fork = unlock->lf_fork;
+ register struct hfslockf *lf = fork->ff_lockf;
struct hfslockf *overlap, **prev;
int ovcase;
if (lockf_debug & 1)
hfs_lprint("hfs_clearlock", unlock);
#endif /* LOCKF_DEBUG */
- prev = &hp->h_lockf;
+ prev = &fork->ff_lockf;
while ((ovcase = hfs_findoverlap(lf, unlock, SELF, &prev, &overlap))) {
/*
* Wakeup the list of locks to be retried.
}
/*
- * Walk the list of locks for an hfsnode and
+ * Walk a file fork's list of locks and
* return the first blocking lock.
*/
struct hfslockf *
hfs_getblock(lock)
register struct hfslockf *lock;
{
- struct hfslockf **prev, *overlap, *lf = lock->lf_hfsnode->h_lockf;
+ struct hfslockf **prev, *overlap, *lf = lock->lf_fork->ff_lockf;
int ovcase;
- prev = &lock->lf_hfsnode->h_lockf;
+ prev = &lock->lf_fork->ff_lockf;
while ((ovcase = hfs_findoverlap(lf, lock, OTHERS, &prev, &overlap))) {
/*
* We've found an overlap, see if it blocks us
}
/*
- * Walk the list of locks for an hfsnode to
+ * Walk a file fork's list of locks to
* find an overlapping lock (if any).
*
* NOTE: this returns only the FIRST overlapping lock. There
else
printf("id 0x%x", lock->lf_id);
printf(" in ino %d on dev <%d, %d>, %s, start %d, end %d",
- lock->lf_hfsnode->i_number,
- major(lock->lf_hfsnode->h_dev),
- minor(lock->lf_hfsnode->h_dev),
+ FTOC(lock->lf_fork)->c_fileid,
+ major(FTOC(lock->lf_fork)->c_dev),
+ minor(FTOC(lock->lf_fork)->c_dev),
lock->lf_type == F_RDLCK ? "shared" :
lock->lf_type == F_WRLCK ? "exclusive" :
lock->lf_type == F_UNLCK ? "unlock" :
register struct hfslockf *lf, *blk;
printf("%s: Lock list for ino %d on dev <%d, %d>:\n",
- tag, lock->lf_hfsnode->i_number,
- major(lock->lf_hfsnode->h_dev),
- minor(lock->lf_hfsnode->h_dev));
- for (lf = lock->lf_hfsnode->h_lockf; lf; lf = lf->lf_next) {
+ tag, FTOC(lock->lf_fork)->i_number,
+ major(FTOC(lock->lf_fork)->c_dev),
+ minor(FTOC(lock->lf_fork)->c_dev));
+ for (lf = lock->lf_fork->ff_lockf; lf; lf = lf->lf_next) {
printf("\tlock 0x%lx for ", lf);
if (lf->lf_flags & F_POSIX)
printf("proc %d", ((struct proc *)(lf->lf_id))->p_pid);