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

📄 libio.h

📁 RTEMS (Real-Time Executive for Multiprocessor Systems) is a free open source real-time operating sys
💻 H
📖 第 1 页 / 共 2 页
字号:
/* *  System call and file system interface definition * *  General purpose communication channel for RTEMS to allow UNIX/POSIX *  system call behavior under RTEMS.  Initially this supported only *  IO to devices but has since been enhanced to support networking *  and support for mounted file systems. * *  COPYRIGHT (c) 1989-1999. *  On-Line Applications Research Corporation (OAR). * *  The license and distribution terms for this file may be *  found in the file LICENSE in this distribution or at *  http://www.rtems.com/license/LICENSE. * *  $Id: libio.h,v 1.41.2.2 2003/09/04 18:46:58 joel Exp $ */#ifndef _RTEMS_LIBIO_H#define _RTEMS_LIBIO_H#include <rtems.h>#include <sys/types.h>#include <sys/stat.h>#include <sys/ioctl.h>/* *  Define data types which must be constructed using forward references. */#include <rtems/fs.h>/* * Valid RTEMS file types. */#define RTEMS_FILESYSTEM_DIRECTORY   1#define RTEMS_FILESYSTEM_DEVICE      2#define RTEMS_FILESYSTEM_HARD_LINK   3#define RTEMS_FILESYSTEM_SYM_LINK    4#define RTEMS_FILESYSTEM_MEMORY_FILE 5typedef int rtems_filesystem_node_types_t;/* *  File Handler Operations Table */typedef int (*rtems_filesystem_open_t)(  rtems_libio_t *iop,  const char    *pathname,  unsigned32     flag,  unsigned32     mode);typedef int (*rtems_filesystem_close_t)(  rtems_libio_t *iop);typedef ssize_t (*rtems_filesystem_read_t)(  rtems_libio_t *iop,  void          *buffer,  unsigned32     count);typedef ssize_t (*rtems_filesystem_write_t)(  rtems_libio_t *iop,  const void    *buffer,  unsigned32    count);typedef int (*rtems_filesystem_ioctl_t)(  rtems_libio_t *iop,  unsigned32     command,  void          *buffer);typedef int (*rtems_filesystem_lseek_t)(  rtems_libio_t *iop,  off_t          length,  int            whence);typedef int (*rtems_filesystem_fstat_t)(  rtems_filesystem_location_info_t *loc,  struct stat                      *buf);typedef int (*rtems_filesystem_fchmod_t)(  rtems_filesystem_location_info_t *loc,  mode_t                            mode);typedef int (*rtems_filesystem_ftruncate_t)(  rtems_libio_t *iop,  off_t          length);typedef int (*rtems_filesystem_fpathconf_t)(  rtems_libio_t *iop,  int name);typedef int (*rtems_filesystem_fsync_t)(  rtems_libio_t *iop);typedef int (*rtems_filesystem_fdatasync_t)(  rtems_libio_t *iop);typedef int (*rtems_filesystem_fcntl_t)(  int            cmd,  rtems_libio_t *iop);typedef int (*rtems_filesystem_rmnod_t)( rtems_filesystem_location_info_t      *pathloc       /* IN */);struct _rtems_filesystem_file_handlers_r {    rtems_filesystem_open_t         open_h;    rtems_filesystem_close_t        close_h;    rtems_filesystem_read_t         read_h;    rtems_filesystem_write_t        write_h;    rtems_filesystem_ioctl_t        ioctl_h;    rtems_filesystem_lseek_t        lseek_h;    rtems_filesystem_fstat_t        fstat_h;    rtems_filesystem_fchmod_t       fchmod_h;    rtems_filesystem_ftruncate_t    ftruncate_h;    rtems_filesystem_fpathconf_t    fpathconf_h;    rtems_filesystem_fsync_t        fsync_h;    rtems_filesystem_fdatasync_t    fdatasync_h;    rtems_filesystem_fcntl_t        fcntl_h;    rtems_filesystem_rmnod_t        rmnod_h;};/* *  File System Operations Table *//* *  XXX *  This routine does not allocate any space and rtems_filesystem_freenode_t  *  is not called by the generic after calling this routine. *  ie. node_access does not have to contain valid data when the  *      routine returns. */typedef int (*rtems_filesystem_mknod_t)(   const char                        *path,       /* IN */   mode_t                             mode,       /* IN */   dev_t                              dev,        /* IN */   rtems_filesystem_location_info_t  *pathloc     /* IN/OUT */);/* *  rtems_filesystem_freenode_t must be called by the generic after *  calling this routine */typedef int (*rtems_filesystem_evalpath_t)(  const char                        *pathname,      /* IN     */  int                                flags,         /* IN     */  rtems_filesystem_location_info_t  *pathloc        /* IN/OUT */);typedef int (*rtems_filesystem_evalmake_t)(   const char                       *path,       /* IN */   rtems_filesystem_location_info_t *pathloc,    /* IN/OUT */   const char                      **name        /* OUT    */);typedef int (*rtems_filesystem_link_t)( rtems_filesystem_location_info_t  *to_loc,      /* IN */ rtems_filesystem_location_info_t  *parent_loc,  /* IN */ const char                        *name         /* IN */);typedef int (*rtems_filesystem_unlink_t)( rtems_filesystem_location_info_t  *pathloc       /* IN */);typedef int (*rtems_filesystem_chown_t)( rtems_filesystem_location_info_t  *pathloc,       /* IN */ uid_t                              owner,         /* IN */ gid_t                              group          /* IN */);typedef int (*rtems_filesystem_freenode_t)( rtems_filesystem_location_info_t      *pathloc       /* IN */);typedef int (* rtems_filesystem_mount_t ) (   rtems_filesystem_mount_table_entry_t *mt_entry     /* in */);typedef int (* rtems_filesystem_fsmount_me_t )(   rtems_filesystem_mount_table_entry_t *mt_entry);typedef int (* rtems_filesystem_unmount_t ) (   rtems_filesystem_mount_table_entry_t *mt_entry     /* in */);typedef int (* rtems_filesystem_fsunmount_me_t ) (   rtems_filesystem_mount_table_entry_t *mt_entry    /* in */);typedef rtems_filesystem_node_types_t (* rtems_filesystem_node_type_t) (  rtems_filesystem_location_info_t    *pathloc      /* in */);typedef int (* rtems_filesystem_utime_t)(  rtems_filesystem_location_info_t  *pathloc,       /* IN */  time_t                             actime,        /* IN */  time_t                             modtime        /* IN */);typedef int (*rtems_filesystem_evaluate_link_t)(  rtems_filesystem_location_info_t *pathloc,     /* IN/OUT */  int                               flags        /* IN     */);typedef int (*rtems_filesystem_symlink_t)( rtems_filesystem_location_info_t  *loc,         /* IN */ const char                        *link_name,   /* IN */ const char                        *node_name);typedef int (*rtems_filesystem_readlink_t)( rtems_filesystem_location_info_t  *loc,     /* IN  */        char                              *buf,     /* OUT */        size_t                            bufsize    );/* * operations table that must be defined for every file system. *//* * File system types */struct _rtems_filesystem_operations_table {    rtems_filesystem_evalpath_t      evalpath_h;    rtems_filesystem_evalmake_t      evalformake_h;    rtems_filesystem_link_t          link_h;    rtems_filesystem_unlink_t        unlink_h;    rtems_filesystem_node_type_t     node_type_h;    rtems_filesystem_mknod_t         mknod_h;    rtems_filesystem_chown_t         chown_h;    rtems_filesystem_freenode_t      freenod_h;    rtems_filesystem_mount_t         mount_h;    rtems_filesystem_fsmount_me_t    fsmount_me_h;    rtems_filesystem_unmount_t       unmount_h;    rtems_filesystem_fsunmount_me_t  fsunmount_me_h;    rtems_filesystem_utime_t         utime_h;    rtems_filesystem_evaluate_link_t eval_link_h;    rtems_filesystem_symlink_t       symlink_h;    rtems_filesystem_readlink_t      readlink_h;};#if 0/* Now in exec/include/rtems/fs.h *//* * Structure used to determine a location/filesystem in the tree. */struct rtems_filesystem_location_info_tt{  void                                   *node_access;  rtems_filesystem_file_handlers_r       *handlers;  rtems_filesystem_operations_table      *ops;  rtems_filesystem_mount_table_entry_t   *mt_entry;};#endif/* *  Structure used to contain file system specific information which *  is required to support fpathconf(). */typedef struct {  int    link_max;  int    max_canon;  int    max_input;  int    name_max;  int    path_max;  int    pipe_buf;  int    posix_async_io;  int    posix_chown_restrictions;  int    posix_no_trunc;  int    posix_prio_io;  int    posix_sync_io;  int    posix_vdisable;} rtems_filesystem_limits_and_options_t;/* * Structure for a mount table entry. */struct rtems_filesystem_mount_table_entry_tt {  Chain_Node                             Node;  rtems_filesystem_location_info_t       mt_point_node;  rtems_filesystem_location_info_t       mt_fs_root;  int                                    options;  void                                  *fs_info;  rtems_filesystem_limits_and_options_t  pathconf_limits_and_options;  /*   *  When someone adds a mounted filesystem on a real device,   *  this will need to be used.   *   *  The best option long term for this is probably an open file descriptor.   */  char                                  *dev;

⌨️ 快捷键说明

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