Commit | Line | Data |
---|---|---|
f3e2d1ca KM |
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 | * | |
b82bf63d | 10 | * @(#)lockf.h 7.2 (Berkeley) %G% |
f3e2d1ca KM |
11 | */ |
12 | ||
13 | /* | |
b82bf63d KB |
14 | * The lockf structure is a kernel structure which contains the information |
15 | * associated with a byte range lock. The lockf structures are linked into | |
16 | * the inode structure. Locks are sorted by the starting byte of the lock for | |
17 | * efficiency. | |
f3e2d1ca KM |
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 | ||
b82bf63d | 30 | /* Maximum length of sleep chains to traverse to try and detect deadlock. */ |
f3e2d1ca KM |
31 | #define MAXDEPTH 50 |
32 | ||
b82bf63d KB |
33 | __BEGIN_DECLS |
34 | void lf_addblock __P((struct lockf *, struct lockf *)); | |
35 | int lf_clearlock __P((struct lockf *)); | |
36 | int lf_findoverlap __P((struct lockf *, | |
37 | struct lockf *, int, struct lockf ***, struct lockf **)); | |
38 | struct lockf * | |
39 | lf_getblock __P((struct lockf *)); | |
40 | int lf_getlock __P((struct lockf *, struct flock *)); | |
41 | int lf_setlock __P((struct lockf *)); | |
42 | void lf_split __P((struct lockf *, struct lockf *)); | |
43 | void lf_wakelock __P((struct lockf *)); | |
44 | __END_DECLS | |
f3e2d1ca | 45 | |
b82bf63d | 46 | #ifdef LOCKF_DEBUG |
f3e2d1ca | 47 | extern int lockf_debug; |
b82bf63d KB |
48 | |
49 | __BEGIN_DECLS | |
50 | void lf_print __P((char *, struct lockf *)); | |
51 | void lf_printlist __P((char *, struct lockf *)); | |
52 | __END_DECLS | |
53 | #endif |