1 /* file.h 4.10 81/11/14 */ 2 3 /* 4 * One file structure is allocated 5 * for each open/creat/pipe call. 6 * Main use is to hold the read/write 7 * pointer associated with each open 8 * file. 9 */ 10 struct file { 11 short f_flag; /* see below */ 12 short f_count; /* reference count */ 13 struct inode *f_inode; /* inode */ 14 union { 15 struct f_in { 16 off_t fi_offset; 17 } f_in; 18 struct f_so { 19 struct socket *fs_socket; 20 } f_so; 21 } f_un; 22 }; 23 #define f_offset f_un.f_in.fi_offset 24 #define f_socket f_un.f_so.fs_socket 25 26 #ifdef KERNEL 27 struct file *file, *fileNFILE; 28 int nfile; 29 struct file *getf(); 30 struct file *falloc(); 31 #endif 32 33 /* flags */ 34 #define FINODE 0x0 /* descriptor of an inode (pseudo) */ 35 #define FREAD 0x1 /* descriptor read/receive'able */ 36 #define FWRITE 0x2 /* descriptor write/send'able */ 37 #define FSOCKET 0x4 /* descriptor of a socket */ 38 #define FPORTAL 0x8 /* descriptor of a portal */ 39