| 1 | /* |
| 2 | * Copyright (c) 1991 The Regents of the University of California. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * This code is derived from software contributed to Berkeley by |
| 6 | * Scooter Morris at Genentech Inc. |
| 7 | * |
| 8 | * %sccs.include.redist.c% |
| 9 | * |
| 10 | * @(#)lockf.h 7.1 (Berkeley) %G% |
| 11 | */ |
| 12 | |
| 13 | /* |
| 14 | * The lockf structure is a kernel structure which contains all the |
| 15 | * information associated with a byte range lock. The lockf structures |
| 16 | * are linked into the inode structure. Locks are sorted by the starting |
| 17 | * byte of the lock for efficiency. |
| 18 | */ |
| 19 | struct lockf { |
| 20 | short lf_flags; /* Lock semantics: F_POSIX, F_FLOCK, F_WAIT */ |
| 21 | short lf_type; /* Lock type: F_RDLCK, F_WRLCK */ |
| 22 | off_t lf_start; /* The byte # of the start of the lock */ |
| 23 | off_t lf_end; /* The byte # of the end of the lock (-1=EOF)*/ |
| 24 | caddr_t lf_id; /* The id of the resource holding the lock */ |
| 25 | struct inode *lf_inode; /* Back pointer to the inode */ |
| 26 | struct lockf *lf_next; /* A pointer to the next lock on this inode */ |
| 27 | struct lockf *lf_block; /* The list of blocked locks */ |
| 28 | }; |
| 29 | |
| 30 | /* |
| 31 | * Maximum length of sleep chains to traverse to try and detect deadlock. |
| 32 | */ |
| 33 | #define MAXDEPTH 50 |
| 34 | |
| 35 | #ifdef KERNEL |
| 36 | /* |
| 37 | * Public lock manipulation routines |
| 38 | */ |
| 39 | extern struct lockf *lf_remove(); /* Remove a lock */ |
| 40 | extern struct lockf *lf_getblock(); /* Return the first blocking lock */ |
| 41 | |
| 42 | #ifdef LOCKF_DEBUG |
| 43 | extern int lockf_debug; |
| 44 | #endif LOCKF_DEBUG |
| 45 | #endif KERNEL |