[rtems commit] Filesystem: Export most generic path eval function

Sebastian Huber sebh at rtems.org
Tue Feb 2 07:03:39 UTC 2016


Module:    rtems
Branch:    4.11
Commit:    d85db176e7d5bcb832ce0764d7db8b94090c4256
Changeset: http://git.rtems.org/rtems/commit/?id=d85db176e7d5bcb832ce0764d7db8b94090c4256

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Feb  2 08:00:34 2016 +0100

Filesystem: Export most generic path eval function

Add path length parameter to
rtems_filesystem_eval_path_start_with_root_and_current() so that users
may pass paths without a '\0' termination.

Update #2558.

---

 cpukit/libcsupport/include/rtems/libio_.h |  1 +
 cpukit/libcsupport/src/chroot.c           |  1 +
 cpukit/libcsupport/src/sup_fs_eval_path.c | 26 ++++----------------------
 3 files changed, 6 insertions(+), 22 deletions(-)

diff --git a/cpukit/libcsupport/include/rtems/libio_.h b/cpukit/libcsupport/include/rtems/libio_.h
index c26782e..0c5e9ed 100644
--- a/cpukit/libcsupport/include/rtems/libio_.h
+++ b/cpukit/libcsupport/include/rtems/libio_.h
@@ -328,6 +328,7 @@ rtems_filesystem_location_info_t *
 rtems_filesystem_eval_path_start_with_root_and_current(
   rtems_filesystem_eval_path_context_t *ctx,
   const char *path,
+  size_t pathlen,
   int eval_flags,
   rtems_filesystem_global_location_t *const *global_root_ptr,
   rtems_filesystem_global_location_t *const *global_current_ptr
diff --git a/cpukit/libcsupport/src/chroot.c b/cpukit/libcsupport/src/chroot.c
index b7c2891..9ec4ad4 100644
--- a/cpukit/libcsupport/src/chroot.c
+++ b/cpukit/libcsupport/src/chroot.c
@@ -44,6 +44,7 @@ int chroot( const char *path )
   rtems_filesystem_eval_path_start_with_root_and_current(
     &ctx,
     path,
+    strlen( path ),
     eval_flags,
     &rtems_global_user_env.root_directory,
     &rtems_global_user_env.current_directory
diff --git a/cpukit/libcsupport/src/sup_fs_eval_path.c b/cpukit/libcsupport/src/sup_fs_eval_path.c
index e120517..459fa6b 100644
--- a/cpukit/libcsupport/src/sup_fs_eval_path.c
+++ b/cpukit/libcsupport/src/sup_fs_eval_path.c
@@ -136,8 +136,8 @@ void rtems_filesystem_eval_path_continue(
   }
 }
 
-static rtems_filesystem_location_info_t *
-eval_path_start(
+rtems_filesystem_location_info_t *
+rtems_filesystem_eval_path_start_with_root_and_current(
   rtems_filesystem_eval_path_context_t *ctx,
   const char *path,
   size_t pathlen,
@@ -167,25 +167,6 @@ eval_path_start(
 }
 
 rtems_filesystem_location_info_t *
-rtems_filesystem_eval_path_start_with_root_and_current(
-  rtems_filesystem_eval_path_context_t *ctx,
-  const char *path,
-  int eval_flags,
-  rtems_filesystem_global_location_t *const *global_root_ptr,
-  rtems_filesystem_global_location_t *const *global_current_ptr
-)
-{
-  return eval_path_start(
-    ctx,
-    path,
-    strlen(path),
-    eval_flags,
-    global_root_ptr,
-    global_current_ptr
-  );
-}
-
-rtems_filesystem_location_info_t *
 rtems_filesystem_eval_path_start(
   rtems_filesystem_eval_path_context_t *ctx,
   const char *path,
@@ -195,6 +176,7 @@ rtems_filesystem_eval_path_start(
   return rtems_filesystem_eval_path_start_with_root_and_current(
     ctx,
     path,
+    strlen(path),
     eval_flags,
     &rtems_filesystem_root,
     &rtems_filesystem_current
@@ -229,7 +211,7 @@ rtems_filesystem_eval_path_start_with_parent(
     }
   }
 
-  currentloc = eval_path_start(
+  currentloc = rtems_filesystem_eval_path_start_with_root_and_current(
     ctx,
     parentpath,
     parentpathlen,



More information about the vc mailing list