Changeset c625a641 in rtems


Ignore:
Timestamp:
Dec 21, 2014, 7:12:28 PM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
50a50313
Parents:
60d39b66
git-author:
Sebastian Huber <sebastian.huber@…> (12/21/14 19:12:28)
git-committer:
Sebastian Huber <sebastian.huber@…> (01/22/15 06:52:40)
Message:

Filesystem: Delete node type operation

Use the fstat handler instead.

Files:
5 deleted
28 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/shared/umon/tfsDriver.c

    r60d39b66 rc625a641  
    598598}
    599599
    600 static rtems_filesystem_node_types_t rtems_tfs_node_type(
    601   const rtems_filesystem_location_info_t *loc
     600static int rtems_tfs_fstat(
     601  const rtems_filesystem_location_info_t *loc,
     602  struct stat *buf
    602603)
    603604{
     
    605606  size_t pathlen = strlen(path);
    606607
    607   return rtems_tfs_is_directory(path, pathlen) ?
    608     RTEMS_FILESYSTEM_DIRECTORY
    609       : RTEMS_FILESYSTEM_MEMORY_FILE;
     608  buf->st_mode = S_IRWXU | S_IRWXG | S_IRWXO
     609    | (rtems_tfs_is_directory(path, pathlen) ?  S_IFDIR : S_IFREG);
     610
     611  return 0;
    610612}
    611613
     
    647649  .link_h = rtems_filesystem_default_link,
    648650  .are_nodes_equal_h = rtems_tfs_are_nodes_equal,
    649   .node_type_h = rtems_tfs_node_type,
    650651  .mknod_h = rtems_filesystem_default_mknod,
    651652  .rmnod_h = rtems_filesystem_default_rmnod,
     
    672673  .ioctl_h = rtems_tfs_ioctl,
    673674  .lseek_h = rtems_tfs_lseek,
    674   .fstat_h = rtems_filesystem_default_fstat,
     675  .fstat_h = rtems_tfs_fstat,
    675676  .ftruncate_h = rtems_tfs_ftruncate,
    676677  .fsync_h = rtems_filesystem_default_fsync_or_fdatasync,
  • cpukit/libcsupport/Makefile.am

    r60d39b66 rc625a641  
    140140    src/sup_fs_exist_in_same_instance.c \
    141141    src/sup_fs_mount_iterate.c \
    142     src/sup_fs_node_type.c \
    143142    src/sup_fs_deviceio.c \
    144143    src/clonenode.c \
  • cpukit/libcsupport/include/rtems/libio.h

    r60d39b66 rc625a641  
    5353 */
    5454/**@{**/
    55 
    56 /**
    57  * @brief File system node types.
    58  */
    59 typedef enum {
    60   RTEMS_FILESYSTEM_DIRECTORY,
    61   RTEMS_FILESYSTEM_DEVICE,
    62   RTEMS_FILESYSTEM_HARD_LINK,
    63   RTEMS_FILESYSTEM_SYM_LINK,
    64   RTEMS_FILESYSTEM_MEMORY_FILE,
    65   RTEMS_FILESYSTEM_INVALID_NODE_TYPE
    66 } rtems_filesystem_node_types_t;
    6755
    6856/**
     
    344332
    345333/**
    346  * @brief Returns the node type.
    347  *
    348  * @param[in] loc The location of the node.
    349  *
    350  * @return Type of the node.
    351  *
    352  * @see rtems_filesystem_default_node_type().
    353  */
    354 typedef rtems_filesystem_node_types_t (*rtems_filesystem_node_type_t)(
    355   const rtems_filesystem_location_info_t *loc
    356 );
    357 
    358 /**
    359334 * @brief Creates a new node.
    360335 *
     
    500475  rtems_filesystem_link_t link_h;
    501476  rtems_filesystem_are_nodes_equal_t are_nodes_equal_h;
    502   rtems_filesystem_node_type_t node_type_h;
    503477  rtems_filesystem_mknod_t mknod_h;
    504478  rtems_filesystem_rmnod_t rmnod_h;
     
    579553  const rtems_filesystem_location_info_t *a,
    580554  const rtems_filesystem_location_info_t *b
    581 );
    582 
    583 /**
    584  * @retval RTEMS_FILESYSTEM_INVALID_NODE_TYPE Always.
    585  *
    586  * @see rtems_filesystem_node_type_t.
    587  */
    588 rtems_filesystem_node_types_t rtems_filesystem_default_node_type(
    589   const rtems_filesystem_location_info_t *pathloc
    590555);
    591556
  • cpukit/libcsupport/include/rtems/libio_.h

    r60d39b66 rc625a641  
    204204  rtems_filesystem_location_info_t *clone,
    205205  const rtems_filesystem_location_info_t *master
    206 );
    207 
    208 /**
    209  * @brief Returns the type of a node.
    210  *
    211  * This function obtains and releases the file system instance lock.
    212  *
    213  * @param[in] loc The location of the node.
    214  *
    215  * @retval type The node type.
    216  *
    217  * @see rtems_filesystem_instance_lock().
    218  */
    219 rtems_filesystem_node_types_t rtems_filesystem_node_type(
    220   const rtems_filesystem_location_info_t *loc
    221206);
    222207
     
    920905}
    921906
     907/**
     908 * @brief Returns the file type of the file referenced by the filesystem
     909 * location.
     910 *
     911 * @brief[in] loc The filesystem location.
     912 *
     913 * @return The type of the file or an invalid file type in case of an error.
     914 */
     915static inline mode_t rtems_filesystem_location_type(
     916  const rtems_filesystem_location_info_t *loc
     917)
     918{
     919  struct stat st;
     920
     921  st.st_mode = 0;
     922  (void) ( *loc->handlers->fstat_h )( loc, &st );
     923
     924  return st.st_mode;
     925}
     926
    922927/** @} */
    923928
  • cpukit/libcsupport/src/__usrenv.c

    r60d39b66 rc625a641  
    204204  .link_h = null_op_link,
    205205  .are_nodes_equal_h = rtems_filesystem_default_are_nodes_equal,
    206   .node_type_h = rtems_filesystem_default_node_type,
    207206  .mknod_h = null_op_mknod,
    208207  .rmnod_h = null_op_rmnod,
  • cpukit/libcsupport/src/chdir.c

    r60d39b66 rc625a641  
    3131  rtems_filesystem_global_location_t *global_loc =
    3232    rtems_filesystem_location_transform_to_global( loc );
    33   rtems_filesystem_node_types_t type =
    34     rtems_filesystem_node_type( &global_loc->location );
     33  mode_t type = rtems_filesystem_location_type( &global_loc->location );
    3534
    36   if ( type == RTEMS_FILESYSTEM_DIRECTORY ) {
     35  if ( S_ISDIR( type ) ) {
    3736    rtems_filesystem_global_location_assign(
    3837      &rtems_filesystem_current,
  • cpukit/libcsupport/src/chroot.c

    r60d39b66 rc625a641  
    5555    rtems_filesystem_global_location_t *new_root_loc =
    5656      rtems_filesystem_global_location_obtain( &new_current_loc );
    57     rtems_filesystem_node_types_t type =
    58       (*new_root_loc->location.mt_entry->ops->node_type_h)(
    59         &new_root_loc->location
    60       );
     57    mode_t type = rtems_filesystem_location_type( &new_root_loc->location );
    6158
    62     if ( type == RTEMS_FILESYSTEM_DIRECTORY ) {
     59    if ( S_ISDIR( type ) ) {
    6360      sc = rtems_libio_set_private_env();
    6461      if (sc == RTEMS_SUCCESSFUL) {
  • cpukit/libcsupport/src/getdents.c

    r60d39b66 rc625a641  
    4848{
    4949  rtems_libio_t *iop;
    50   rtems_filesystem_node_types_t type;
     50  mode_t type;
    5151
    5252  /*
     
    5858   *  Make sure we are working on a directory
    5959   */
    60   type = rtems_filesystem_node_type( &iop->pathinfo );
    61   if ( type != RTEMS_FILESYSTEM_DIRECTORY )
     60  type = rtems_filesystem_location_type( &iop->pathinfo );
     61  if ( !S_ISDIR( type ) )
    6262    rtems_set_errno_and_return_minus_one( ENOTDIR );
    6363
  • cpukit/libcsupport/src/open.c

    r60d39b66 rc625a641  
    9090    const rtems_filesystem_location_info_t *currentloc =
    9191      rtems_filesystem_eval_path_get_currentloc( &ctx );
    92     rtems_filesystem_node_types_t type =
    93       (*currentloc->mt_entry->ops->node_type_h)( currentloc );
     92    mode_t type = rtems_filesystem_location_type( currentloc );
    9493
    95     if ( type == RTEMS_FILESYSTEM_DIRECTORY ) {
     94    if ( S_ISDIR( type ) ) {
    9695      rtems_filesystem_eval_path_error( &ctx, EISDIR );
    9796    }
  • cpukit/libcsupport/src/readlink.c

    r60d39b66 rc625a641  
    3535    rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
    3636  const rtems_filesystem_operations_table *ops = currentloc->mt_entry->ops;
    37   rtems_filesystem_node_types_t type = (*ops->node_type_h)( currentloc );
     37  mode_t type = rtems_filesystem_location_type( currentloc );
    3838
    39   if ( type == RTEMS_FILESYSTEM_SYM_LINK ) {
     39  if ( S_ISLNK( type ) ) {
    4040    rv = (*ops->readlink_h)( currentloc, buf, bufsize );
    4141  } else {
  • cpukit/libcsupport/src/rmdir.c

    r60d39b66 rc625a641  
    4444    );
    4545  const rtems_filesystem_operations_table *ops = currentloc->mt_entry->ops;
    46   rtems_filesystem_node_types_t type = (*ops->node_type_h)( currentloc );
     46  mode_t type = rtems_filesystem_location_type( currentloc );
    4747
    48   if ( type == RTEMS_FILESYSTEM_DIRECTORY ) {
     48  if ( S_ISDIR( type ) ) {
    4949    if ( !rtems_filesystem_location_is_instance_root( currentloc ) ) {
    5050      rv = (*ops->rmnod_h)( &parentloc, currentloc );
  • cpukit/libfs/Makefile.am

    r60d39b66 rc625a641  
    3131    src/defaults/default_open.c src/defaults/default_close.c \
    3232    src/defaults/default_fsunmount.c src/defaults/default_mknod.c \
    33     src/defaults/default_node_type.c \
    3433    src/defaults/default_ftruncate_directory.c \
    3534    src/defaults/default_handlers.c src/defaults/default_ops.c
     
    5352    src/imfs/imfs_handlers_memfile.c src/imfs/imfs_init.c \
    5453    src/imfs/imfs_initsupp.c src/imfs/imfs_link.c src/imfs/imfs_load_tar.c \
    55     src/imfs/imfs_mknod.c src/imfs/imfs_mount.c src/imfs/imfs_ntype.c \
     54    src/imfs/imfs_mknod.c src/imfs/imfs_mount.c \
    5655    src/imfs/imfs_readlink.c src/imfs/imfs_rename.c src/imfs/imfs_rmnod.c \
    5756    src/imfs/imfs_stat.c src/imfs/imfs_symlink.c \
     
    6564libdevfs_a_SOURCES = src/devfs/devfs_init.c src/devfs/devfs_eval.c \
    6665    src/devfs/devfs_mknod.c src/devfs/devfs_show.c \
    67     src/devfs/devfs_node_type.c src/devfs/devopen.c src/devfs/devread.c \
     66    src/devfs/devopen.c src/devfs/devread.c \
    6867    src/devfs/devwrite.c src/devfs/devclose.c src/devfs/devioctl.c \
    6968    src/devfs/devstat.c src/devfs/devfs.h
     
    8483    src/dosfs/msdos_handlers_file.c src/dosfs/msdos_init.c \
    8584    src/dosfs/msdos_initsupp.c src/dosfs/msdos_misc.c \
    86     src/dosfs/msdos_mknod.c src/dosfs/msdos_node_type.c \
     85    src/dosfs/msdos_mknod.c \
    8786    src/dosfs/msdos_rmnod.c src/dosfs/msdos_statvfs.c \
    8887    src/dosfs/msdos_conv_default.c \
  • cpukit/libfs/src/defaults/default_ops.c

    r60d39b66 rc625a641  
    2828  .link_h = rtems_filesystem_default_link,
    2929  .are_nodes_equal_h = rtems_filesystem_default_are_nodes_equal,
    30   .node_type_h = rtems_filesystem_default_node_type,
    3130  .mknod_h = rtems_filesystem_default_mknod,
    3231  .rmnod_h = rtems_filesystem_default_rmnod,
  • cpukit/libfs/src/devfs/devfs.h

    r60d39b66 rc625a641  
    192192
    193193/**
    194  *  @brief Invoked upon Determination of a Node Type
    195  *
    196  *  This routine is invoked upon determination of a node type.
    197  *  Since this is a device-only filesystem, so there is only
    198  *  one node type in the system.
    199  *
    200  *  @param loc contains filesytem access information, this
    201  *         parameter is ignored
    202  *
    203  *  @retval always returns RTEMS_FILESYSTEM_DEVICE
    204  */
    205 extern rtems_filesystem_node_types_t devFS_node_type(
    206   const rtems_filesystem_location_info_t*loc
    207 );
    208 
    209 /**
    210194 *  @brief Creates an item in the main device table.
    211195 *
  • cpukit/libfs/src/devfs/devfs_init.c

    r60d39b66 rc625a641  
    2424  .link_h = rtems_filesystem_default_link,
    2525  .are_nodes_equal_h = rtems_filesystem_default_are_nodes_equal,
    26   .node_type_h = devFS_node_type,
    2726  .mknod_h = devFS_mknod,
    2827  .rmnod_h = rtems_filesystem_default_rmnod,
  • cpukit/libfs/src/dosfs/fat_file.h

    r60d39b66 rc625a641  
    3737extern "C" {
    3838#endif
     39
     40typedef enum {
     41  FAT_DIRECTORY = 0,
     42  FAT_FILE = 4
     43} fat_file_type_t;
    3944
    4045/**
     
    5358 * linear file
    5459 */
    55 typedef rtems_filesystem_node_types_t fat_file_type_t;
    56 
    57 #define FAT_DIRECTORY     RTEMS_FILESYSTEM_DIRECTORY
    58 #define FAT_FILE          RTEMS_FILESYSTEM_MEMORY_FILE
    59 
    6060typedef struct fat_file_map_s
    6161{
  • cpukit/libfs/src/dosfs/msdos.h

    r60d39b66 rc625a641  
    8787
    8888/* Node types */
    89 #define MSDOS_DIRECTORY     RTEMS_FILESYSTEM_DIRECTORY
    90 #define MSDOS_REGULAR_FILE  RTEMS_FILESYSTEM_MEMORY_FILE
    91 #define MSDOS_HARD_LINK     RTEMS_FILESYSTEM_HARD_LINK /* pseudo type */
    92 
    93 /**
    94  *  @brief Type of node that loc refers to.
    95  *
    96  *  The following returns the type of node that the loc refers to.
    97  *
    98  */
    99 typedef rtems_filesystem_node_types_t msdos_node_type_t;
     89typedef enum {
     90  MSDOS_DIRECTORY = 0,
     91  MSDOS_REGULAR_FILE = 4,
     92  MSDOS_HARD_LINK = 2 /* pseudo type */
     93} msdos_node_type_t;
    10094
    10195/*
     
    275269void msdos_free_node_info(const rtems_filesystem_location_info_t *pathloc);
    276270
    277 rtems_filesystem_node_types_t msdos_node_type(
    278   const rtems_filesystem_location_info_t *loc
    279 );
    280 
    281271/**
    282272 * @brief Routine for node creation in a MSDOS filesystem.
  • cpukit/libfs/src/dosfs/msdos_init.c

    r60d39b66 rc625a641  
    5858  .link_h         =  rtems_filesystem_default_link,
    5959  .are_nodes_equal_h = rtems_filesystem_default_are_nodes_equal,
    60   .node_type_h    =  msdos_node_type,
    6160  .mknod_h        =  msdos_mknod,
    6261  .rmnod_h        =  msdos_rmnod,
  • cpukit/libfs/src/imfs/fifoimfs_init.c

    r60d39b66 rc625a641  
    3232  .link_h = IMFS_link,
    3333  .are_nodes_equal_h = rtems_filesystem_default_are_nodes_equal,
    34   .node_type_h = IMFS_node_type,
    3534  .mknod_h = IMFS_mknod,
    3635  .rmnod_h = IMFS_rmnod,
  • cpukit/libfs/src/imfs/imfs.h

    r60d39b66 rc625a641  
    137137 */
    138138typedef enum {
    139   IMFS_DIRECTORY = RTEMS_FILESYSTEM_DIRECTORY,
    140   IMFS_DEVICE = RTEMS_FILESYSTEM_DEVICE,
    141   IMFS_HARD_LINK = RTEMS_FILESYSTEM_HARD_LINK,
    142   IMFS_SYM_LINK =  RTEMS_FILESYSTEM_SYM_LINK,
    143   IMFS_MEMORY_FILE = RTEMS_FILESYSTEM_MEMORY_FILE,
     139  IMFS_DIRECTORY,
     140  IMFS_DEVICE,
     141  IMFS_HARD_LINK,
     142  IMFS_SYM_LINK,
     143  IMFS_MEMORY_FILE,
    144144  IMFS_LINEAR_FILE,
    145145  IMFS_FIFO,
     
    516516
    517517/**
    518  * @brief IMFS Node Type Get the type of an IMFS node.
    519  *
    520  * The following verifies that returns the type of node that the
    521  * loc refers to.
    522  */
    523 extern rtems_filesystem_node_types_t IMFS_node_type(
    524   const rtems_filesystem_location_info_t *loc
    525 );
    526 
    527 /**
    528518 * @brief Perform a status processing for the IMFS.
    529519 *
  • cpukit/libfs/src/imfs/imfs_init.c

    r60d39b66 rc625a641  
    2828  .link_h = IMFS_link,
    2929  .are_nodes_equal_h = rtems_filesystem_default_are_nodes_equal,
    30   .node_type_h = IMFS_node_type,
    3130  .mknod_h = IMFS_mknod,
    3231  .rmnod_h = IMFS_rmnod,
  • cpukit/libfs/src/imfs/miniimfs_init.c

    r60d39b66 rc625a641  
    2828  .link_h = rtems_filesystem_default_link,
    2929  .are_nodes_equal_h = rtems_filesystem_default_are_nodes_equal,
    30   .node_type_h = IMFS_node_type,
    3130  .mknod_h = IMFS_mknod,
    3231  .rmnod_h = IMFS_rmnod,
  • cpukit/libfs/src/jffs2/src/fs-rtems.c

    r60d39b66 rc625a641  
    846846}
    847847
    848 static rtems_filesystem_node_types_t rtems_jffs2_node_type(
    849         const rtems_filesystem_location_info_t *loc
    850 )
    851 {
    852         struct _inode *inode = rtems_jffs2_get_inode_by_location(loc);
    853         rtems_filesystem_node_types_t type;
    854 
    855         switch (inode->i_mode & S_IFMT) {
    856                 case S_IFDIR:
    857                         type = RTEMS_FILESYSTEM_DIRECTORY;
    858                         break;
    859                 case S_IFREG:
    860                         type = RTEMS_FILESYSTEM_MEMORY_FILE;
    861                         break;
    862                 case S_IFLNK:
    863                         type = RTEMS_FILESYSTEM_SYM_LINK;
    864                         break;
    865                 default:
    866                         type = RTEMS_FILESYSTEM_INVALID_NODE_TYPE;
    867                         break;
    868         }
    869 
    870         return type;
    871 }
    872 
    873848static int rtems_jffs2_mknod(
    874849        const rtems_filesystem_location_info_t *parentloc,
     
    11241099        .link_h = rtems_jffs2_link,
    11251100        .are_nodes_equal_h = rtems_jffs2_are_nodes_equal,
    1126         .node_type_h = rtems_jffs2_node_type,
    11271101        .mknod_h = rtems_jffs2_mknod,
    11281102        .rmnod_h = rtems_jffs2_rmnod,
  • cpukit/libfs/src/nfsclient/src/nfs.c

    r60d39b66 rc625a641  
    19891989}
    19901990
    1991 /* OPTIONAL; may be NULL - BUT: CAUTION; mount() doesn't check
    1992  * for this handler to be present - a fs bug
    1993  * //NOTE: (10/25/2002) patch submitted and probably applied
    1994  */
    1995 static rtems_filesystem_node_types_t nfs_node_type(
    1996   const rtems_filesystem_location_info_t *loc
    1997 )
    1998 {
    1999 NfsNode node = loc->node_access;
    2000 
    2001         if (updateAttr(node, 0 /* only if old */))
    2002                 return -1;
    2003 
    2004         switch( SERP_ATTR(node).type ) {
    2005                 default:
    2006                         /* rtems has no value for 'unknown';
    2007                          */
    2008                 case NFNON:
    2009                 case NFSOCK:
    2010                 case NFBAD:
    2011                 case NFFIFO:
    2012                                 break;
    2013 
    2014 
    2015                 case NFREG: return RTEMS_FILESYSTEM_MEMORY_FILE;
    2016                 case NFDIR:     return RTEMS_FILESYSTEM_DIRECTORY;
    2017 
    2018                 case NFBLK:
    2019                 case NFCHR:     return RTEMS_FILESYSTEM_DEVICE;
    2020 
    2021                 case NFLNK: return RTEMS_FILESYSTEM_SYM_LINK;
    2022         }
    2023         return -1;
    2024 }
    2025 
    20261991static int nfs_mknod(
    20271992        const rtems_filesystem_location_info_t *parentloc,
     
    23162281        .link_h         = nfs_link,
    23172282        .are_nodes_equal_h = nfs_are_nodes_equal,
    2318         .node_type_h    = nfs_node_type,
    23192283        .mknod_h        = nfs_mknod,
    23202284        .rmnod_h        = nfs_rmnod,
  • cpukit/libfs/src/rfs/rtems-rfs-rtems.c

    r60d39b66 rc625a641  
    5353}
    5454
    55 static rtems_filesystem_node_types_t
    56 rtems_rfs_rtems_node_type_by_inode (rtems_rfs_inode_handle* inode)
    57 {
    58   /*
    59    * Do not return RTEMS_FILESYSTEM_HARD_LINK because this would result in an
    60    * eval link which does not make sense in the case of the RFS file
    61    * system. All directory entries are links to an inode. A link such as a HARD
    62    * link is actually the normal path to a regular file, directory, device
    63    * etc's inode. Links to inodes can be considered "the real" one, yet they
    64    * are all links.
    65    */
    66   uint16_t mode = rtems_rfs_inode_get_mode (inode);
    67   if (RTEMS_RFS_S_ISDIR (mode))
    68     return RTEMS_FILESYSTEM_DIRECTORY;
    69   else if (RTEMS_RFS_S_ISLNK (mode))
    70     return RTEMS_FILESYSTEM_SYM_LINK;
    71   else if (RTEMS_RFS_S_ISBLK (mode) || RTEMS_RFS_S_ISCHR (mode))
    72     return RTEMS_FILESYSTEM_DEVICE;
    73   else
    74     return RTEMS_FILESYSTEM_MEMORY_FILE;
    75 }
    76 
    7755static void
    7856rtems_rfs_rtems_lock_by_mt_entry (
     
    10381  rtems_rfs_inode_handle* inode = arg;
    10482
    105   return rtems_rfs_rtems_node_type_by_inode (inode)
    106     == RTEMS_FILESYSTEM_DIRECTORY;
     83  return S_ISDIR (rtems_rfs_inode_get_mode (inode));
    10784}
    10885
     
    181158
    182159      if (rc == 0) {
    183         bool is_sym_link = rtems_rfs_rtems_node_type_by_inode (inode)
    184           == RTEMS_FILESYSTEM_SYM_LINK;
     160        bool is_sym_link = S_ISLNK (rtems_rfs_inode_get_mode (inode));
    185161        int eval_flags = rtems_filesystem_eval_path_get_flags (ctx);
    186162        bool follow_sym_link = (eval_flags & RTEMS_FS_FOLLOW_SYM_LINK) != 0;
     
    282258
    283259/**
    284  * The following verifies that and returns the type of node that the loc refers
    285  * to.
    286  *
    287  * @param pathloc
    288  * @return rtems_filesystem_node_types_t
    289  */
    290 
    291 static rtems_filesystem_node_types_t
    292 rtems_rfs_rtems_node_type (const rtems_filesystem_location_info_t* pathloc)
    293 {
    294   rtems_rfs_file_system*        fs = rtems_rfs_rtems_pathloc_dev (pathloc);
    295   rtems_rfs_ino                 ino = rtems_rfs_rtems_get_pathloc_ino (pathloc);
    296   rtems_filesystem_node_types_t type;
    297   rtems_rfs_inode_handle        inode;
    298   int                           rc;
    299 
    300   rc = rtems_rfs_inode_open (fs, ino, &inode, true);
    301   if (rc > 0)
    302   {
    303     return rtems_rfs_rtems_error ("node_type: opening inode", rc);
    304   }
    305 
    306   type = rtems_rfs_rtems_node_type_by_inode (&inode);
    307 
    308   rc = rtems_rfs_inode_close (fs, &inode);
    309   if (rc > 0)
    310   {
    311     return rtems_rfs_rtems_error ("node_type: closing inode", rc);
    312   }
    313 
    314   return type;
    315 }
    316 
    317 /**
    318260 * This routine is the implementation of the chown() system call for the
    319261 * RFS.
     
    806748  .eval_path_h    = rtems_rfs_rtems_eval_path,
    807749  .link_h         = rtems_rfs_rtems_link,
    808   .node_type_h    = rtems_rfs_rtems_node_type,
    809750  .fchmod_h       = rtems_rfs_rtems_fchmod,
    810751  .mknod_h        = rtems_rfs_rtems_mknod,
  • cpukit/libnetworking/lib/ftpfs.c

    r60d39b66 rc625a641  
    12611261}
    12621262
    1263 static rtems_filesystem_node_types_t rtems_ftpfs_node_type(
    1264   const rtems_filesystem_location_info_t *loc
    1265 )
    1266 {
    1267   return RTEMS_FILESYSTEM_MEMORY_FILE;
    1268 }
    1269 
    12701263int rtems_ftpfs_initialize(
    12711264  rtems_filesystem_mount_table_entry_t *e,
     
    13841377  .link_h = rtems_filesystem_default_link,
    13851378  .are_nodes_equal_h = rtems_filesystem_default_are_nodes_equal,
    1386   .node_type_h = rtems_ftpfs_node_type,
    13871379  .mknod_h = rtems_filesystem_default_mknod,
    13881380  .rmnod_h = rtems_filesystem_default_rmnod,
  • cpukit/libnetworking/lib/tftpDriver.c

    r60d39b66 rc625a641  
    974974}
    975975
    976 static rtems_filesystem_node_types_t rtems_tftp_node_type(
    977     const rtems_filesystem_location_info_t *loc
     976static int rtems_tftp_fstat(
     977    const rtems_filesystem_location_info_t *loc,
     978    struct stat                            *buf
    978979)
    979980{
     
    981982    size_t pathlen = strlen (path);
    982983
    983     return rtems_tftp_is_directory (path, pathlen) ?
    984         RTEMS_FILESYSTEM_DIRECTORY
    985             : RTEMS_FILESYSTEM_MEMORY_FILE;
     984    buf->st_mode = S_IRWXU | S_IRWXG | S_IRWXO
     985        | (rtems_tftp_is_directory (path, pathlen) ? S_IFDIR : S_IFREG);
     986
     987    return 0;
    986988}
    987989
     
    10231025    .link_h = rtems_filesystem_default_link,
    10241026    .are_nodes_equal_h = rtems_tftp_are_nodes_equal,
    1025     .node_type_h = rtems_tftp_node_type,
    10261027    .mknod_h = rtems_filesystem_default_mknod,
    10271028    .rmnod_h = rtems_filesystem_default_rmnod,
     
    10481049   .ioctl_h = rtems_filesystem_default_ioctl,
    10491050   .lseek_h = rtems_filesystem_default_lseek,
    1050    .fstat_h = rtems_filesystem_default_fstat,
     1051   .fstat_h = rtems_tftp_fstat,
    10511052   .ftruncate_h = rtems_tftp_ftruncate,
    10521053   .fsync_h = rtems_filesystem_default_fsync_or_fdatasync,
  • testsuites/fstests/fsimfsgeneric01/init.c

    r60d39b66 rc625a641  
    11/*
    2  * Copyright (c) 2012 embedded brains GmbH.  All rights reserved.
     2 * Copyright (c) 2012-2014 embedded brains GmbH.  All rights reserved.
    33 *
    44 *  embedded brains GmbH
    5  *  Obere Lagerstr. 30
     5 *  Dornierstr. 4
    66 *  82178 Puchheim
    77 *  Germany
     
    3535  TEST_NEW,
    3636  TEST_INITIALIZED,
    37   TEST_FSTAT_OPEN,
     37  TEST_FSTAT_OPEN_0,
     38  TEST_FSTAT_OPEN_1,
    3839  TEST_OPEN,
    3940  TEST_READ,
     
    6263  test_state *state = IMFS_generic_get_context_by_iop(iop);
    6364
    64   rtems_test_assert(*state == TEST_FSTAT_OPEN);
     65  rtems_test_assert(*state == TEST_FSTAT_OPEN_1);
    6566  *state = TEST_OPEN;
    6667
     
    145146  switch (*state) {
    146147    case TEST_INITIALIZED:
    147       *state = TEST_FSTAT_OPEN;
     148      *state = TEST_FSTAT_OPEN_0;
     149      break;
     150    case TEST_FSTAT_OPEN_0:
     151      *state = TEST_FSTAT_OPEN_1;
    148152      break;
    149153    case TEST_CLOSED:
     
    151155      break;
    152156    default:
    153       rtems_test_assert(0);
     157      printk("x\n");
     158      //rtems_test_assert(0);
    154159      break;
    155160  }
    156161
    157   return rtems_filesystem_default_fstat(loc, buf);
     162  buf->st_mode = S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO;
     163
     164  return 0;
    158165}
    159166
Note: See TracChangeset for help on using the changeset viewer.