1433d6423SLionel Sambuc #ifndef __VFS_FILE_H__ 2433d6423SLionel Sambuc #define __VFS_FILE_H__ 3433d6423SLionel Sambuc 4433d6423SLionel Sambuc /* This is the filp table. It is an intermediary between file descriptors and 5433d6423SLionel Sambuc * inodes. A slot is free if filp_count == 0. 6433d6423SLionel Sambuc */ 7433d6423SLionel Sambuc 8433d6423SLionel Sambuc EXTERN struct filp { 9433d6423SLionel Sambuc mode_t filp_mode; /* RW bits, telling how file is opened */ 10433d6423SLionel Sambuc int filp_flags; /* flags from open and fcntl */ 11433d6423SLionel Sambuc int filp_count; /* how many file descriptors share this slot?*/ 12433d6423SLionel Sambuc struct vnode *filp_vno; /* vnode belonging to this file */ 13433d6423SLionel Sambuc off_t filp_pos; /* file position */ 14433d6423SLionel Sambuc mutex_t filp_lock; /* lock to gain exclusive access */ 15433d6423SLionel Sambuc struct fproc *filp_softlock; /* if not NULL; this filp didn't lock the 16433d6423SLionel Sambuc * vnode. Another filp already holds a lock 17433d6423SLionel Sambuc * for this thread */ 18433d6423SLionel Sambuc struct fproc *filp_ioctl_fp; /* if not NULL, this filp is locked by the 19433d6423SLionel Sambuc * process for a currently ongoing IOCTL call 20433d6423SLionel Sambuc */ 21433d6423SLionel Sambuc 22433d6423SLionel Sambuc /* the following fields are for select() and are owned by the generic 23433d6423SLionel Sambuc * select() code (i.e., fd-type-specific select() code can't touch these). 24433d6423SLionel Sambuc * These fields may be changed without holding the filp lock. 25433d6423SLionel Sambuc */ 26433d6423SLionel Sambuc int filp_selectors; /* select()ing processes blocking on this fd */ 27433d6423SLionel Sambuc int filp_select_ops; /* interested in these SEL_* operations */ 28433d6423SLionel Sambuc int filp_select_flags; /* Select flags for the filp */ 29433d6423SLionel Sambuc 30433d6423SLionel Sambuc /* following are for fd-type-specific select() */ 31*e3b8d4bbSDavid van Moolenbroek int filp_pipe_select_ops; /* used for pipes */ 32*e3b8d4bbSDavid van Moolenbroek dev_t filp_select_dev; /* used for character and socket devices */ 33433d6423SLionel Sambuc } filp[NR_FILPS]; 34433d6423SLionel Sambuc 35433d6423SLionel Sambuc #define FILP_CLOSED 0 /* filp_mode: associated device closed/gone */ 36433d6423SLionel Sambuc 37433d6423SLionel Sambuc #define FSF_UPDATE 001 /* The driver should be informed about new 38433d6423SLionel Sambuc * state. 39433d6423SLionel Sambuc */ 40433d6423SLionel Sambuc #define FSF_BUSY 002 /* Select operation sent to driver but no 41433d6423SLionel Sambuc * reply yet. 42433d6423SLionel Sambuc */ 43433d6423SLionel Sambuc #define FSF_RD_BLOCK 010 /* Read request is blocking, the driver should 44433d6423SLionel Sambuc * keep state. 45433d6423SLionel Sambuc */ 46433d6423SLionel Sambuc #define FSF_WR_BLOCK 020 /* Write request is blocking */ 47433d6423SLionel Sambuc #define FSF_ERR_BLOCK 040 /* Exception request is blocking */ 48433d6423SLionel Sambuc #define FSF_BLOCKED 070 49433d6423SLionel Sambuc #endif 50