forked from Imagelibrary/rtems
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.
This commit is contained in:
@@ -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 =
|
||||
|
||||
@@ -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
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user