⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fileio.h

📁 移植到WLIT项目的redboot源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
#ifndef CYGONCE_FILEIO_H#define CYGONCE_FILEIO_H//=============================================================================////      fileio.h////      Fileio header////=============================================================================//####COPYRIGHTBEGIN####//                                                                          // -------------------------------------------                              // The contents of this file are subject to the Red Hat eCos Public License // Version 1.1 (the "License"); you may not use this file except in         // compliance with the License.  You may obtain a copy of the License at    // http://www.redhat.com/                                                   //                                                                          // Software distributed under the License is distributed on an "AS IS"      // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the // License for the specific language governing rights and limitations under // the License.                                                             //                                                                          // The Original Code is eCos - Embedded Configurable Operating System,      // released September 30, 1998.                                             //                                                                          // The Initial Developer of the Original Code is Red Hat.                   // Portions created by Red Hat are                                          // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             // All Rights Reserved.                                                     // -------------------------------------------                              //                                                                          //####COPYRIGHTEND####//=============================================================================//#####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####////=============================================================================#include <pkgconf/hal.h>#include <pkgconf/kernel.h>#include <pkgconf/io_fileio.h>#include <cyg/infra/cyg_type.h>#include <cyg/hal/hal_tables.h>#include <stddef.h>             // NULL, size_t#include <limits.h>#include <sys/types.h>#include <fcntl.h>#include <sys/stat.h>//=============================================================================// forward definitionsstruct cyg_mtab_entry;typedef struct cyg_mtab_entry cyg_mtab_entry;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;typedef struct CYG_IOVEC_TAG cyg_iovec;struct CYG_UIO_TAG;typedef struct CYG_UIO_TAG cyg_uio;struct CYG_SELINFO_TAG;typedef struct CYG_SELINFO_TAG cyg_selinfo;//=============================================================================// Directory pointertypedef CYG_ADDRWORD cyg_dir;#define CYG_DIR_NULL 0//=============================================================================// Filesystem table entrytypedef int     cyg_fsop_mount    ( cyg_fstab_entry *fste, cyg_mtab_entry *mte );typedef int     cyg_fsop_umount   ( cyg_mtab_entry *mte );typedef int     cyg_fsop_open     ( cyg_mtab_entry *mte, cyg_dir dir, const char *name,                                    int mode,  cyg_file *fte );typedef int     cyg_fsop_unlink   ( cyg_mtab_entry *mte, cyg_dir dir, const char *name );typedef int     cyg_fsop_mkdir    ( cyg_mtab_entry *mte, cyg_dir dir, const char *name );typedef int     cyg_fsop_rmdir    ( cyg_mtab_entry *mte, cyg_dir dir, const char *name );typedef int     cyg_fsop_rename   ( cyg_mtab_entry *mte, cyg_dir dir1, const char *name1,                                    cyg_dir dir2, const char *name2 );typedef int     cyg_fsop_link     ( cyg_mtab_entry *mte, cyg_dir dir1, const char *name1,                                    cyg_dir dir2, const char *name2, int type );typedef int     cyg_fsop_opendir  ( cyg_mtab_entry *mte, cyg_dir dir, const char *name,                                    cyg_file *fte );typedef int     cyg_fsop_chdir    ( cyg_mtab_entry *mte, cyg_dir dir, const char *name,                                    cyg_dir *dir_out );typedef int     cyg_fsop_stat     ( cyg_mtab_entry *mte, cyg_dir dir, const char *name,                                    struct stat *buf);typedef int     cyg_fsop_getinfo  ( cyg_mtab_entry *mte, cyg_dir dir, const char *name,                                    int key, void *buf, int len );typedef int     cyg_fsop_setinfo  ( cyg_mtab_entry *mte, cyg_dir dir, const char *name,                                    int key, void *buf, int len );struct cyg_fstab_entry{    const char          *name;          // filesystem name    CYG_ADDRWORD        data;           // private data value    cyg_uint32          syncmode;       // synchronization mode        cyg_fsop_mount      *mount;    cyg_fsop_umount     *umount;    cyg_fsop_open       *open;    cyg_fsop_unlink     *unlink;    cyg_fsop_mkdir      *mkdir;    cyg_fsop_rmdir      *rmdir;    cyg_fsop_rename     *rename;    cyg_fsop_link       *link;    cyg_fsop_opendir    *opendir;    cyg_fsop_chdir      *chdir;    cyg_fsop_stat       *stat;    cyg_fsop_getinfo    *getinfo;    cyg_fsop_setinfo    *setinfo;} CYG_HAL_TABLE_TYPE;//-----------------------------------------------------------------------------// Keys for getinfo() and setinfo()#define FS_INFO_CONF            1       /* pathconf() */#define FS_INFO_ACCESS          2       /* access() */#define FS_INFO_GETCWD          3       /* getcwd() *///-----------------------------------------------------------------------------// Types for link()#define CYG_FSLINK_HARD         1       /* form a hard link */#define CYG_FSLINK_SOFT         2       /* form a soft link *///-----------------------------------------------------------------------------// getinfo() and setinfo() buffers structures.struct cyg_getcwd_info{    char        *buf;           /* buffer for cwd string */    size_t      size;           /* size of buffer */};//-----------------------------------------------------------------------------// Macro to define an initialized fstab entry#define FSTAB_ENTRY( _l, _name, _data, _syncmode, _mount, _umount,      \                     _open, _unlink,  _mkdir, _rmdir, _rename, _link,   \                     _opendir, _chdir, _stat, _getinfo, _setinfo)       \struct cyg_fstab_entry _l CYG_HAL_TABLE_ENTRY(fstab) =                  \{                                                                       \    _name,                                                              \    _data,                                                              \    _syncmode,                                                          \    _mount,                                                             \    _umount,                                                            \    _open,                                                              \    _unlink,                                                            \    _mkdir,                                                             \    _rmdir,                                                             \    _rename,                                                            \    _link,                                                              \    _opendir,                                                           \    _chdir,                                                             \    _stat,                                                              \    _getinfo,                                                           \    _setinfo                                                            \};//=============================================================================// Mount table entrystruct cyg_mtab_entry{    const char          *name;          // name of mount point    const char          *fsname;        // name of implementing filesystem    const char          *devname;       // name of hardware device    CYG_ADDRWORD        data;           // private data value        // The following are filled in after a successful mount operation    cyg_bool            valid;          // Valid entry?    cyg_fstab_entry     *fs;            // pointer to fstab entry    cyg_dir             root;           // root directory pointer} CYG_HAL_TABLE_TYPE;// This macro defines an initialized mtab entry#define MTAB_ENTRY( _l, _name, _fsname, _devname, _data )       \struct cyg_mtab_entry _l CYG_HAL_TABLE_ENTRY(mtab) =            \

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -