[rtems commit] Filesystem: Rename defines

Joel Sherrill joel at rtems.org
Thu Mar 29 14:14:29 UTC 2012


Module:    rtems
Branch:    master
Commit:    7df31a9a9082af3570516f8613f16c8dc94b7b41
Changeset: http://git.rtems.org/rtems/commit/?id=7df31a9a9082af3570516f8613f16c8dc94b7b41

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Mar 13 09:22:11 2012 +0100

Filesystem: Rename defines

 o Removed RTEMS_LIBIO_PERMS_SEARCH.
 o Renamed RTEMS_LIBIO_PERMS_READ in RTEMS_FS_PERMS_READ.
 o Renamed RTEMS_LIBIO_PERMS_WRITE in RTEMS_FS_PERMS_WRITE.
 o Renamed RTEMS_LIBIO_PERMS_EXEC in RTEMS_FS_PERMS_EXEC.
 o Renamed RTEMS_LIBIO_FOLLOW_HARD_LINK in RTEMS_FS_FOLLOW_HARD_LINK.
 o Renamed RTEMS_LIBIO_FOLLOW_SYM_LINK in RTEMS_FS_FOLLOW_SYM_LINK.
 o Renamed RTEMS_LIBIO_MAKE in RTEMS_FS_MAKE.
 o Renamed RTEMS_LIBIO_EXCLUSIVE in RTEMS_FS_EXCLUSIVE.
 o Renamed RTEMS_LIBIO_ACCEPT_RESIDUAL_DELIMITERS in
   RTEMS_FS_ACCEPT_RESIDUAL_DELIMITERS.
 o Renamed RTEMS_LIBIO_REJECT_TERMINAL_DOT in
 RTEMS_FS_REJECT_TERMINAL_DOT.

---

 c/src/lib/libbsp/shared/umon/tfsDriver.c          |    4 +-
 cpukit/libcsupport/include/rtems/libio.h          |   48 +++++++++----------
 cpukit/libcsupport/src/_rename_r.c                |   10 ++--
 cpukit/libcsupport/src/chdir.c                    |    4 +-
 cpukit/libcsupport/src/chmod.c                    |    2 +-
 cpukit/libcsupport/src/chown.c                    |    2 +-
 cpukit/libcsupport/src/chroot.c                   |    4 +-
 cpukit/libcsupport/src/fchdir.c                   |    2 +-
 cpukit/libcsupport/src/lchown.c                   |    2 +-
 cpukit/libcsupport/src/link.c                     |    8 ++--
 cpukit/libcsupport/src/lstat.c                    |    2 +-
 cpukit/libcsupport/src/mknod.c                    |    8 ++--
 cpukit/libcsupport/src/mount.c                    |    4 +-
 cpukit/libcsupport/src/open.c                     |   10 ++--
 cpukit/libcsupport/src/readlink.c                 |    2 +-
 cpukit/libcsupport/src/rmdir.c                    |    8 ++--
 cpukit/libcsupport/src/stat.c                     |    2 +-
 cpukit/libcsupport/src/statvfs.c                  |    2 +-
 cpukit/libcsupport/src/sup_fs_check_permissions.c |   53 +++++++++++++++++++--
 cpukit/libcsupport/src/sup_fs_eval_path.c         |    8 ++--
 cpukit/libcsupport/src/sup_fs_eval_path_generic.c |    4 +-
 cpukit/libcsupport/src/symlink.c                  |    6 +-
 cpukit/libcsupport/src/unlink.c                   |    8 ++--
 cpukit/libcsupport/src/unmount.c                  |    2 +-
 cpukit/libcsupport/src/utime.c                    |    2 +-
 cpukit/libfs/src/devfs/devfs_eval.c               |    4 +-
 cpukit/libfs/src/imfs/imfs_eval.c                 |    8 ++--
 cpukit/libfs/src/imfs/imfs_load_tar.c             |    4 +-
 cpukit/libfs/src/nfsclient/src/nfs.c              |    2 +-
 cpukit/libfs/src/rfs/rtems-rfs-rtems.c            |    4 +-
 cpukit/libfs/src/rfs/rtems-rfs-shell.c            |    2 +-
 cpukit/libnetworking/lib/tftpDriver.c             |    4 +-
 32 files changed, 138 insertions(+), 97 deletions(-)

