1 #ifndef CYGONCE_FILEIO_H 2 #define CYGONCE_FILEIO_H 3 //============================================================================= 4 // 5 // fileio.h 6 // 7 // Fileio header 8 // 9 //============================================================================= 10 // ####ECOSGPLCOPYRIGHTBEGIN#### 11 // ------------------------------------------- 12 // This file is part of eCos, the Embedded Configurable Operating System. 13 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. 14 // 15 // eCos is free software; you can redistribute it and/or modify it under 16 // the terms of the GNU General Public License as published by the Free 17 // Software Foundation; either version 2 or (at your option) any later 18 // version. 19 // 20 // eCos is distributed in the hope that it will be useful, but WITHOUT 21 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 22 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 // for more details. 24 // 25 // You should have received a copy of the GNU General Public License 26 // along with eCos; if not, write to the Free Software Foundation, Inc., 27 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 28 // 29 // As a special exception, if other files instantiate templates or use 30 // macros or inline functions from this file, or you compile this file 31 // and link it with other works to produce a work based on this file, 32 // this file does not by itself cause the resulting work to be covered by 33 // the GNU General Public License. However the source code for this file 34 // must still be made available in accordance with section (3) of the GNU 35 // General Public License v2. 36 // 37 // This exception does not invalidate any other reasons why a work based 38 // on this file might be covered by the GNU General Public License. 39 // ------------------------------------------- 40 // ####ECOSGPLCOPYRIGHTEND#### 41 //============================================================================= 42 //#####DESCRIPTIONBEGIN#### 43 // 44 // Author(s): nickg 45 // Contributors: nickg 46 // Date: 2000-05-25 47 // Purpose: Fileio header 48 // Description: This header contains the external definitions of the general file 49 // IO subsystem for POSIX and EL/IX compatability. 50 // 51 // Usage: 52 // #include <fileio.h> 53 // ... 54 // 55 // 56 //####DESCRIPTIONEND#### 57 // 58 //============================================================================= 59 #include "fs_other.h" 60 61 #include <limits.h> 62 #include <stddef.h> // NULL, size_t 63 #include <sys/types.h> 64 #include <zconf.h> 65 #include "fcntl.h" 66 67 #ifdef __cplusplus 68 #if __cplusplus 69 extern "C" { 70 #endif /* __cplusplus */ 71 #endif /* __cplusplus */ 72 73 //============================================================================= 74 75 76 struct cyg_fstab_entry; 77 typedef struct cyg_fstab_entry cyg_fstab_entry; 78 79 struct CYG_FILEOPS_TAG; 80 typedef struct CYG_FILEOPS_TAG cyg_fileops; 81 82 struct CYG_FILE_TAG; 83 typedef struct CYG_FILE_TAG cyg_file; 84 85 struct CYG_IOVEC_TAG; 86 typedef struct CYG_IOVEC_TAG jffs2_iovec; 87 88 struct CYG_UIO_TAG; 89 typedef struct CYG_UIO_TAG jffs2_uio; 90 91 typedef struct IATTR iattr; 92 93 //============================================================================= 94 // Directory pointer 95 #define CYG_ADDRWORD UINTPTR 96 typedef CYG_ADDRWORD cyg_dir; 97 98 #define JFFS2_DIR_NULL 0 99 100 //============================================================================= 101 102 struct jffs2_stat; 103 104 //============================================================================= 105 // Mount table entry 106 107 struct cyg_mtab_entry 108 { 109 const char *name; // name of mount point 110 const char *fsname; // name of implementing filesystem 111 const char *devname; // name of hardware device 112 CYG_ADDRWORD data; // private data value 113 114 // The following are filled in after a successful mount operation 115 int valid; // Valid entry? 116 //jffs2_fstab_entry *fs; // pointer to fstab entry 117 cyg_dir root; // root directory pointer 118 } ; // JFFS2_HAL_TABLE_TYPE; // prife 119 typedef struct cyg_mtab_entry cyg_mtab_entry; 120 //============================================================================= 121 // IO vector descriptors 122 123 struct CYG_IOVEC_TAG 124 { 125 void *iov_base; /* Base address. */ 126 ssize_t iov_len; /* Length. */ 127 }; 128 129 enum cyg_uio_rw { UIO_READ, UIO_WRITE }; 130 131 /* Segment flag values. */ 132 enum cyg_uio_seg 133 { 134 UIO_USERSPACE, /* from user data space */ 135 UIO_SYSSPACE /* from system space */ 136 }; 137 138 struct CYG_UIO_TAG 139 { 140 struct CYG_IOVEC_TAG *uio_iov; /* pointer to array of iovecs */ 141 int uio_iovcnt; /* number of iovecs in array */ 142 off_t uio_offset; /* offset into file this uio corresponds to */ 143 ssize_t uio_resid; /* residual i/o count */ 144 enum cyg_uio_seg uio_segflg; /* see above */ 145 enum cyg_uio_rw uio_rw; /* see above */ 146 }; 147 148 struct CYG_FILE_TAG 149 { 150 UINT32 f_flag; /* file state */ 151 UINT16 f_ucount; /* use count */ 152 UINT16 f_type; /* descriptor type */ 153 UINT32 f_syncmode; /* synchronization protocol */ 154 //struct CYG_FILEOPS_TAG *f_ops; /* file operations */ 155 off_t f_offset; /* current offset */ 156 CYG_ADDRWORD f_data; /* file or socket */ 157 CYG_ADDRWORD f_xops; /* extra type specific ops */ 158 cyg_mtab_entry *f_mte; /* mount table entry */ 159 }; 160 161 162 //----------------------------------------------------------------------------- 163 // Type of file 164 165 #define CYG_FILE_TYPE_FILE 1 /* file */ 166 #define CYG_FILE_TYPE_SOCKET 2 /* communications endpoint */ 167 #define CYG_FILE_TYPE_DEVICE 3 /* device */ 168 169 //----------------------------------------------------------------------------- 170 171 #ifdef __cplusplus 172 #if __cplusplus 173 } 174 #endif /* __cplusplus */ 175 #endif /* __cplusplus */ 176 177 #endif // ifndef JFFS2ONCE_FILEIO_H 178 // End of fileio.h 179