fileio.h 6.1 KB
Newer Older
T
t00498749 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
#ifndef CYGONCE_FILEIO_H
#define CYGONCE_FILEIO_H
//=============================================================================
//
//      fileio.h
//
//      Fileio header
//
//=============================================================================
// ####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later
// version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License
// along with eCos; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
//
// As a special exception, if other files instantiate templates or use
// macros or inline functions from this file, or you compile this file
// and link it with other works to produce a work based on this file,
// this file does not by itself cause the resulting work to be covered by
// the GNU General Public License. However the source code for this file
// must still be made available in accordance with section (3) of the GNU
// General Public License v2.
//
// This exception does not invalidate any other reasons why a work based
// on this file might be covered by the GNU General Public License.
// -------------------------------------------
// ####ECOSGPLCOPYRIGHTEND####
//=============================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s):     nickg
// Contributors:  nickg
// Date:          2000-05-25
// Purpose:       Fileio header
// Description:   This header contains the external definitions of the general file
//                IO subsystem for POSIX and EL/IX compatability.
//
// Usage:
//              #include <fileio.h>
//              ...
//
//
//####DESCRIPTIONEND####
//
//=============================================================================
J
j00316535 已提交
59
#include "fs_other.h"
T
t00498749 已提交
60 61

#include <limits.h>
J
j00316535 已提交
62
#include <stddef.h>             // NULL, size_t
T
t00498749 已提交
63
#include <sys/types.h>
J
j00316535 已提交
64 65 66 67 68 69 70 71
#include <zconf.h>
#include "fcntl.h"

#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
T
t00498749 已提交
72 73 74 75 76 77 78 79 80 81 82 83 84 85

//=============================================================================


struct  cyg_fstab_entry;
typedef struct  cyg_fstab_entry  cyg_fstab_entry;

struct CYG_FILEOPS_TAG;
typedef struct CYG_FILEOPS_TAG cyg_fileops;

struct CYG_FILE_TAG;
typedef struct CYG_FILE_TAG cyg_file;

struct CYG_IOVEC_TAG;
J
j00316535 已提交
86
typedef struct CYG_IOVEC_TAG jffs2_iovec;
T
t00498749 已提交
87 88

struct CYG_UIO_TAG;
J
j00316535 已提交
89
typedef struct CYG_UIO_TAG jffs2_uio;
T
t00498749 已提交
90

J
j00316535 已提交
91
typedef struct  IATTR  iattr;
T
t00498749 已提交
92 93 94

//=============================================================================
// Directory pointer
J
j00316535 已提交
95
#define CYG_ADDRWORD UINTPTR
T
t00498749 已提交
96 97
typedef CYG_ADDRWORD cyg_dir;

J
j00316535 已提交
98
#define JFFS2_DIR_NULL 0
T
t00498749 已提交
99 100 101

//=============================================================================

J
j00316535 已提交
102
struct jffs2_stat;
T
t00498749 已提交
103 104 105 106 107 108 109 110 111

//=============================================================================
// Mount table entry

struct cyg_mtab_entry
{
    const char          *name;          // name of mount point
    const char          *fsname;        // name of implementing filesystem
    const char          *devname;       // name of hardware device
J
j00316535 已提交
112
    CYG_ADDRWORD      data;           // private data value
T
t00498749 已提交
113 114

    // The following are filled in after a successful mount operation
J
j00316535 已提交
115 116 117 118 119
    int                 valid;          // Valid entry?
    //jffs2_fstab_entry   *fs;            // pointer to fstab entry
    cyg_dir           root;           // root directory pointer
} ; // JFFS2_HAL_TABLE_TYPE;  // prife
typedef struct cyg_mtab_entry cyg_mtab_entry;
T
t00498749 已提交
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
//=============================================================================
// IO vector descriptors

struct CYG_IOVEC_TAG
{
    void           *iov_base;           /* Base address. */
    ssize_t        iov_len;             /* Length. */
};

enum	cyg_uio_rw { UIO_READ, UIO_WRITE };

/* Segment flag values. */
enum cyg_uio_seg
{
    UIO_USERSPACE,		        /* from user data space */
    UIO_SYSSPACE		        /* from system space */
};

struct CYG_UIO_TAG
{
    struct CYG_IOVEC_TAG *uio_iov;	/* pointer to array of iovecs */
J
j00316535 已提交
141 142 143 144 145
    int	                  uio_iovcnt;	/* number of iovecs in array */
    off_t       	      uio_offset;	/* offset into file this uio corresponds to */
    ssize_t     	      uio_resid;	/* residual i/o count */
    enum cyg_uio_seg      uio_segflg;    /* see above */
    enum cyg_uio_rw       uio_rw;        /* see above */
T
t00498749 已提交
146 147 148 149
};

struct CYG_FILE_TAG
{
J
j00316535 已提交
150 151 152 153 154
    UINT32	                    f_flag;		    /* file state                   */
    UINT16                      f_ucount;       /* use count                    */
    UINT16                      f_type;		    /* descriptor type              */
    UINT32                      f_syncmode;     /* synchronization protocol     */
    //struct CYG_FILEOPS_TAG      *f_ops;       /* file operations              */
T
t00498749 已提交
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
    off_t       	            f_offset;       /* current offset               */
    CYG_ADDRWORD	            f_data;		    /* file or socket               */
    CYG_ADDRWORD                f_xops;         /* extra type specific ops      */
    cyg_mtab_entry              *f_mte;         /* mount table entry            */
};


//-----------------------------------------------------------------------------
// Type of file

#define	CYG_FILE_TYPE_FILE      1	/* file */
#define	CYG_FILE_TYPE_SOCKET	2	/* communications endpoint */
#define	CYG_FILE_TYPE_DEVICE	3	/* device */

//-----------------------------------------------------------------------------

J
j00316535 已提交
171 172 173 174 175
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
T
t00498749 已提交
176

J
j00316535 已提交
177
#endif // ifndef JFFS2ONCE_FILEIO_H
T
t00498749 已提交
178
// End of fileio.h