Changeset 7baa484 in rtems


Ignore:
Timestamp:
Jun 12, 2009, 1:53:33 AM (10 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.10, 4.11, master
Children:
72755421
Parents:
9e06eb1
Message:

2009-06-12 Chris Johns <chrisj@…>

  • libblock/src/bdbuf.c: Update comments.
  • libblock/src/bdpart.c, libblock/src/ide_part_table.c: Get the device from the rdev field of the stat buf.
  • libcsupport/include/rtems/libio.h: Add a path length to evalpath handler. Add parent locations to rmmod and unlink handlers.
  • libcsupport/include/rtems/libio_.h: Add a path length to rtems_filesystem_evaluate_path. Add rtems_filesystem_evaluate_relative_path, rtems_filesystem_dirname, and rtems_filesystem_prefix_separators. Remove rtems_filesystem_evaluate_parent.
  • libcsupport/src/base_fs.c, libcsupport/src/chdir.c, libcsupport/src/chmod.c, libcsupport/src/chown.c, libcsupport/src/chroot.c, libcsupport/src/fchdir.c, libcsupport/src/link.c, libcsupport/src/mount.c, libcsupport/src/open.c, libcsupport/src/privateenv.c, libcsupport/src/readlink.c, libcsupport/src/unmount.c, libcsupport/src/utime.c, libcsupport/src/unmount.c, libcsupport/src/utime.c, libfs/src/devfs/devfs.h, libfs/src/devfs/devfs_eval.c, libfs/src/devfs/devstat.c, libfs/src/dosfs/msdos_create.c, libfs/src/dosfs/msdos_misc.c, libfs/src/imfs/imfs.h, libfs/src/imfs/imfs_eval.c, libfs/src/imfs/imfs_load_tar.c, libfs/src/imfs/ioman.c, libfs/src/pipe/pipe.c, libmisc/fsmount/fsmount.c, libnetworking/lib/ftpfs.c: Add the length parameter to the eval call.
  • libcsupport/src/eval.c: Add rtems_filesystem_prefix_separators, rtems_filesystem_dirname, rtems_filesystem_evaluate_relative_path. Add the length parameter to the eval call.
  • libcsupport/src/rmdir.c: Find the parent pathloc then the node pathloc from that node. Remove the call to find the parent given the node pathloc.
  • libcsupport/src/stat.c: Add the length parameter to the eval call. Set the device into the rdev field.
  • libcsupport/src/unlink.c: Find the parent pathloc then the node pathloc from that node. Remove the call to find the parent given the node pathloc.
  • libfs/src/dosfs/fat.c, libfs/src/dosfs/msdos_format.c: Get the disk device number from the stat rdev field.
  • libfs/src/dosfs/msdos.h: Add the length parameter to the eval call. Add the parent pathloc to the rmnod handler.
  • libfs/src/dosfs/msdos_dir.c: Add the parent pathloc to the rmnod handler.
  • libfs/src/dosfs/msdos_eval.c: Add the length parameter to the eval and token call.
  • libfs/src/imfs/imfs_directory.c: Add the parent pathloc to the rmnod handler.
  • libfs/src/imfs/imfs_fchmod.c: Do not test the mode flags for only the allowed flags. Add the missing flags spec'ed in the POSIX standard.
  • libfs/src/imfs/imfs_fsunmount.c, libfs/src/imfs/imfs_rmnod.c, libfs/src/imfs/imfs_unlink.c, libfs/src/imfs/memfile.c: Add the parent node. Currently ignored in the IMFS.
  • libfs/src/imfs/imfs_stat.c: Return the device number in the rdev field.
  • libfs/src/imfs/imfs_mknod.c, libfs/src/imfs/imfs_symlink.c : Add the length parameter to the token call.
  • libfs/src/nfsclient/src/nfs.c: Add the length parameter to the eval call and parent node to the rmnod and unlink command.
  • libmisc/shell/internal.h: Remove the libc mounter decl to make public.
  • libmisc/shell/main_mount.c: Add support for hooking external mount support for new file systems.
  • libmisc/shell/shell.h: Add helper functions for the mount command.
Location:
cpukit
Files:
56 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r9e06eb1 r7baa484  
     12009-06-12      Chris Johns <chrisj@rtems.org>
     2
     3        * libblock/src/bdbuf.c: Update comments.
     4        * libblock/src/bdpart.c, libblock/src/ide_part_table.c: Get the
     5        device from the rdev field of the stat buf.
     6        * libcsupport/include/rtems/libio.h: Add a path length to evalpath
     7        handler. Add parent locations to rmmod and unlink handlers.
     8        * libcsupport/include/rtems/libio_.h: Add a path length to
     9        rtems_filesystem_evaluate_path. Add
     10        rtems_filesystem_evaluate_relative_path, rtems_filesystem_dirname,
     11        and rtems_filesystem_prefix_separators. Remove
     12        rtems_filesystem_evaluate_parent.
     13        * libcsupport/src/base_fs.c, libcsupport/src/chdir.c,
     14        libcsupport/src/chmod.c, libcsupport/src/chown.c,
     15        libcsupport/src/chroot.c, libcsupport/src/fchdir.c,
     16        libcsupport/src/link.c, libcsupport/src/mount.c,
     17        libcsupport/src/open.c, libcsupport/src/privateenv.c,
     18        libcsupport/src/readlink.c, libcsupport/src/unmount.c,
     19        libcsupport/src/utime.c, libcsupport/src/unmount.c,
     20        libcsupport/src/utime.c, libfs/src/devfs/devfs.h,
     21        libfs/src/devfs/devfs_eval.c, libfs/src/devfs/devstat.c,
     22        libfs/src/dosfs/msdos_create.c, libfs/src/dosfs/msdos_misc.c,
     23        libfs/src/imfs/imfs.h, libfs/src/imfs/imfs_eval.c,
     24        libfs/src/imfs/imfs_load_tar.c, libfs/src/imfs/ioman.c,
     25        libfs/src/pipe/pipe.c, libmisc/fsmount/fsmount.c,
     26        libnetworking/lib/ftpfs.c: Add the length parameter to the eval
     27        call.
     28        * libcsupport/src/eval.c: Add rtems_filesystem_prefix_separators,
     29        rtems_filesystem_dirname,
     30        rtems_filesystem_evaluate_relative_path. Add the length parameter
     31        to the eval call.
     32        * libcsupport/src/rmdir.c: Find the parent pathloc then the node
     33        pathloc from that node. Remove the call to find the parent given
     34        the node pathloc.
     35        * libcsupport/src/stat.c: Add the length parameter to the eval
     36        call. Set the device into the rdev field.
     37        * libcsupport/src/unlink.c: Find the parent pathloc then the node
     38        pathloc from that node. Remove the call to find the parent given
     39        the node pathloc.
     40        * libfs/src/dosfs/fat.c, libfs/src/dosfs/msdos_format.c: Get the
     41        disk device number from the stat rdev field.
     42        * libfs/src/dosfs/msdos.h: Add the length parameter to the eval
     43        call. Add the parent pathloc to the rmnod handler.
     44        * libfs/src/dosfs/msdos_dir.c: Add the parent pathloc to the rmnod
     45        handler.
     46        * libfs/src/dosfs/msdos_eval.c: Add the length parameter to the
     47        eval and token call.
     48        * libfs/src/imfs/imfs_directory.c: Add the parent pathloc to the
     49        rmnod handler.
     50        * libfs/src/imfs/imfs_fchmod.c: Do not test the mode flags for
     51        only the allowed flags. Add the missing flags spec'ed in the POSIX
     52        standard.
     53        * libfs/src/imfs/imfs_fsunmount.c, libfs/src/imfs/imfs_rmnod.c,
     54        libfs/src/imfs/imfs_unlink.c, libfs/src/imfs/memfile.c: Add the
     55        parent node. Currently ignored in the IMFS.
     56        * libfs/src/imfs/imfs_stat.c: Return the device number in the rdev
     57        field.
     58        * libfs/src/imfs/imfs_mknod.c, libfs/src/imfs/imfs_symlink.c : Add
     59        the length parameter to the token call.
     60        * libfs/src/nfsclient/src/nfs.c: Add the length parameter to the
     61        eval call and parent node to the rmnod and unlink command.
     62        * libmisc/shell/internal.h: Remove the libc mounter decl to make
     63        public.
     64        * libmisc/shell/main_mount.c: Add support for hooking external
     65        mount support for new file systems.
     66        * libmisc/shell/shell.h: Add helper functions for the mount
     67        command.
     68
    1692009-06-11      Joel Sherrill <joel.sherrill@OARcorp.com>
    270
  • cpukit/libblock/src/bdbuf.c

    r9e06eb1 r7baa484  
    19371937 * there are buffers to be written. If the transfer fails place the buffers
    19381938 * back on the modified list and try again later. The pool is unlocked while
    1939  * the buffers are beign written to disk.
     1939 * the buffers are being written to disk.
    19401940 *
    19411941 * @param pid The pool id to process modified buffers on.
     
    19661966  /*
    19671967   * When the sync is for a device limit the sync to that device. If the sync
    1968    * is for a buffer handle the devices in the order on the sync list. This
    1969    * means the dev is -1.
     1968   * is for a buffer handle process the devices in the order on the sync
     1969   * list. This means the dev is -1.
    19701970   */
    19711971  if (pool->sync_active)
     
    19731973
    19741974  /*
    1975    * If we have any buffers in the sync queue move then to the modified
     1975   * If we have any buffers in the sync queue move them to the modified
    19761976   * list. The first sync buffer will select the device we use.
    19771977   */
     
    19911991
    19921992  /*
    1993    * We have all the buffers that have been modified for this device so
    1994    * the pool can be unlocked because the state is set to TRANSFER.
    1995    */
    1996 
     1993   * We have all the buffers that have been modified for this device so the
     1994   * pool can be unlocked because the state of each buffer has been set to
     1995   * TRANSFER.
     1996   */
    19971997  rtems_bdbuf_unlock_pool (pool);
    19981998
    19991999  /*
    2000    * If there are buffers to transfer to the media tranfer them.
     2000   * If there are buffers to transfer to the media transfer them.
    20012001   */
    20022002  if (rtems_chain_is_empty (&transfer))
     
    20052005  {
    20062006    /*
    2007      * Obtain the disk device. Release the pool mutex to avoid a dead
    2008      * lock.
     2007     * Obtain the disk device. The pool's mutex has been released to avoid a
     2008     * dead lock.
    20092009     */
    20102010    dd = rtems_disk_obtain (dev);
     
    20212021      /*
    20222022       * Take as many buffers as configured and pass to the driver. Note, the
    2023        * API to the drivers has the array of buffers and if a chain was passed
     2023       * API to the drivers has an array of buffers and if a chain was passed
    20242024       * we could have just passed the list. If the driver API is updated it
    20252025       * should be possible to make this change with little effect in this
    20262026       * code. The array that is passed is broken in design and should be
    2027        * removed. Merging to members of a struct into the first member is
     2027       * removed. Merging members of a struct into the first member is
    20282028       * trouble waiting to happen.
    20292029       */
    2030 
    20312030      write_req->status = RTEMS_RESOURCE_IN_USE;
    20322031      write_req->error = 0;
  • cpukit/libblock/src/bdpart.c

    r9e06eb1 r7baa484  
    111111}
    112112
     113/*
     114 * FIXME: This code should the deviceio interface and not the bdbug interface.
     115 */
    113116static rtems_status_code rtems_bdpart_get_disk_data(
    114117  const char *disk_name,
     
    129132    return RTEMS_INVALID_NAME;
    130133  }
    131   *disk = st.st_dev;
     134  *disk = st.st_rdev;
    132135
    133136  /* Get disk begin, end and block size */
  • cpukit/libblock/src/ide_part_table.c

    r9e06eb1 r7baa484  
    468468
    469469    strncpy (disk_desc->dev_name, dev_name, 15);
    470     disk_desc->dev = dev_stat.st_dev;
     470    disk_desc->dev = dev_stat.st_rdev;
    471471    disk_desc->sector_size = (dev_stat.st_blksize) ? dev_stat.st_blksize :
    472472                                              RTEMS_IDE_SECTOR_SIZE;
  • cpukit/libcsupport/include/rtems/libio.h

    r9e06eb1 r7baa484  
    129129
    130130typedef int (*rtems_filesystem_rmnod_t)(
     131 rtems_filesystem_location_info_t      *parent_loc,   /* IN */
    131132 rtems_filesystem_location_info_t      *pathloc       /* IN */
    132133);
     
    175176typedef int (*rtems_filesystem_evalpath_t)(
    176177  const char                        *pathname,      /* IN     */
     178  int                                pathnamelen,   /* IN     */
    177179  int                                flags,         /* IN     */
    178180  rtems_filesystem_location_info_t  *pathloc        /* IN/OUT */
     
    192194
    193195typedef int (*rtems_filesystem_unlink_t)(
    194  rtems_filesystem_location_info_t  *pathloc       /* IN */
     196 rtems_filesystem_location_info_t  *parent_pathloc, /* IN */
     197 rtems_filesystem_location_info_t  *pathloc         /* IN */
    195198);
    196199
     
    327330   *  this will need to be used.
    328331   *
    329    *  The best option long term for this is probably an open file descriptor.
     332   *  The lower layers can manage how this is managed. Leave as a
     333   *  string.
    330334   */
    331335  char                                  *dev;
  • cpukit/libcsupport/include/rtems/libio_.h

    r9e06eb1 r7baa484  
    235235 */
    236236
    237 int rtems_filesystem_evaluate_path(
     237int rtems_filesystem_evaluate_relative_path(
    238238  const char                        *pathname,
     239  int                                pathnamelen,
    239240  int                                flags,
    240241  rtems_filesystem_location_info_t  *pathloc,
     
    242243);
    243244
    244 int rtems_filesystem_evaluate_parent(
     245int rtems_filesystem_evaluate_path(
     246  const char                        *pathname,
     247  int                                pathnamelen,
    245248  int                                flags,
    246   rtems_filesystem_location_info_t  *pathloc
     249  rtems_filesystem_location_info_t  *pathloc,
     250  int                                follow_link
     251);
     252
     253int rtems_filesystem_dirname(
     254  const char  *pathname
     255);
     256
     257int rtems_filesystem_prefix_separators(
     258  const char  *pathname,
     259  int          pathnamelen
    247260);
    248261
  • cpukit/libcsupport/src/base_fs.c

    r9e06eb1 r7baa484  
    9090  rtems_filesystem_root        = entry->mt_fs_root;
    9191  /* Clone the root pathloc */
    92   rtems_filesystem_evaluate_path("/", 0, &loc, 0);
     92  rtems_filesystem_evaluate_path("/", 1, 0, &loc, 0);
    9393  rtems_filesystem_root        = loc;
    9494  /* One more clone for the current node */
    95   rtems_filesystem_evaluate_path("/", 0, &loc, 0);
     95  rtems_filesystem_evaluate_path("/", 1, 0, &loc, 0);
    9696  rtems_filesystem_current     = loc;
    9797
  • cpukit/libcsupport/src/chdir.c

    r9e06eb1 r7baa484  
    3636
    3737  result = rtems_filesystem_evaluate_path(
    38     pathname, RTEMS_LIBIO_PERMS_SEARCH, &loc, true );
     38    pathname, strlen( pathname ), RTEMS_LIBIO_PERMS_SEARCH, &loc, true );
    3939  if ( result != 0 )
    4040     return -1;
  • cpukit/libcsupport/src/chmod.c

    r9e06eb1 r7baa484  
    3535  int                              result;
    3636
    37   status = rtems_filesystem_evaluate_path( path, 0, &loc, true );
     37  status = rtems_filesystem_evaluate_path( path, strlen( path ), 0, &loc, true );
    3838  if ( status != 0 )
    3939    return -1;
  • cpukit/libcsupport/src/chown.c

    r9e06eb1 r7baa484  
    3434  int                                result;
    3535
    36   if ( rtems_filesystem_evaluate_path( path, 0x00, &loc, true ) )
     36  if ( rtems_filesystem_evaluate_path( path, strlen( path ), 0x00, &loc, true ) )
    3737    return -1;
    3838
  • cpukit/libcsupport/src/chroot.c

    r9e06eb1 r7baa484  
    4545
    4646  /* clone the new root location */
    47   if (rtems_filesystem_evaluate_path(".", 0, &loc, 0)) {
     47  if (rtems_filesystem_evaluate_path(".", 1, 0, &loc, 0)) {
    4848    /* our cwd has changed, though - but there is no easy way of return :-( */
    4949    rtems_set_errno_and_return_minus_one( errno );
  • cpukit/libcsupport/src/eval.c

    r9e06eb1 r7baa484  
    2222#include <rtems/seterr.h>
    2323
    24 int rtems_filesystem_evaluate_path(
     24int rtems_filesystem_evaluate_relative_path(
    2525  const char                        *pathname,
     26  int                                pathnamelen,
    2627  int                                flags,
    2728  rtems_filesystem_location_info_t  *pathloc,
     
    4344    rtems_set_errno_and_return_minus_one( EIO );       /* should never happen */
    4445
    45   /*
    46    * Evaluate the path using the optable evalpath.
    47    */
    48 
    49   rtems_filesystem_get_start_loc( pathname, &i, pathloc );
    50 
    5146  if ( !pathloc->ops->evalpath_h )
    5247    rtems_set_errno_and_return_minus_one( ENOTSUP );
    5348
    54   result = (*pathloc->ops->evalpath_h)( &pathname[i], flags, pathloc );
     49  result = (*pathloc->ops->evalpath_h)( &pathname[i], pathnamelen, flags, pathloc );
    5550
    5651  /*
     
    9186
    9287        result =  (*pathloc->ops->eval_link_h)( pathloc, flags );
    93 
    9488    }
    9589  }
     
    9892}
    9993
    100 
    101 int rtems_filesystem_evaluate_parent(
     94int rtems_filesystem_evaluate_path(
     95  const char                        *pathname,
     96  int                                pathnamelen,
    10297  int                                flags,
    103   rtems_filesystem_location_info_t  *pathloc
     98  rtems_filesystem_location_info_t  *pathloc,
     99  int                                follow_link
    104100)
    105101{
    106   rtems_filesystem_location_info_t  parent;
    107   int                               result;
     102  int                           i;
     103  int                           result;
     104  rtems_filesystem_node_types_t type;
     105
     106  /*
     107   * Verify Input parameters.
     108   */
     109
     110  if ( !pathname )
     111    rtems_set_errno_and_return_minus_one( EFAULT );
    108112
    109113  if ( !pathloc )
    110114    rtems_set_errno_and_return_minus_one( EIO );       /* should never happen */
    111115
    112   if ( !pathloc->ops->evalpath_h )
    113     rtems_set_errno_and_return_minus_one( ENOTSUP );
     116  /*
     117   * Evaluate the path using the optable evalpath.
     118   */
    114119
    115   parent = *pathloc;
    116   result = (*pathloc->ops->evalpath_h)( "..", flags, &parent );
    117   if (result != 0){
    118     return -1;
     120  rtems_filesystem_get_start_loc( pathname, &i, pathloc );
     121
     122  /*
     123   * We evaluation the path relative to the start location we get got.
     124   */
     125  return rtems_filesystem_evaluate_relative_path( pathname,
     126                                                  pathnamelen,
     127                                                  flags,
     128                                                  pathloc,
     129                                                  follow_link );
     130}
     131
     132int rtems_filesystem_dirname(
     133  const char  *pathname
     134)
     135{
     136  int len = strlen( pathname );
     137
     138  while ( len ) {
     139    len--;
     140    if ( rtems_filesystem_is_separator( pathname[len] ) )
     141      break;
    119142  }
    120   rtems_filesystem_freenode( &parent );
    121143
    122   return result;
     144  return len;
    123145}
     146
     147int rtems_filesystem_prefix_separators(
     148  const char  *pathname,
     149  int          pathnamelen
     150)
     151{
     152  /*
     153   * Eat any separators at start of the path.
     154   */
     155  int stripped = 0;
     156  while ( *pathname && pathnamelen && rtems_filesystem_is_separator( *pathname ) )
     157  {
     158    pathname++;
     159    pathnamelen--;
     160    stripped++;
     161  }
     162  return stripped;
     163}
  • cpukit/libcsupport/src/fchdir.c

    r9e06eb1 r7baa484  
    7777
    7878  /* clone the current node */
    79   if (rtems_filesystem_evaluate_path(".", 0, &loc, 0)) {
     79  if (rtems_filesystem_evaluate_path(".", 1, 0, &loc, 0)) {
    8080    /* cloning failed; restore original and bail out */
    8181    rtems_filesystem_current = saved;
  • cpukit/libcsupport/src/link.c

    r9e06eb1 r7baa484  
    3838   */
    3939
    40   result = rtems_filesystem_evaluate_path( existing, 0, &existing_loc, true );
     40  result = rtems_filesystem_evaluate_path( existing, strlen( existing ),
     41                                           0, &existing_loc, true );
    4142  if ( result != 0 )
    4243     return -1;
  • cpukit/libcsupport/src/mount.c

    r9e06eb1 r7baa484  
    140140
    141141    if ( rtems_filesystem_evaluate_path(
    142             mount_point, RTEMS_LIBIO_PERMS_RWX, &loc, true ) == -1 )
     142           mount_point, strlen( mount_point ), RTEMS_LIBIO_PERMS_RWX, &loc, true ) == -1 )
    143143      goto cleanup_and_bail;
    144144
  • cpukit/libcsupport/src/open.c

    r9e06eb1 r7baa484  
    112112
    113113  status = rtems_filesystem_evaluate_path(
    114      pathname, eval_flags, &loc, true );
     114    pathname, strlen( pathname ), eval_flags, &loc, true );
    115115
    116116  if ( status == -1 ) {
     
    134134
    135135    /* Sanity check to see if the file name exists after the mknod() */
    136     status = rtems_filesystem_evaluate_path( pathname, 0x0, &loc, true );
     136    status = rtems_filesystem_evaluate_path( pathname, strlen( pathname ), 0x0, &loc, true );
    137137    if ( status != 0 ) {   /* The file did not exist */
    138138      rc = EACCES;
  • cpukit/libcsupport/src/privateenv.c

    r9e06eb1 r7baa484  
    9292   */
    9393
    94   rtems_filesystem_evaluate_path("/", 0, &loc, 0);
     94  rtems_filesystem_evaluate_path("/", 1, 0, &loc, 0);
    9595  rtems_filesystem_root    = loc;
    96   rtems_filesystem_evaluate_path("/", 0, &loc, 0);
     96  rtems_filesystem_evaluate_path("/", 1, 0, &loc, 0);
    9797  rtems_filesystem_current = loc;
    9898
  • cpukit/libcsupport/src/readlink.c

    r9e06eb1 r7baa484  
    3131    rtems_set_errno_and_return_minus_one( EFAULT );
    3232
    33   result = rtems_filesystem_evaluate_path( pathname, 0, &loc, false );
     33  result = rtems_filesystem_evaluate_path( pathname, strlen( pathname ),
     34                                           0, &loc, false );
    3435  if ( result != 0 )
    3536     return -1;
  • cpukit/libcsupport/src/rmdir.c

    r9e06eb1 r7baa484  
    2929)
    3030{
     31  int                               parentpathlen;
     32  const char                       *name;
     33  rtems_filesystem_location_info_t  parentloc;
    3134  rtems_filesystem_location_info_t  loc;
     35  int                               i;
    3236  int                               result;
     37 
     38  /*
     39   *  Get the parent node of the node we wish to remove. Find the parent path.
     40   */
     41
     42  parentpathlen = rtems_filesystem_dirname ( pathname );
     43
     44  if ( parentpathlen == 0 )
     45    rtems_filesystem_get_start_loc( pathname, &i, &parentloc );
     46  else {
     47    result = rtems_filesystem_evaluate_path(pathname, parentpathlen,
     48                                            RTEMS_LIBIO_PERMS_WRITE,
     49                                            &parentloc,
     50                                            false );
     51    if ( result != 0 )
     52      return -1;
     53  }
    3354
    3455  /*
    35    *  Get the node where we wish to go.
     56   * Start from the parent to find the node that should be under it.
    3657   */
    37 
    38   result = rtems_filesystem_evaluate_path( pathname, 0, &loc, false );
    39   if ( result != 0 )
    40      return -1;
    41 
    42   result = rtems_filesystem_evaluate_parent(RTEMS_LIBIO_PERMS_WRITE, &loc );
    43   if (result != 0) {
    44     rtems_filesystem_freenode( &loc );
     58 
     59  loc = parentloc;
     60  name = pathname + parentpathlen;
     61  name += rtems_filesystem_prefix_separators( name, strlen( name ) );
     62 
     63  result = rtems_filesystem_evaluate_relative_path( name , strlen( name ),
     64                                                    0, &loc, false );
     65  if ( result != 0 ) {
     66    rtems_filesystem_freenode( &parentloc );
    4567    return -1;
    4668  }
     
    5274  if ( !loc.ops->node_type_h ){
    5375    rtems_filesystem_freenode( &loc );
     76    rtems_filesystem_freenode( &parentloc );
    5477    rtems_set_errno_and_return_minus_one( ENOTSUP );
    5578  }
     
    5780  if (  (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ){
    5881    rtems_filesystem_freenode( &loc );
     82    rtems_filesystem_freenode( &parentloc );
    5983    rtems_set_errno_and_return_minus_one( ENOTDIR );
    6084  }
     
    6690  if ( !loc.handlers->rmnod_h ){
    6791    rtems_filesystem_freenode( &loc );
     92    rtems_filesystem_freenode( &parentloc );
    6893    rtems_set_errno_and_return_minus_one( ENOTSUP );
    6994  }
    7095
    71   result =  (*loc.handlers->rmnod_h)( &loc );
     96  result =  (*loc.handlers->rmnod_h)( &parentloc, &loc );
    7297
    7398  rtems_filesystem_freenode( &loc );
     99  rtems_filesystem_freenode( &parentloc );
    74100
    75101  return result;
  • cpukit/libcsupport/src/stat.c

    r9e06eb1 r7baa484  
    6060    rtems_set_errno_and_return_minus_one( EFAULT );
    6161
    62   status = rtems_filesystem_evaluate_path( path, 0, &loc, _STAT_FOLLOW_LINKS );
     62  status = rtems_filesystem_evaluate_path( path, strlen( path ),
     63                                           0, &loc, _STAT_FOLLOW_LINKS );
    6364  if ( status != 0 )
    6465    return -1;
  • cpukit/libcsupport/src/unlink.c

    r9e06eb1 r7baa484  
    2525)
    2626{
     27  int                               parentpathlen;
     28  const char                       *name;
     29  rtems_filesystem_location_info_t  parentloc;
    2730  rtems_filesystem_location_info_t  loc;
     31  int                               i;
    2832  int                               result;
    2933
    3034  /*
    31    * Get the node to be unlinked.
     35   * Get the node to be unlinked. Find the parent path first.
    3236   */
    33 
    34   result = rtems_filesystem_evaluate_path( path, 0, &loc, false );
    35   if ( result != 0 )
    36      return -1;
    37 
    38   result = rtems_filesystem_evaluate_parent(RTEMS_LIBIO_PERMS_WRITE, &loc );
    39   if (result != 0 && errno != ENOTSUP) {
    40     rtems_filesystem_freenode( &loc );
     37 
     38  parentpathlen = rtems_filesystem_dirname ( path );
     39 
     40  if ( parentpathlen == 0 )
     41    rtems_filesystem_get_start_loc( path, &i, &parentloc );
     42  else {
     43    result = rtems_filesystem_evaluate_path( path, parentpathlen,
     44                                             RTEMS_LIBIO_PERMS_WRITE,
     45                                             &parentloc,
     46                                             false );
     47    if ( result != 0 )
     48      return -1;
     49  }
     50 
     51  /*
     52   * Start from the parent to find the node that should be under it.
     53   */
     54 
     55  loc = parentloc;
     56  name = path + parentpathlen;
     57  name += rtems_filesystem_prefix_separators( name, strlen( name ) );
     58 
     59  result = rtems_filesystem_evaluate_relative_path( name , strlen( name ),
     60                                                    0, &loc, false );
     61  if ( result != 0 ) {
     62    rtems_filesystem_freenode( &parentloc );
    4163    return -1;
    4264  }
    43 
     65 
    4466  if ( !loc.ops->node_type_h ) {
    4567    rtems_filesystem_freenode( &loc );
     68    rtems_filesystem_freenode( &parentloc );
    4669    rtems_set_errno_and_return_minus_one( ENOTSUP );
    4770  }
     
    4972  if (  (*loc.ops->node_type_h)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY ) {
    5073    rtems_filesystem_freenode( &loc );
     74    rtems_filesystem_freenode( &parentloc );
    5175    rtems_set_errno_and_return_minus_one( EISDIR );
    5276  }
     
    5478  if ( !loc.ops->unlink_h ) {
    5579    rtems_filesystem_freenode( &loc );
     80    rtems_filesystem_freenode( &parentloc );
    5681    rtems_set_errno_and_return_minus_one( ENOTSUP );
    5782  }
    5883
    59   result = (*loc.ops->unlink_h)( &loc );
     84  result = (*loc.ops->unlink_h)( &parentloc, &loc );
    6085
    6186  rtems_filesystem_freenode( &loc );
     87  rtems_filesystem_freenode( &parentloc );
    6288
    6389  return result;
  • cpukit/libcsupport/src/unmount.c

    r9e06eb1 r7baa484  
    114114   */
    115115
    116   if ( rtems_filesystem_evaluate_path( path, 0x0, &loc, true ) )
     116  if ( rtems_filesystem_evaluate_path( path, strlen( path ), 0x0, &loc, true ) )
    117117    return -1;
    118118
  • cpukit/libcsupport/src/utime.c

    r9e06eb1 r7baa484  
    3131  int                                result;
    3232
    33   if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, true ) )
     33  if ( rtems_filesystem_evaluate_path( path, strlen( path ), 0x00, &temp_loc, true ) )
    3434    return -1;
    3535
  • cpukit/libfs/src/devfs/devfs.h

    r9e06eb1 r7baa484  
    196196extern int devFS_evaluate_path(
    197197  const char                        *pathname,
     198  int                                pathnamelen,
    198199  int                                flags,
    199200  rtems_filesystem_location_info_t  *pathloc
  • cpukit/libfs/src/devfs/devfs_eval.c

    r9e06eb1 r7baa484  
    1818int devFS_evaluate_path(
    1919  const char                        *pathname,
     20  int                                pathnamelen,
    2021  int                                flags,
    2122  rtems_filesystem_location_info_t  *pathloc
     
    3839    for (i = 0; i < rtems_device_table_size; i++){
    3940        if ((device_name_table[i].device_name) &&
    40                 (strcmp(device_name_table[i].device_name, pathname) == 0)){
     41                (strncmp(pathname, device_name_table[i].device_name, pathnamelen) == 0)){
    4142            /* find the device, set proper values */
    4243            pathloc->node_access = (void *)&device_name_table[i];
  • cpukit/libfs/src/devfs/devstat.c

    r9e06eb1 r7baa484  
    3131    rtems_set_errno_and_return_minus_one( EFAULT );
    3232
    33   buf->st_dev  = rtems_filesystem_make_dev_t( the_dev->major, the_dev->minor );
     33  buf->st_rdev  = rtems_filesystem_make_dev_t( the_dev->major, the_dev->minor );
    3434
    3535  buf->st_mode = the_dev->mode;
  • cpukit/libfs/src/dosfs/fat.c

    r9e06eb1 r7baa484  
    355355
    356356    /* check that device is registred as block device and lock it */
    357     vol->dd = rtems_disk_obtain(stat_buf.st_dev);
     357    vol->dd = rtems_disk_obtain(stat_buf.st_rdev);
    358358    if (vol->dd == NULL)
    359359        rtems_set_errno_and_return_minus_one(ENOTBLK);
    360360
    361     vol->dev = stat_buf.st_dev;
     361    vol->dev = stat_buf.st_rdev;
    362362
    363363    /* Read boot record */
  • cpukit/libfs/src/dosfs/msdos.h

    r9e06eb1 r7baa484  
    229229
    230230int msdos_eval_path(
    231   const char                       *pathname, /* IN */
    232   int                               flags,    /* IN */
    233   rtems_filesystem_location_info_t *pathloc   /* IN/OUT */
     231  const char                       *pathname,    /* IN */
     232  int                               pathnamelen, /* IN */
     233  int                               flags,       /* IN */
     234  rtems_filesystem_location_info_t *pathloc      /* IN/OUT */
    234235);
    235236
     
    320321);
    321322
    322 int msdos_file_rmnod(rtems_filesystem_location_info_t *pathloc /* IN */);
     323int msdos_file_rmnod(rtems_filesystem_location_info_t *parent_pathloc, /* IN */
     324                     rtems_filesystem_location_info_t *pathloc /* IN */);
    323325
    324326int msdos_file_link(
     
    355357);
    356358
    357 int msdos_dir_rmnod(rtems_filesystem_location_info_t *pathloc /* IN */);
     359int msdos_dir_rmnod(rtems_filesystem_location_info_t *parent_pathloc, /* IN */
     360                    rtems_filesystem_location_info_t *pathloc /* IN */);
    358361
    359362int msdos_dir_sync(rtems_libio_t *iop);
     
    373376/* Misc prototypes */
    374377msdos_token_types_t msdos_get_token(const char  *path,
     378                                    int          pathlen,
    375379                                    const char **token,
    376380                                    int         *token_len);
  • cpukit/libfs/src/dosfs/msdos_create.c

    r9e06eb1 r7baa484  
    311311     * check spelling and format new node name
    312312     */
    313     if (MSDOS_NAME != msdos_get_token(name, &token, &len)) {
     313    if (MSDOS_NAME != msdos_get_token(name, strlen(name), &token, &len)) {
    314314      rtems_set_errno_and_return_minus_one(ENAMETOOLONG);
    315315    }
  • cpukit/libfs/src/dosfs/msdos_dir.c

    r9e06eb1 r7baa484  
    638638 */
    639639int
    640 msdos_dir_rmnod(rtems_filesystem_location_info_t *pathloc)
     640msdos_dir_rmnod(rtems_filesystem_location_info_t *parent_pathloc,
     641                rtems_filesystem_location_info_t *pathloc)
    641642{
    642643    int                rc = RC_OK;
  • cpukit/libfs/src/dosfs/msdos_eval.c

    r9e06eb1 r7baa484  
    7373msdos_eval_path(
    7474    const char                        *pathname,
     75    int                                pathnamelen,
    7576    int                                flags,
    7677    rtems_filesystem_location_info_t  *pathloc
     
    107108    while ((type != MSDOS_NO_MORE_PATH) && (type != MSDOS_INVALID_TOKEN))
    108109    {
    109         type = msdos_get_token(&pathname[i], &token, &token_len);
     110        type = msdos_get_token(&pathname[i], pathnamelen, &token, &token_len);
     111        pathnamelen += token_len;
    110112        i += token_len;
    111113
     
    151153                        rtems_semaphore_release(fs_info->vol_sema);
    152154                        return (*pathloc->ops->evalpath_h)(&(pathname[i-token_len]),
     155                                                           pathnamelen - token_len,
    153156                                                           flags, pathloc);
    154157                    }
     
    289292    while (!done)
    290293    {
    291         type = msdos_get_token(&path[i], &token, &token_len);
     294        type = msdos_get_token(&path[i], strlen(&path[i]), &token, &token_len);
    292295        i += token_len;
    293296        fat_fd = pathloc->node_access;
  • cpukit/libfs/src/dosfs/msdos_file.c

    r9e06eb1 r7baa484  
    475475 */
    476476int
    477 msdos_file_rmnod(rtems_filesystem_location_info_t *pathloc)
     477msdos_file_rmnod(rtems_filesystem_location_info_t *parent_pathloc,
     478                 rtems_filesystem_location_info_t *pathloc)
    478479{
    479480    int                rc = RC_OK;
  • cpukit/libfs/src/dosfs/msdos_format.c

    r9e06eb1 r7baa484  
    917917  /* check that  device is registered as block device and lock it */
    918918  if (ret_val == 0) {
    919     dd = rtems_disk_obtain(stat_buf.st_dev);
     919    dd = rtems_disk_obtain(stat_buf.st_rdev);
    920920    if (dd == NULL) {
    921921      errno = ENOTBLK;
  • cpukit/libfs/src/dosfs/msdos_misc.c

    r9e06eb1 r7baa484  
    228228 */
    229229msdos_token_types_t
    230 msdos_get_token(const char *path, const char **ret_token, int *ret_token_len)
     230msdos_get_token(const char  *path,
     231                int          pathlen,
     232                const char **ret_token,
     233                int         *ret_token_len)
    231234{
    232235    msdos_token_types_t type = MSDOS_NAME;
     
    239242     *  Check for a separator.
    240243     */
    241     while (!msdos_is_separator(path[i]))
     244    while (!msdos_is_separator(path[i]) && (i < pathlen))
    242245    {
    243246        if ( !msdos_is_valid_name_char(path[i]) )
     
    255258    if ( i == 0 )
    256259    {
    257         if ( *path != '\0' )
     260      if ( (*path != '\0') && pathlen )
    258261        {
    259262            i++;
  • cpukit/libfs/src/imfs/imfs.h

    r9e06eb1 r7baa484  
    278278extern IMFS_token_types IMFS_get_token(
    279279  const char       *path,
     280  int               pathlen,
    280281  char             *token,
    281282  int              *token_len
     
    317318extern int IMFS_eval_path(
    318319  const char                        *pathname,     /* IN     */
     320  int                               pathnamelen,   /* IN     */
    319321  int                               flags,         /* IN     */
    320322  rtems_filesystem_location_info_t  *pathloc       /* IN/OUT */
     
    329331
    330332extern int IMFS_unlink(
    331   rtems_filesystem_location_info_t  *pathloc       /* IN */
     333  rtems_filesystem_location_info_t  *parent_pathloc, /* IN */
     334  rtems_filesystem_location_info_t  *pathloc         /* IN */
    332335);
    333336
     
    413416
    414417extern int imfs_dir_rmnod(
    415   rtems_filesystem_location_info_t      *pathloc       /* IN */
     418  rtems_filesystem_location_info_t *parent_pathloc, /* IN */
     419  rtems_filesystem_location_info_t *pathloc         /* IN */
    416420);
    417421
     
    452456
    453457extern int memfile_rmnod(
    454   rtems_filesystem_location_info_t      *pathloc       /* IN */
     458  rtems_filesystem_location_info_t  *parent_pathloc, /* IN */
     459  rtems_filesystem_location_info_t  *pathloc         /* IN */
    455460);
    456461
     
    528533
    529534extern int IMFS_rmnod(
    530   rtems_filesystem_location_info_t      *pathloc       /* IN */
     535  rtems_filesystem_location_info_t  *parent_pathloc, /* IN */
     536  rtems_filesystem_location_info_t  *pathloc         /* IN */
    531537);
    532538
  • cpukit/libfs/src/imfs/imfs_directory.c

    r9e06eb1 r7baa484  
    283283
    284284int imfs_dir_rmnod(
    285   rtems_filesystem_location_info_t      *pathloc       /* IN */
     285  rtems_filesystem_location_info_t  *parent_pathloc, /* IN */
     286  rtems_filesystem_location_info_t  *pathloc         /* IN */
    286287)
    287288{
  • cpukit/libfs/src/imfs/imfs_eval.c

    r9e06eb1 r7baa484  
    207207  result = IMFS_eval_path(
    208208    &jnode->info.sym_link.name[i],
     209    strlen( &jnode->info.sym_link.name[i] ),
    209210    flags,
    210211    node
     
    295296  IMFS_jnode_t                       *node;
    296297  bool                                done = false;
     298  int                                 pathlen;
    297299  int                                 result;
    298300
     
    304306
    305307  /*
     308   * Get the path length.
     309   */
     310  pathlen = strlen( path );
     311  /*
    306312   *  Evaluate all tokens until we are done or an error occurs.
    307313   */
    308 
     314 
    309315  while( !done ) {
    310316
    311     type = IMFS_get_token( &path[i], token, &len );
     317    type = IMFS_get_token( &path[i], pathlen, token, &len );
     318    pathlen -= len;
    312319    i +=  len;
    313320
     
    481488int IMFS_eval_path(
    482489  const char                        *pathname,     /* IN     */
     490  int                                pathnamelen,  /* IN     */
    483491  int                                flags,        /* IN     */
    484492  rtems_filesystem_location_info_t  *pathloc       /* IN/OUT */
     
    511519  while( (type != IMFS_NO_MORE_PATH) && (type != IMFS_INVALID_TOKEN) ) {
    512520
    513     type = IMFS_get_token( &pathname[i], token, &len );
    514     i +=  len;
     521    type = IMFS_get_token( &pathname[i], pathnamelen, token, &len );
     522    pathnamelen -= len;
     523    i += len;
    515524
    516525    if ( !pathloc->node_access )
     
    552561            newloc = pathloc->mt_entry->mt_point_node;
    553562            *pathloc = newloc;
    554             return (*pathloc->ops->evalpath_h)(&(pathname[i-len]),flags,pathloc);
     563            return (*pathloc->ops->evalpath_h)(&(pathname[i-len]),
     564                                               pathnamelen+len,
     565                                               flags,pathloc);
    555566          }
    556567        } else {
     
    604615          newloc   = node->info.directory.mt_fs->mt_fs_root;
    605616          *pathloc = newloc;
    606           return (*pathloc->ops->evalpath_h)( &pathname[i-len], flags, pathloc );
     617          return (*pathloc->ops->evalpath_h)( &pathname[i-len],
     618                                              pathnamelen+len,
     619                                              flags, pathloc );
    607620        }
    608621
     
    646659      newloc   = node->info.directory.mt_fs->mt_fs_root;
    647660      *pathloc = newloc;
    648       return (*pathloc->ops->evalpath_h)( &pathname[i-len], flags, pathloc );
     661      return (*pathloc->ops->evalpath_h)( &pathname[i-len],
     662                                          pathnamelen+len,
     663                                          flags, pathloc );
    649664    } else {
    650665      result = IMFS_Set_handlers( pathloc );
  • cpukit/libfs/src/imfs/imfs_fchmod.c

    r9e06eb1 r7baa484  
    4747   * Change only the RWX permissions on the jnode to mode.
    4848   */
    49   if ( mode & (~ (S_IRWXU | S_IRWXG | S_IRWXO ) ) )
    50     rtems_set_errno_and_return_minus_one( EPERM );
    5149
    52   jnode->st_mode &= ~(S_IRWXU | S_IRWXG | S_IRWXO);
    53   jnode->st_mode |= mode;
     50  jnode->st_mode &= ~(S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX);
     51  jnode->st_mode |= mode & (S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX);
    5452
    5553  IMFS_update_ctime( jnode );
  • cpukit/libfs/src/imfs/imfs_fsunmount.c

    r9e06eb1 r7baa484  
    7575
    7676     if ( jnode->type != IMFS_DIRECTORY ) {
    77         result = IMFS_unlink( &loc );
     77        result = IMFS_unlink( NULL, &loc );
    7878        if (result != 0)
    7979          return -1;
    8080        jnode = next;
    8181     } else if ( jnode_has_no_children( jnode ) ) {
    82         result = IMFS_unlink( &loc );
     82        result = IMFS_unlink( NULL, &loc );
    8383        if (result != 0)
    8484          return -1;
  • cpukit/libfs/src/imfs/imfs_gtkn.c

    r9e06eb1 r7baa484  
    2727IMFS_token_types IMFS_get_token(
    2828  const char       *path,
     29  int               pathlen,
    2930  char             *token,
    3031  int              *token_len
     
    3940   */
    4041  c = path[i];
    41   while ( (!IMFS_is_separator(c)) && (i <= IMFS_NAME_MAX) ) {
     42  while ( (!IMFS_is_separator(c)) && (i < pathlen) && (i <= IMFS_NAME_MAX) ) {
    4243
    4344     token[i] = c;
     
    5960    token[i] = c;
    6061
    61     if ( token[i] != '\0' ) {
     62    if ( (token[i] != '\0') && pathlen ) {
    6263      i++;
    6364      type = IMFS_CURRENT_DIR;
  • cpukit/libfs/src/imfs/imfs_link.c

    r9e06eb1 r7baa484  
    4848   */
    4949
    50   IMFS_get_token( token, new_name, &i );
     50  IMFS_get_token( token, strlen( token ), new_name, &i );
    5151
    5252  /*
  • cpukit/libfs/src/imfs/imfs_load_tar.c

    r9e06eb1 r7baa484  
    9393   int             status;
    9494
    95    status = rtems_filesystem_evaluate_path(mountpoint, 0, &root_loc, 0);
     95   status = rtems_filesystem_evaluate_path(mountpoint, strlen(mountpoint),
     96                                           0, &root_loc, 0);
    9697   if (status != 0)
    9798      return(-1);
  • cpukit/libfs/src/imfs/imfs_mknod.c

    r9e06eb1 r7baa484  
    4242  IMFS_types_union   info;
    4343
    44   IMFS_get_token( token, new_name, &result );
     44  IMFS_get_token( token, strlen( token ), new_name, &result );
    4545
    4646  /*
  • cpukit/libfs/src/imfs/imfs_rmnod.c

    r9e06eb1 r7baa484  
    3232
    3333int IMFS_rmnod(
    34   rtems_filesystem_location_info_t      *pathloc       /* IN */
     34  rtems_filesystem_location_info_t  *parent_pathloc, /* IN */
     35  rtems_filesystem_location_info_t  *pathloc         /* IN */
    3536)
    3637{
  • cpukit/libfs/src/imfs/imfs_stat.c

    r9e06eb1 r7baa484  
    3737
    3838    case IMFS_DEVICE:
    39       io          = &the_jnode->info.device;
    40       buf->st_dev = rtems_filesystem_make_dev_t( io->major, io->minor );
     39      io           = &the_jnode->info.device;
     40      buf->st_rdev = rtems_filesystem_make_dev_t( io->major, io->minor );
    4141      break;
    4242
  • cpukit/libfs/src/imfs/imfs_symlink.c

    r9e06eb1 r7baa484  
    4242   */
    4343
    44   IMFS_get_token( node_name, new_name, &i );
     44  IMFS_get_token( node_name, strlen( node_name ), new_name, &i );
    4545
    4646  /*
  • cpukit/libfs/src/imfs/imfs_unlink.c

    r9e06eb1 r7baa484  
    2626
    2727int IMFS_unlink(
    28   rtems_filesystem_location_info_t  *loc       /* IN */
     28  rtems_filesystem_location_info_t  *parentloc, /* IN */
     29  rtems_filesystem_location_info_t  *loc        /* IN */
    2930)
    3031{
     
    6162    if ( node->info.hard_link.link_node->st_nlink == 1)
    6263    {
    63         result = (*the_link.handlers->rmnod_h)( &the_link );
     64        result = (*the_link.handlers->rmnod_h)( parentloc, &the_link );
    6465        if ( result != 0 )
    6566            return -1;
     
    7677   */
    7778
    78   result = (*loc->handlers->rmnod_h)( loc );
     79  result = (*loc->handlers->rmnod_h)( parentloc, loc );
    7980
    8081  return result;
  • cpukit/libfs/src/imfs/ioman.c

    r9e06eb1 r7baa484  
    8181  rtems_filesystem_node_types_t      node_type;
    8282
    83   result = rtems_filesystem_evaluate_path( name, 0x00, &loc, true );
     83  result = rtems_filesystem_evaluate_path( name, strlen( name ), 0x00, &loc, true );
    8484  the_jnode = loc.node_access;
    8585
  • cpukit/libfs/src/imfs/memfile.c

    r9e06eb1 r7baa484  
    11061106
    11071107int memfile_rmnod(
    1108   rtems_filesystem_location_info_t      *pathloc       /* IN */
     1108  rtems_filesystem_location_info_t  *parent_pathloc,  /* IN */
     1109  rtems_filesystem_location_info_t  *pathloc          /* IN */
    11091110)
    11101111{
  • cpukit/libfs/src/nfsclient/src/nfs.c

    r9e06eb1 r7baa484  
    13561356STATIC int nfs_do_evalpath(
    13571357        const char                        *pathname,      /* IN     */
     1358        int                                pathnamelen,   /* IN     */
    13581359        void                              *arg,
    13591360        rtems_filesystem_location_info_t  *pathloc,       /* IN/OUT */
     
    13761377                goto cleanup;
    13771378        }
    1378         strcpy(p, pathname);
     1379        memset(p, 0, MAXPATHLEN+1);
     1380        memcpy(p, pathname, pathnamelen);
    13791381
    13801382        LOCK(nfsGlob.lock);
     
    15111513                                rval = pathloc->ops->evalformake_h(part, pathloc, (const char**)arg);
    15121514                        else
    1513                                 rval = pathloc->ops->evalpath_h(part, (int)arg, pathloc);
     1515                                rval = pathloc->ops->evalpath_h(part, strlen(part), (int)arg, pathloc);
    15141516
    15151517                        free(p);
     
    16681670)
    16691671{
    1670         return nfs_do_evalpath(path, (void*)pname, pathloc, 1 /*forMake*/);
     1672        return nfs_do_evalpath(path, strlen(path), (void*)pname, pathloc, 1 /*forMake*/);
    16711673}
    16721674
    16731675static int nfs_evalpath(
    16741676        const char                                               *path,           /* IN */
     1677        int                                                              pathlen,                 /* IN */
    16751678        int                                                              flags,           /* IN */
    16761679        rtems_filesystem_location_info_t *pathloc    /* IN/OUT */
    16771680)
    16781681{
    1679         return nfs_do_evalpath(path, (void*)flags, pathloc, 0 /*not forMake*/);
     1682        return nfs_do_evalpath(path, pathlen, (void*)flags, pathloc, 0 /*not forMake*/);
    16801683}
    16811684
     
    17301733
    17311734static int nfs_do_unlink(
    1732         rtems_filesystem_location_info_t  *loc,       /* IN */
     1735        rtems_filesystem_location_info_t  *parent_loc,/* IN */
     1736  rtems_filesystem_location_info_t  *loc,       /* IN */
    17331737        int                                                               proc
    17341738)
     
    17691773
    17701774static int nfs_unlink(
    1771         rtems_filesystem_location_info_t  *loc       /* IN */
     1775 rtems_filesystem_location_info_t  *parent_loc, /* IN */
     1776 rtems_filesystem_location_info_t  *loc         /* IN */
    17721777)
    17731778{
    1774         return nfs_do_unlink(loc, NFSPROC_REMOVE);
     1779        return nfs_do_unlink(parent_loc, loc, NFSPROC_REMOVE);
    17751780}
    17761781
     
    23582363                                pathloc->handlers = &nfs_dir_file_handlers;
    23592364
    2360                                 err = nfs_evalpath(buf, flags, pathloc);
     2365                                err = nfs_evalpath(buf, strlen(buf), flags, pathloc);
    23612366
    23622367                                /* according to its semantics,
     
    23992404                        rtems_filesystem_freenode(pathloc);
    24002405
    2401                         if (rtems_filesystem_evaluate_path(buf, flags, pathloc, 1)) {
     2406                        if (rtems_filesystem_evaluate_path(buf, strlen(buf), flags, pathloc, 1)) {
    24022407                                /* If evalpath fails then there is no valid node
    24032408                                 * attached to pathloc; hence we must not attempt
     
    30803085 */
    30813086static int nfs_dir_rmnod(
    3082         rtems_filesystem_location_info_t      *pathloc       /* IN */
     3087        rtems_filesystem_location_info_t      *parentpathloc, /* IN */
     3088        rtems_filesystem_location_info_t      *pathloc        /* IN */
    30833089)
    30843090{
    3085         return nfs_do_unlink(pathloc, NFSPROC_RMDIR);
     3091        return nfs_do_unlink(parentpathloc, pathloc, NFSPROC_RMDIR);
    30863092}
    30873093
  • cpukit/libfs/src/pipe/pipe.c

    r9e06eb1 r7baa484  
    3131
    3232  /* Create /tmp if not exists */
    33   if (rtems_filesystem_evaluate_path("/tmp", RTEMS_LIBIO_PERMS_RWX, &loc, TRUE)
     33  if (rtems_filesystem_evaluate_path("/tmp", 3, RTEMS_LIBIO_PERMS_RWX, &loc, TRUE)
    3434      != 0) {
    3535    if (errno != ENOENT)
  • cpukit/libmisc/fsmount/fsmount.c

    r9e06eb1 r7baa484  
    7777     * scan through given string, one segment at a time
    7878     */
    79     token_type = IMFS_get_token(mount_point+total_len,token,&token_len);
     79    token_type = IMFS_get_token(mount_point+total_len,strlen(mount_point+total_len),
     80                                token,&token_len);
    8081    total_len += token_len;
    8182    strncpy(tok_buffer,mount_point,total_len);
  • cpukit/libmisc/shell/internal.h

    r9e06eb1 r7baa484  
    3030void rtems_shell_initialize_command_set(void);
    3131
    32 int rtems_shell_libc_mounter(
    33   const char*                driver,
    34   const char*                path,
    35   rtems_shell_filesystems_t* fs,
    36   rtems_filesystem_options_t options
    37 );
    38 
    3932void rtems_shell_print_heap_info(
    4033  const char       *c,
  • cpukit/libmisc/shell/main_mount.c

    r9e06eb1 r7baa484  
    2828#include <rtems/fsmount.h>
    2929#include "internal.h"
     30
     31static rtems_chain_control filesystems;
     32static bool                fs_init;
     33
     34static void rtems_shell_mount_fsys_init()
     35{
     36  if (!fs_init)
     37  {
     38    rtems_chain_initialize_empty (&filesystems);
     39    fs_init = true;
     40  }
     41}
     42
     43void rtems_shell_mount_add_fsys(rtems_shell_filesystems_t* fs)
     44{
     45  rtems_shell_mount_fsys_init();
     46  rtems_chain_append (&filesystems, &fs->link);
     47}
     48
     49void rtems_shell_mount_del_fsys(rtems_shell_filesystems_t* fs)
     50{
     51  if (fs_init)
     52    rtems_chain_extract (&fs->link);
     53}
    3054
    3155int rtems_shell_libc_mounter(
     
    6185  char*                      mount_point = NULL;
    6286  int                        arg;
     87
     88  rtems_shell_mount_fsys_init();
    6389 
    6490  for (arg = 1; arg < argc; arg++) {
     
    6692      if (argv[arg][1] == 't') {
    6793        rtems_shell_filesystems_t** a;
    68        
     94
    6995        arg++;
    7096        if (arg == argc) {
     
    81107            fs = *a;
    82108            break;
     109          }
     110        }
     111
     112        if (!fs && !rtems_chain_is_empty(&filesystems)) {
     113          rtems_chain_node* node = filesystems.first;
     114          while (!rtems_chain_is_tail (&filesystems, node)) {
     115            rtems_shell_filesystems_t* f = (rtems_shell_filesystems_t*)node;
     116            if (strcmp (argv[arg], f->name) == 0) {
     117              fs = f;
     118              break;
     119            }
     120            node = node->next;
    83121          }
    84122        }
  • cpukit/libmisc/shell/shell.h

    r9e06eb1 r7baa484  
    2525#include <rtems/fs.h>
    2626#include <rtems/libio.h>
     27#include <rtems/chain.h>
    2728
    2829#ifdef __cplusplus
     
    233234
    234235struct rtems_shell_filesystems_tt {
     236  rtems_chain_node                         link;
    235237  const char                              *name;
    236238  int                                      driver_needed;
     
    258260);
    259261
     262/**
     263 * Helper for the mount command.
     264 *
     265 * @param[in] driver The path to the driver.
     266 * @param[in] path The path to mount on.
     267 * @param[in] fs The file system definition.
     268 * @param[in] options Special file system options.
     269 */
     270int rtems_shell_libc_mounter(
     271  const char*                driver,
     272  const char*                path,
     273  rtems_shell_filesystems_t* fs,
     274  rtems_filesystem_options_t options
     275);
     276
     277/**
     278 * Add a new file system mount configuration to the mount command.
     279 *
     280 * @param[in] fs The file system mount data.
     281 */
     282void rtems_shell_mount_add_fsys(rtems_shell_filesystems_t* fs);
     283
     284/**
     285 * Delete file system mount configuration from the mount command.
     286 *
     287 * @param[in] fs The file system mount data to remove.
     288 */
     289void rtems_shell_mount_del_fsys(rtems_shell_filesystems_t* fs);
     290
    260291#ifdef __cplusplus
    261292}
  • cpukit/libnetworking/lib/ftpfs.c

    r9e06eb1 r7baa484  
    11841184static int rtems_ftpfs_eval_path(
    11851185  const char *pathname,
     1186  int pathnamelen,
    11861187  int flags,
    11871188  rtems_filesystem_location_info_t *pathloc
     
    11931194   * again.  The path is used in rtems_ftpfs_open() via iop->file_info.
    11941195   */
     1196  pathloc->node_access = malloc(pathnamelen + 1);
     1197  if (pathloc->node_access) {
     1198    memset(pathloc->node_access, 0, pathnamelen + 1);
     1199    memcpy(pathloc->node_access, pathname, pathnamelen);
     1200  }   
    11951201  pathloc->node_access = strdup( pathname);
    11961202
Note: See TracChangeset for help on using the changeset viewer.