xref: /minix3/minix/servers/vfs/tll.h (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc #ifndef __VFS_TLL_H__
2*433d6423SLionel Sambuc #define __VFS_TLL_H__
3*433d6423SLionel Sambuc 
4*433d6423SLionel Sambuc /* Three-level-lock. Allows read-only, read-serialized, and write-only locks */
5*433d6423SLionel Sambuc 
6*433d6423SLionel Sambuc typedef enum { TLL_NONE, TLL_READ, TLL_READSER, TLL_WRITE } tll_access_t;
7*433d6423SLionel Sambuc typedef enum { TLL_DFLT = 0x0, TLL_UPGR = 0x1, TLL_PEND = 0x2 } tll_status_t;
8*433d6423SLionel Sambuc 
9*433d6423SLionel Sambuc typedef struct {
10*433d6423SLionel Sambuc   tll_access_t t_current;	/* Current type of access to lock */
11*433d6423SLionel Sambuc   struct worker_thread *t_owner;/* Owner of non-read-only lock */
12*433d6423SLionel Sambuc   signed int t_readonly;	/* No. of current read-only access */
13*433d6423SLionel Sambuc   tll_status_t t_status;	/* Lock status; nothing, pending upgrade, or
14*433d6423SLionel Sambuc 				 * pending upgrade of read-serialized to
15*433d6423SLionel Sambuc 				 * write-only */
16*433d6423SLionel Sambuc   struct worker_thread *t_write;/* Write/read-only access requestors queue */
17*433d6423SLionel Sambuc   struct worker_thread *t_serial;/* Read-serialized access requestors queue */
18*433d6423SLionel Sambuc } tll_t;
19*433d6423SLionel Sambuc 
20*433d6423SLionel Sambuc #endif
21