diff --git a/c/src/lib/libbsp/shared/umon/tfsDriver.c b/c/src/lib/libbsp/shared/umon/tfsDriver.c
index fe3ffbc..df29e25 100644
--- a/c/src/lib/libbsp/shared/umon/tfsDriver.c
+++ b/c/src/lib/libbsp/shared/umon/tfsDriver.c
@@ -191,8 +191,8 @@ static void rtems_tfs_eval_path(rtems_filesystem_eval_path_context_t *self)
 {
   int eval_flags = rtems_filesystem_eval_path_get_flags(self);
 
-  if ((eval_flags & RTEMS_LIBIO_MAKE) == 0) {
-    int rw = RTEMS_LIBIO_PERMS_READ | RTEMS_LIBIO_PERMS_WRITE;
+  if ((eval_flags & RTEMS_FS_MAKE) == 0) {
+    int rw = RTEMS_FS_PERMS_READ | RTEMS_FS_PERMS_WRITE;
 
     if ((eval_flags & rw) != rw) {
       rtems_filesystem_location_info_t *currentloc =
diff --git a/cpukit/libcsupport/include/rtems/libio.h b/cpukit/libcsupport/include/rtems/libio.h
index 5789909..968681b 100644
--- a/cpukit/libcsupport/include/rtems/libio.h
+++ b/cpukit/libcsupport/include/rtems/libio.h
@@ -113,16 +113,15 @@ typedef struct {
 
   /**
    * The path evaluation is controlled by the following flags
-   *  - RTEMS_LIBIO_PERMS_READ,
-   *  - RTEMS_LIBIO_PERMS_WRITE,
-   *  - RTEMS_LIBIO_PERMS_EXEC,
-   *  - RTEMS_LIBIO_PERMS_SEARCH,
-   *  - RTEMS_LIBIO_FOLLOW_HARD_LINK,
-   *  - RTEMS_LIBIO_FOLLOW_SYM_LINK,
-   *  - RTEMS_LIBIO_MAKE,
-   *  - RTEMS_LIBIO_EXCLUSIVE,
-   *  - RTEMS_LIBIO_ACCEPT_RESIDUAL_DELIMITERS, and
-   *  - RTEMS_LIBIO_REJECT_TERMINAL_DOT.
+   *  - RTEMS_FS_PERMS_READ,
+   *  - RTEMS_FS_PERMS_WRITE,
+   *  - RTEMS_FS_PERMS_EXEC,
+   *  - RTEMS_FS_FOLLOW_HARD_LINK,
+   *  - RTEMS_FS_FOLLOW_SYM_LINK,
+   *  - RTEMS_FS_MAKE,
+   *  - RTEMS_FS_EXCLUSIVE,
+   *  - RTEMS_FS_ACCEPT_RESIDUAL_DELIMITERS, and
+   *  - RTEMS_FS_REJECT_TERMINAL_DOT.
    */
   int flags;
 
@@ -1277,22 +1276,19 @@ typedef off_t (*rtems_libio_lseek_t)(
  *  used to check permissions.  These are similar in style to the
  *  mode_t bits and should stay compatible with them.
  */
-#define RTEMS_LIBIO_PERMS_READ 0x4
-#define RTEMS_LIBIO_PERMS_WRITE 0x2
-#define RTEMS_LIBIO_PERMS_EXEC 0x1
-#define RTEMS_LIBIO_PERMS_SEARCH RTEMS_LIBIO_PERMS_EXEC
-#define RTEMS_LIBIO_PERMS_RDWR \
-  (RTEMS_LIBIO_PERMS_READ | RTEMS_LIBIO_PERMS_WRITE)
-#define RTEMS_LIBIO_PERMS_RWX \
-  (RTEMS_LIBIO_PERMS_RDWR | RTEMS_LIBIO_PERMS_EXEC)
-#define RTEMS_LIBIO_FOLLOW_HARD_LINK 0x8
-#define RTEMS_LIBIO_FOLLOW_SYM_LINK 0x10
-#define RTEMS_LIBIO_FOLLOW_LINK \
-  (RTEMS_LIBIO_FOLLOW_HARD_LINK | RTEMS_LIBIO_FOLLOW_SYM_LINK)
-#define RTEMS_LIBIO_MAKE 0x20
-#define RTEMS_LIBIO_EXCLUSIVE 0x40
-#define RTEMS_LIBIO_ACCEPT_RESIDUAL_DELIMITERS 0x80
-#define RTEMS_LIBIO_REJECT_TERMINAL_DOT 0x100
+#define RTEMS_FS_PERMS_READ 0x4
+#define RTEMS_FS_PERMS_WRITE 0x2
+#define RTEMS_FS_PERMS_EXEC 0x1
+#define RTEMS_FS_PERMS_RWX \
+  (RTEMS_FS_PERMS_READ | RTEMS_FS_PERMS_WRITE | RTEMS_FS_PERMS_EXEC)
+#define RTEMS_FS_FOLLOW_HARD_LINK 0x8
+#define RTEMS_FS_FOLLOW_SYM_LINK 0x10
+#define RTEMS_FS_FOLLOW_LINK \
+  (RTEMS_FS_FOLLOW_HARD_LINK | RTEMS_FS_FOLLOW_SYM_LINK)
+#define RTEMS_FS_MAKE 0x20
+#define RTEMS_FS_EXCLUSIVE 0x40
+#define RTEMS_FS_ACCEPT_RESIDUAL_DELIMITERS 0x80
+#define RTEMS_FS_REJECT_TERMINAL_DOT 0x100
 
 /** @} */
 
diff --git a/cpukit/libcsupport/src/_rename_r.c b/cpukit/libcsupport/src/_rename_r.c
index 7a2637a..56cd50c 100644
--- a/cpukit/libcsupport/src/_rename_r.c
+++ b/cpukit/libcsupport/src/_rename_r.c
@@ -34,8 +34,8 @@ int _rename_r(
   rtems_filesystem_eval_path_context_t old_ctx;
   int old_eval_flags = 0;
   rtems_filesystem_location_info_t old_parentloc;
-  int old_parent_eval_flags = RTEMS_LIBIO_PERMS_WRITE
-    | RTEMS_LIBIO_FOLLOW_HARD_LINK;
+  int old_parent_eval_flags = RTEMS_FS_PERMS_WRITE
+    | RTEMS_FS_FOLLOW_HARD_LINK;
   const rtems_filesystem_location_info_t *old_currentloc =
     rtems_filesystem_eval_path_start_with_parent(
       &old_ctx,
@@ -47,9 +47,9 @@ int _rename_r(
   rtems_filesystem_eval_path_context_t new_ctx;
 
   /* FIXME: This is not POSIX conform */
-  int new_eval_flags = RTEMS_LIBIO_FOLLOW_HARD_LINK
-    | RTEMS_LIBIO_MAKE
-    | RTEMS_LIBIO_EXCLUSIVE;
+  int new_eval_flags = RTEMS_FS_FOLLOW_HARD_LINK
+    | RTEMS_FS_MAKE
+    | RTEMS_FS_EXCLUSIVE;
 
   const rtems_filesystem_location_info_t *new_currentloc =
     rtems_filesystem_eval_path_start( &new_ctx, new, new_eval_flags );
diff --git a/cpukit/libcsupport/src/chdir.c b/cpukit/libcsupport/src/chdir.c
index df65170..5ef6fd9 100644
--- a/cpukit/libcsupport/src/chdir.c
+++ b/cpukit/libcsupport/src/chdir.c
@@ -48,8 +48,8 @@ int chdir( const char *path )
 {
   int rv = 0;
   rtems_filesystem_eval_path_context_t ctx;
-  int eval_flags = RTEMS_LIBIO_PERMS_EXEC
-    | RTEMS_LIBIO_FOLLOW_LINK;
+  int eval_flags = RTEMS_FS_PERMS_EXEC
+    | RTEMS_FS_FOLLOW_LINK;
   rtems_filesystem_location_info_t pathloc;
 
   rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
diff --git a/cpukit/libcsupport/src/chmod.c b/cpukit/libcsupport/src/chmod.c
index ff3039a..2e1376b 100644
--- a/cpukit/libcsupport/src/chmod.c
+++ b/cpukit/libcsupport/src/chmod.c
@@ -23,7 +23,7 @@ int chmod( const char *path, mode_t mode )
 {
   int rv = 0;
   rtems_filesystem_eval_path_context_t ctx;
-  int eval_flags = RTEMS_LIBIO_FOLLOW_LINK;
+  int eval_flags = RTEMS_FS_FOLLOW_LINK;
   const rtems_filesystem_location_info_t *currentloc =
     rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
 
diff --git a/cpukit/libcsupport/src/chown.c b/cpukit/libcsupport/src/chown.c
index 1d07384..598fbc1 100644
--- a/cpukit/libcsupport/src/chown.c
+++ b/cpukit/libcsupport/src/chown.c
@@ -48,5 +48,5 @@ int rtems_filesystem_chown(
 
 int chown( const char *path, uid_t owner, gid_t group )
 {
-  return rtems_filesystem_chown( path, owner, group, RTEMS_LIBIO_FOLLOW_LINK );
+  return rtems_filesystem_chown( path, owner, group, RTEMS_FS_FOLLOW_LINK );
 }
diff --git a/cpukit/libcsupport/src/chroot.c b/cpukit/libcsupport/src/chroot.c
index fd802ff..777cc90 100644
--- a/cpukit/libcsupport/src/chroot.c
+++ b/cpukit/libcsupport/src/chroot.c
@@ -28,8 +28,8 @@ int chroot( const char *path )
   int rv = 0;
   rtems_status_code sc = RTEMS_SUCCESSFUL;
   rtems_filesystem_eval_path_context_t ctx;
-  int eval_flags = RTEMS_LIBIO_PERMS_SEARCH
-    | RTEMS_LIBIO_FOLLOW_LINK;
+  int eval_flags = RTEMS_FS_PERMS_EXEC
+    | RTEMS_FS_FOLLOW_LINK;
   rtems_filesystem_location_info_t loc;
   rtems_filesystem_global_location_t *new_current_loc;
 
diff --git a/cpukit/libcsupport/src/fchdir.c b/cpukit/libcsupport/src/fchdir.c
index 7b64ea8..5f48d1e 100644
--- a/cpukit/libcsupport/src/fchdir.c
+++ b/cpukit/libcsupport/src/fchdir.c
@@ -41,7 +41,7 @@ int fchdir( int fd )
   rv = (*iop->pathinfo.handlers->fstat_h)( &iop->pathinfo, &st );
   if ( rv == 0 ) {
     bool access_ok = rtems_filesystem_check_access(
-      RTEMS_LIBIO_PERMS_EXEC,
+      RTEMS_FS_PERMS_EXEC,
       st.st_mode,
       st.st_uid,
       st.st_gid
diff --git a/cpukit/libcsupport/src/lchown.c b/cpukit/libcsupport/src/lchown.c
index 83bdf6f..a39e824 100644
--- a/cpukit/libcsupport/src/lchown.c
+++ b/cpukit/libcsupport/src/lchown.c
@@ -25,6 +25,6 @@ int lchown( const char *path, uid_t owner, gid_t group )
     path,
     owner,
     group,
-    RTEMS_LIBIO_FOLLOW_HARD_LINK
+    RTEMS_FS_FOLLOW_HARD_LINK
   );
 }
diff --git a/cpukit/libcsupport/src/link.c b/cpukit/libcsupport/src/link.c
index cf370fb..32966ce 100644
--- a/cpukit/libcsupport/src/link.c
+++ b/cpukit/libcsupport/src/link.c
@@ -24,10 +24,10 @@ int link( const char *path1, const char *path2 )
   int rv = 0;
   rtems_filesystem_eval_path_context_t ctx_1;
   rtems_filesystem_eval_path_context_t ctx_2;
-  int eval_flags_1 = RTEMS_LIBIO_FOLLOW_LINK;
-  int eval_flags_2 = RTEMS_LIBIO_FOLLOW_LINK
-    | RTEMS_LIBIO_MAKE
-    | RTEMS_LIBIO_EXCLUSIVE;
+  int eval_flags_1 = RTEMS_FS_FOLLOW_LINK;
+  int eval_flags_2 = RTEMS_FS_FOLLOW_LINK
+    | RTEMS_FS_MAKE
+    | RTEMS_FS_EXCLUSIVE;
   const rtems_filesystem_location_info_t *currentloc_1 =
     rtems_filesystem_eval_path_start( &ctx_1, path1, eval_flags_1 );
   const rtems_filesystem_location_info_t *currentloc_2 =
diff --git a/cpukit/libcsupport/src/lstat.c b/cpukit/libcsupport/src/lstat.c
index d35713e..d6be01f 100644
--- a/cpukit/libcsupport/src/lstat.c
+++ b/cpukit/libcsupport/src/lstat.c
@@ -17,6 +17,6 @@
 
 #define _STAT_NAME         lstat
 #define _STAT_R_NAME       _lstat_r
-#define _STAT_FOLLOW_LINKS RTEMS_LIBIO_FOLLOW_HARD_LINK
+#define _STAT_FOLLOW_LINKS RTEMS_FS_FOLLOW_HARD_LINK
 
 #include "stat.c"
diff --git a/cpukit/libcsupport/src/mknod.c b/cpukit/libcsupport/src/mknod.c
index dae2b3b..a0e7523 100644
--- a/cpukit/libcsupport/src/mknod.c
+++ b/cpukit/libcsupport/src/mknod.c
@@ -59,10 +59,10 @@ int mknod( const char *path, mode_t mode, dev_t dev )
 {
   int rv = 0;
   rtems_filesystem_eval_path_context_t ctx;
-  int eval_flags = RTEMS_LIBIO_FOLLOW_LINK
-    | RTEMS_LIBIO_MAKE
-    | RTEMS_LIBIO_EXCLUSIVE
-    | (S_ISDIR(mode) ? RTEMS_LIBIO_ACCEPT_RESIDUAL_DELIMITERS : 0);
+  int eval_flags = RTEMS_FS_FOLLOW_LINK
+    | RTEMS_FS_MAKE
+    | RTEMS_FS_EXCLUSIVE
+    | (S_ISDIR(mode) ? RTEMS_FS_ACCEPT_RESIDUAL_DELIMITERS : 0);
   const rtems_filesystem_location_info_t *currentloc =
     rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
 
diff --git a/cpukit/libcsupport/src/mount.c b/cpukit/libcsupport/src/mount.c
index 47c08f7..ed5a2a5 100644
--- a/cpukit/libcsupport/src/mount.c
+++ b/cpukit/libcsupport/src/mount.c
@@ -112,8 +112,8 @@ static int register_subordinate_file_system(
 {
   int rv = 0;
   rtems_filesystem_eval_path_context_t ctx;
-  int eval_flags = RTEMS_LIBIO_PERMS_RWX
-    | RTEMS_LIBIO_FOLLOW_LINK;
+  int eval_flags = RTEMS_FS_PERMS_RWX
+    | RTEMS_FS_FOLLOW_LINK;
   rtems_filesystem_location_info_t *currentloc =
     rtems_filesystem_eval_path_start( &ctx, target, eval_flags );
 
diff --git a/cpukit/libcsupport/src/open.c b/cpukit/libcsupport/src/open.c
index 6fa7783..0b6be69 100644
--- a/cpukit/libcsupport/src/open.c
+++ b/cpukit/libcsupport/src/open.c
@@ -70,11 +70,11 @@ static int do_open(
   bool make = (oflag & O_CREAT) == O_CREAT;
   bool exclusive = (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL);
   bool truncate = (oflag & O_TRUNC) == O_TRUNC;
-  int eval_flags = RTEMS_LIBIO_FOLLOW_LINK
-    | (read_access ? RTEMS_LIBIO_PERMS_READ : 0)
-    | (write_access ? RTEMS_LIBIO_PERMS_WRITE : 0)
-    | (make ? RTEMS_LIBIO_MAKE : 0)
-    | (exclusive ?  RTEMS_LIBIO_EXCLUSIVE : 0);
+  int eval_flags = RTEMS_FS_FOLLOW_LINK
+    | (read_access ? RTEMS_FS_PERMS_READ : 0)
+    | (write_access ? RTEMS_FS_PERMS_WRITE : 0)
+    | (make ? RTEMS_FS_MAKE : 0)
+    | (exclusive ?  RTEMS_FS_EXCLUSIVE : 0);
   rtems_filesystem_eval_path_context_t ctx;
 
   rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
diff --git a/cpukit/libcsupport/src/readlink.c b/cpukit/libcsupport/src/readlink.c
index e2c88e8..30163e5 100644
--- a/cpukit/libcsupport/src/readlink.c
+++ b/cpukit/libcsupport/src/readlink.c
@@ -23,7 +23,7 @@ ssize_t readlink( const char *path, char *buf, size_t bufsize )
 {
   ssize_t rv = 0;
   rtems_filesystem_eval_path_context_t ctx;
-  int eval_flags = RTEMS_LIBIO_FOLLOW_HARD_LINK;
+  int eval_flags = RTEMS_FS_FOLLOW_HARD_LINK;
   const rtems_filesystem_location_info_t *currentloc =
     rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
   rtems_filesystem_node_types_t type =
diff --git a/cpukit/libcsupport/src/rmdir.c b/cpukit/libcsupport/src/rmdir.c
index 07ecbb3..acec704 100644
--- a/cpukit/libcsupport/src/rmdir.c
+++ b/cpukit/libcsupport/src/rmdir.c
@@ -23,11 +23,11 @@ int rmdir( const char *path )
 {
   int rv = 0;
   rtems_filesystem_eval_path_context_t ctx;
-  int eval_flags = RTEMS_LIBIO_REJECT_TERMINAL_DOT;
+  int eval_flags = RTEMS_FS_REJECT_TERMINAL_DOT;
   rtems_filesystem_location_info_t parentloc;
-  int parent_eval_flags = RTEMS_LIBIO_PERMS_WRITE
-    | RTEMS_LIBIO_PERMS_SEARCH
-    | RTEMS_LIBIO_FOLLOW_LINK;
+  int parent_eval_flags = RTEMS_FS_PERMS_WRITE
+    | RTEMS_FS_PERMS_EXEC
+    | RTEMS_FS_FOLLOW_LINK;
   const rtems_filesystem_location_info_t *currentloc =
     rtems_filesystem_eval_path_start_with_parent(
       &ctx,
diff --git a/cpukit/libcsupport/src/stat.c b/cpukit/libcsupport/src/stat.c
index af56fd8..6d77fea 100644
--- a/cpukit/libcsupport/src/stat.c
+++ b/cpukit/libcsupport/src/stat.c
@@ -25,7 +25,7 @@
 #ifndef _STAT_NAME
 #define _STAT_NAME         stat
 #define _STAT_R_NAME       _stat_r
-#define _STAT_FOLLOW_LINKS RTEMS_LIBIO_FOLLOW_LINK
+#define _STAT_FOLLOW_LINKS RTEMS_FS_FOLLOW_LINK
 #endif
 
 #include <sys/stat.h>
diff --git a/cpukit/libcsupport/src/statvfs.c b/cpukit/libcsupport/src/statvfs.c
index 61d6d8e..84f8de3 100644
--- a/cpukit/libcsupport/src/statvfs.c
+++ b/cpukit/libcsupport/src/statvfs.c
@@ -25,7 +25,7 @@ int statvfs( const char *path, struct statvfs *buf )
 {
   int rv = 0;
   rtems_filesystem_eval_path_context_t ctx;
-  int eval_flags = RTEMS_LIBIO_FOLLOW_LINK;
+  int eval_flags = RTEMS_FS_FOLLOW_LINK;
   const rtems_filesystem_location_info_t *currentloc =
     rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
 
diff --git a/cpukit/libcsupport/src/sup_fs_check_permissions.c b/cpukit/libcsupport/src/sup_fs_check_permissions.c
index 8dcecb6..85d237c 100644
--- a/cpukit/libcsupport/src/sup_fs_check_permissions.c
+++ b/cpukit/libcsupport/src/sup_fs_check_permissions.c
@@ -16,8 +16,53 @@
   #include "config.h"
 #endif
 
+#include <sys/stat.h>
+
 #include <rtems/libio_.h>
 
+#define RTEMS_FS_USR_SHIFT 6
+#define RTEMS_FS_GRP_SHIFT 3
+#define RTEMS_FS_OTH_SHIFT 0
+
+RTEMS_STATIC_ASSERT(
+  (RTEMS_FS_PERMS_READ << RTEMS_FS_USR_SHIFT) == S_IRUSR,
+  S_IRUSR
+);
+RTEMS_STATIC_ASSERT(
+  (RTEMS_FS_PERMS_READ << RTEMS_FS_GRP_SHIFT) == S_IRGRP,
+  S_IRGRP
+);
+RTEMS_STATIC_ASSERT(
+  (RTEMS_FS_PERMS_READ << RTEMS_FS_OTH_SHIFT) == S_IROTH,
+  S_IROTH
+);
+
+RTEMS_STATIC_ASSERT(
+  (RTEMS_FS_PERMS_WRITE << RTEMS_FS_USR_SHIFT) == S_IWUSR,
+  S_IWUSR
+);
+RTEMS_STATIC_ASSERT(
+  (RTEMS_FS_PERMS_WRITE << RTEMS_FS_GRP_SHIFT) == S_IWGRP,
+  S_IWGRP
+);
+RTEMS_STATIC_ASSERT(
+  (RTEMS_FS_PERMS_WRITE << RTEMS_FS_OTH_SHIFT) == S_IWOTH,
+  S_IWOTH
+);
+
+RTEMS_STATIC_ASSERT(
+  (RTEMS_FS_PERMS_EXEC << RTEMS_FS_USR_SHIFT) == S_IXUSR,
+  S_IXUSR
+);
+RTEMS_STATIC_ASSERT(
+  (RTEMS_FS_PERMS_EXEC << RTEMS_FS_GRP_SHIFT) == S_IXGRP,
+  S_IXGRP
+);
+RTEMS_STATIC_ASSERT(
+  (RTEMS_FS_PERMS_EXEC << RTEMS_FS_OTH_SHIFT) == S_IXOTH,
+  S_IXOTH
+);
+
 bool rtems_filesystem_check_access(
   int eval_flags,
   mode_t node_mode,
@@ -25,18 +70,18 @@ bool rtems_filesystem_check_access(
   gid_t node_gid
 )
 {
-  mode_t perm_flags = eval_flags & RTEMS_LIBIO_PERMS_RWX;
+  mode_t perm_flags = eval_flags & RTEMS_FS_PERMS_RWX;
   uid_t task_uid = geteuid();
 
   if (task_uid == 0 || task_uid == node_uid) {
-    perm_flags <<= 6;
+    perm_flags <<= RTEMS_FS_USR_SHIFT;
   } else {
     gid_t task_gid = getegid();
 
     if (task_gid == 0 || task_gid == node_gid) {
-      perm_flags <<= 3;
+      perm_flags <<= RTEMS_FS_GRP_SHIFT;
     } else {
-      perm_flags <<= 0;
+      perm_flags <<= RTEMS_FS_OTH_SHIFT;
     }
   }
 
diff --git a/cpukit/libcsupport/src/sup_fs_eval_path.c b/cpukit/libcsupport/src/sup_fs_eval_path.c
index c827ba7..5f7b606 100644
--- a/cpukit/libcsupport/src/sup_fs_eval_path.c
+++ b/cpukit/libcsupport/src/sup_fs_eval_path.c
@@ -70,7 +70,7 @@ static void check_access(
   const rtems_filesystem_location_info_t *currentloc = &ctx->currentloc;
   const rtems_filesystem_mount_table_entry_t *mt_entry = currentloc->mt_entry;
 
-  if ((eval_flags & RTEMS_LIBIO_PERMS_WRITE) == 0 || mt_entry->writeable) {
+  if ((eval_flags & RTEMS_FS_PERMS_WRITE) == 0 || mt_entry->writeable) {
     struct stat st;
     int rv;
 
@@ -109,15 +109,15 @@ void rtems_filesystem_eval_path_continue(
 
   eval_flags = rtems_filesystem_eval_path_get_flags(ctx);
   if (rtems_filesystem_eval_path_has_token(ctx)) {
-    bool make = (eval_flags & RTEMS_LIBIO_MAKE) != 0;
+    bool make = (eval_flags & RTEMS_FS_MAKE) != 0;
 
     if (make) {
-      check_access(ctx, RTEMS_LIBIO_PERMS_WRITE);
+      check_access(ctx, RTEMS_FS_PERMS_WRITE);
     } else {
       rtems_filesystem_eval_path_error(ctx, ENOENT);
     }
   } else {
-    bool exclusive = (eval_flags & RTEMS_LIBIO_EXCLUSIVE) != 0;
+    bool exclusive = (eval_flags & RTEMS_FS_EXCLUSIVE) != 0;
 
     if (!exclusive) {
       check_access(ctx, ctx->flags);
diff --git a/cpukit/libcsupport/src/sup_fs_eval_path_generic.c b/cpukit/libcsupport/src/sup_fs_eval_path_generic.c
index c789ee4..d8629c6 100644
--- a/cpukit/libcsupport/src/sup_fs_eval_path_generic.c
+++ b/cpukit/libcsupport/src/sup_fs_eval_path_generic.c
@@ -60,7 +60,7 @@ void rtems_filesystem_eval_path_generic(
           } else {
             int eval_flags = rtems_filesystem_eval_path_get_flags(ctx);
 
-            if ((eval_flags & RTEMS_LIBIO_REJECT_TERMINAL_DOT) == 0) {
+            if ((eval_flags & RTEMS_FS_REJECT_TERMINAL_DOT) == 0) {
               status = (*config->eval_token)(ctx, arg, ".", 1);
             } else {
               rtems_filesystem_eval_path_error(ctx, EINVAL);
@@ -100,7 +100,7 @@ void rtems_filesystem_eval_path_generic(
             rtems_filesystem_eval_path_eat_delimiter(ctx);
             eval_flags = rtems_filesystem_eval_path_get_flags(ctx);
             if (
-              (eval_flags & RTEMS_LIBIO_ACCEPT_RESIDUAL_DELIMITERS) == 0
+              (eval_flags & RTEMS_FS_ACCEPT_RESIDUAL_DELIMITERS) == 0
                 || rtems_filesystem_eval_path_has_path(ctx)
             ) {
               rtems_filesystem_eval_path_error(ctx, ENOENT);
diff --git a/cpukit/libcsupport/src/symlink.c b/cpukit/libcsupport/src/symlink.c
index 3a3eabc..7c6271e 100644
--- a/cpukit/libcsupport/src/symlink.c
+++ b/cpukit/libcsupport/src/symlink.c
@@ -23,9 +23,9 @@ int symlink( const char *path1, const char *path2 )
 {
   int rv = 0;
   rtems_filesystem_eval_path_context_t ctx;
-  int eval_flags = RTEMS_LIBIO_FOLLOW_HARD_LINK
-    | RTEMS_LIBIO_MAKE
-    | RTEMS_LIBIO_EXCLUSIVE;
+  int eval_flags = RTEMS_FS_FOLLOW_HARD_LINK
+    | RTEMS_FS_MAKE
+    | RTEMS_FS_EXCLUSIVE;
   const rtems_filesystem_location_info_t *currentloc =
     rtems_filesystem_eval_path_start( &ctx, path2, eval_flags );
 
diff --git a/cpukit/libcsupport/src/unlink.c b/cpukit/libcsupport/src/unlink.c
index f8f9170..9872dd0 100644
--- a/cpukit/libcsupport/src/unlink.c
+++ b/cpukit/libcsupport/src/unlink.c
@@ -23,11 +23,11 @@ int unlink( const char *path )
 {
   int rv = 0;
   rtems_filesystem_eval_path_context_t ctx;
-  int eval_flags = RTEMS_LIBIO_REJECT_TERMINAL_DOT;
+  int eval_flags = RTEMS_FS_REJECT_TERMINAL_DOT;
   rtems_filesystem_location_info_t parentloc;
-  int parent_eval_flags = RTEMS_LIBIO_PERMS_WRITE
-    | RTEMS_LIBIO_PERMS_SEARCH
-    | RTEMS_LIBIO_FOLLOW_LINK;
+  int parent_eval_flags = RTEMS_FS_PERMS_WRITE
+    | RTEMS_FS_PERMS_EXEC
+    | RTEMS_FS_FOLLOW_LINK;
   const rtems_filesystem_location_info_t *currentloc =
     rtems_filesystem_eval_path_start_with_parent(
       &ctx,
diff --git a/cpukit/libcsupport/src/unmount.c b/cpukit/libcsupport/src/unmount.c
index 5f65e58..849816f 100644
--- a/cpukit/libcsupport/src/unmount.c
+++ b/cpukit/libcsupport/src/unmount.c
@@ -28,7 +28,7 @@ int unmount( const char *path )
 {
   int rv = 0;
   rtems_filesystem_eval_path_context_t ctx;
-  int eval_flags = RTEMS_LIBIO_FOLLOW_LINK;
+  int eval_flags = RTEMS_FS_FOLLOW_LINK;
   const rtems_filesystem_location_info_t *currentloc =
     rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
   rtems_filesystem_mount_table_entry_t *mt_entry = currentloc->mt_entry;
diff --git a/cpukit/libcsupport/src/utime.c b/cpukit/libcsupport/src/utime.c
index 4915870..aa2f19f 100644
--- a/cpukit/libcsupport/src/utime.c
+++ b/cpukit/libcsupport/src/utime.c
@@ -26,7 +26,7 @@ int utime( const char *path, const struct utimbuf *times )
 {
   int rv = 0;
   rtems_filesystem_eval_path_context_t ctx;
-  int eval_flags = RTEMS_LIBIO_FOLLOW_LINK;
+  int eval_flags = RTEMS_FS_FOLLOW_LINK;
   const rtems_filesystem_location_info_t *currentloc =
     rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
   struct utimbuf now_times;
diff --git a/cpukit/libfs/src/devfs/devfs_eval.c b/cpukit/libfs/src/devfs/devfs_eval.c
index b7a31ee..a0cfbbb 100644
--- a/cpukit/libfs/src/devfs/devfs_eval.c
+++ b/cpukit/libfs/src/devfs/devfs_eval.c
@@ -63,14 +63,14 @@ void devFS_eval_path(
   int eval_flags = rtems_filesystem_eval_path_get_flags(ctx);
 
   if (node != NULL) {
-    if ((eval_flags & RTEMS_LIBIO_EXCLUSIVE) == 0) {
+    if ((eval_flags & RTEMS_FS_EXCLUSIVE) == 0) {
       currentloc->node_access = node;
       rtems_filesystem_eval_path_clear_path(ctx);
     } else {
       rtems_filesystem_eval_path_error(ctx, EEXIST);
     }
   } else {
-    if ((eval_flags & RTEMS_LIBIO_MAKE) != 0) {
+    if ((eval_flags & RTEMS_FS_MAKE) != 0) {
       if (free_node != NULL) {
         free_node->mode = S_IRWXU | S_IRWXG | S_IRWXO;
         currentloc->node_access = free_node;
diff --git a/cpukit/libfs/src/imfs/imfs_eval.c b/cpukit/libfs/src/imfs/imfs_eval.c
index 43f2ee4..33e7e36 100644
--- a/cpukit/libfs/src/imfs/imfs_eval.c
+++ b/cpukit/libfs/src/imfs/imfs_eval.c
@@ -124,7 +124,7 @@ static rtems_filesystem_eval_path_generic_status IMFS_eval_token(
   IMFS_jnode_t *dir = currentloc->node_access;
   bool access_ok = rtems_filesystem_eval_path_check_access(
     ctx,
-    RTEMS_LIBIO_PERMS_SEARCH,
+    RTEMS_FS_PERMS_EXEC,
     dir->st_mode,
     dir->st_uid,
     dir->st_gid
@@ -136,8 +136,8 @@ static rtems_filesystem_eval_path_generic_status IMFS_eval_token(
     if ( entry != NULL ) {
       bool terminal = !rtems_filesystem_eval_path_has_path( ctx );
       int eval_flags = rtems_filesystem_eval_path_get_flags( ctx );
-      bool follow_hard_link = (eval_flags & RTEMS_LIBIO_FOLLOW_HARD_LINK) != 0;
-      bool follow_sym_link = (eval_flags & RTEMS_LIBIO_FOLLOW_SYM_LINK) != 0;
+      bool follow_hard_link = (eval_flags & RTEMS_FS_FOLLOW_HARD_LINK) != 0;
+      bool follow_sym_link = (eval_flags & RTEMS_FS_FOLLOW_SYM_LINK) != 0;
 
       rtems_filesystem_eval_path_clear_token( ctx );
 
@@ -163,7 +163,7 @@ static rtems_filesystem_eval_path_generic_status IMFS_eval_token(
         } else {
           access_ok = rtems_filesystem_eval_path_check_access(
             ctx,
-            RTEMS_LIBIO_PERMS_EXEC,
+            RTEMS_FS_PERMS_EXEC,
             entry->st_mode,
             entry->st_uid,
             entry->st_gid
diff --git a/cpukit/libfs/src/imfs/imfs_load_tar.c b/cpukit/libfs/src/imfs/imfs_load_tar.c
index 0ae0f7c..fd038b0 100644
--- a/cpukit/libfs/src/imfs/imfs_load_tar.c
+++ b/cpukit/libfs/src/imfs/imfs_load_tar.c
@@ -92,7 +92,7 @@ int rtems_tarfs_load(
    unsigned long                    nblocks;
    IMFS_jnode_t                    *node;
    int rv = 0;
-   int eval_flags = RTEMS_LIBIO_FOLLOW_LINK;
+   int eval_flags = RTEMS_FS_FOLLOW_LINK;
    rtems_filesystem_eval_path_context_t ctx;
    rtems_filesystem_location_info_t rootloc;
    rtems_filesystem_location_info_t *currentloc =
@@ -101,7 +101,7 @@ int rtems_tarfs_load(
    rtems_filesystem_eval_path_extract_currentloc( &ctx, &rootloc );
    rtems_filesystem_eval_path_set_flags(
      &ctx,
-     RTEMS_LIBIO_MAKE | RTEMS_LIBIO_EXCLUSIVE
+     RTEMS_FS_MAKE | RTEMS_FS_EXCLUSIVE
    );
    if (rootloc.ops != &IMFS_ops && rootloc.ops != &fifoIMFS_ops) {
      rv = -1;
diff --git a/cpukit/libfs/src/nfsclient/src/nfs.c b/cpukit/libfs/src/nfsclient/src/nfs.c
index 27a4338..ebcdbb3 100644
--- a/cpukit/libfs/src/nfsclient/src/nfs.c
+++ b/cpukit/libfs/src/nfsclient/src/nfs.c
@@ -1428,7 +1428,7 @@ static rtems_filesystem_eval_path_generic_status nfs_eval_part(
 
 		if (nfs_update_currentloc(ctx, nfs, entry)) {
 			int eval_flags = rtems_filesystem_eval_path_get_flags(ctx);
-			bool follow_sym_link = (eval_flags & RTEMS_LIBIO_FOLLOW_SYM_LINK) != 0;
+			bool follow_sym_link = (eval_flags & RTEMS_FS_FOLLOW_SYM_LINK) != 0;
 			bool terminal = !rtems_filesystem_eval_path_has_path( ctx );
 
 			if (SERP_ATTR(entry).type == NFLNK && (follow_sym_link || !terminal)) {
diff --git a/cpukit/libfs/src/rfs/rtems-rfs-rtems.c b/cpukit/libfs/src/rfs/rtems-rfs-rtems.c
index 577a6e5..3d74676 100644
--- a/cpukit/libfs/src/rfs/rtems-rfs-rtems.c
+++ b/cpukit/libfs/src/rfs/rtems-rfs-rtems.c
@@ -137,7 +137,7 @@ rtems_rfs_rtems_eval_token(
   rtems_filesystem_eval_path_generic_status status =
     RTEMS_FILESYSTEM_EVAL_PATH_GENERIC_DONE;
   rtems_rfs_inode_handle* inode = arg;
-  bool access_ok = rtems_rfs_rtems_eval_perms (ctx, RTEMS_LIBIO_PERMS_SEARCH, inode);
+  bool access_ok = rtems_rfs_rtems_eval_perms (ctx, RTEMS_FS_PERMS_EXEC, inode);
 
   if (access_ok) {
     if (rtems_filesystem_is_current_directory (token, tokenlen)) {
@@ -179,7 +179,7 @@ rtems_rfs_rtems_eval_token(
         bool is_sym_link = rtems_rfs_rtems_node_type_by_inode (inode)
           == RTEMS_FILESYSTEM_SYM_LINK;
         int eval_flags = rtems_filesystem_eval_path_get_flags (ctx);
-        bool follow_sym_link = (eval_flags & RTEMS_LIBIO_FOLLOW_SYM_LINK) != 0;
+        bool follow_sym_link = (eval_flags & RTEMS_FS_FOLLOW_SYM_LINK) != 0;
         bool terminal = !rtems_filesystem_eval_path_has_path (ctx);
 
         rtems_filesystem_eval_path_clear_token (ctx);
diff --git a/cpukit/libfs/src/rfs/rtems-rfs-shell.c b/cpukit/libfs/src/rfs/rtems-rfs-shell.c
index 8ef5b76..96df5f4 100644
--- a/cpukit/libfs/src/rfs/rtems-rfs-shell.c
+++ b/cpukit/libfs/src/rfs/rtems-rfs-shell.c
@@ -103,7 +103,7 @@ rtems_rfs_get_fs (const char* path, rtems_rfs_file_system** fs)
    */
   {
     rtems_filesystem_eval_path_context_t ctx;
-    int eval_flags = RTEMS_LIBIO_FOLLOW_LINK;
+    int eval_flags = RTEMS_FS_FOLLOW_LINK;
     const rtems_filesystem_location_info_t *currentloc =
       rtems_filesystem_eval_path_start (&ctx, path, eval_flags);
     *fs = rtems_rfs_rtems_pathloc_dev (currentloc);
diff --git a/cpukit/libnetworking/lib/tftpDriver.c b/cpukit/libnetworking/lib/tftpDriver.c
index 0db4898..7d211dd 100644
--- a/cpukit/libnetworking/lib/tftpDriver.c
+++ b/cpukit/libnetworking/lib/tftpDriver.c
@@ -488,8 +488,8 @@ static void rtems_tftp_eval_path(rtems_filesystem_eval_path_context_t *self)
 {
     int eval_flags = rtems_filesystem_eval_path_get_flags (self);
 
-    if ((eval_flags & RTEMS_LIBIO_MAKE) == 0) {
-        int rw = RTEMS_LIBIO_PERMS_READ | RTEMS_LIBIO_PERMS_WRITE;
+    if ((eval_flags & RTEMS_FS_MAKE) == 0) {
+        int rw = RTEMS_FS_PERMS_READ | RTEMS_FS_PERMS_WRITE;
 
         if ((eval_flags & rw) != rw) {
             rtems_filesystem_location_info_t *currentloc =




More information about the vc mailing list