1 #ifndef __VFS_FILE_H__ 2 #define __VFS_FILE_H__ 3 4 /* This is the filp table. It is an intermediary between file descriptors and 5 * inodes. A slot is free if filp_count == 0. 6 */ 7 8 EXTERN struct filp { 9 mode_t filp_mode; /* RW bits, telling how file is opened */ 10 int filp_flags; /* flags from open and fcntl */ 11 int filp_count; /* how many file descriptors share this slot?*/ 12 struct vnode *filp_vno; /* vnode belonging to this file */ 13 off_t filp_pos; /* file position */ 14 mutex_t filp_lock; /* lock to gain exclusive access */ 15 struct fproc *filp_softlock; /* if not NULL; this filp didn't lock the 16 * vnode. Another filp already holds a lock 17 * for this thread */ 18 struct fproc *filp_ioctl_fp; /* if not NULL, this filp is locked by the 19 * process for a currently ongoing IOCTL call 20 */ 21 22 /* the following fields are for select() and are owned by the generic 23 * select() code (i.e., fd-type-specific select() code can't touch these). 24 * These fields may be changed without holding the filp lock. 25 */ 26 int filp_selectors; /* select()ing processes blocking on this fd */ 27 int filp_select_ops; /* interested in these SEL_* operations */ 28 int filp_select_flags; /* Select flags for the filp */ 29 30 /* following are for fd-type-specific select() */ 31 int filp_pipe_select_ops; 32 dev_t filp_char_select_dev; 33 } filp[NR_FILPS]; 34 35 #define FILP_CLOSED 0 /* filp_mode: associated device closed/gone */ 36 37 #define FSF_UPDATE 001 /* The driver should be informed about new 38 * state. 39 */ 40 #define FSF_BUSY 002 /* Select operation sent to driver but no 41 * reply yet. 42 */ 43 #define FSF_RD_BLOCK 010 /* Read request is blocking, the driver should 44 * keep state. 45 */ 46 #define FSF_WR_BLOCK 020 /* Write request is blocking */ 47 #define FSF_ERR_BLOCK 040 /* Exception request is blocking */ 48 #define FSF_BLOCKED 070 49 #endif 50