forked from Imagelibrary/rtems
Renamed IMFS structure elements to avoid conflicts on Solaris host/target.
Reported by Ralf Corsepius <corsepiu@faw.uni-ulm.de>.
This commit is contained in:
@@ -150,16 +150,16 @@ struct IMFS_jnode_tt {
|
||||
Chain_Node Node; /* for chaining them together */
|
||||
IMFS_jnode_t *Parent; /* Parent node */
|
||||
char name[IMFS_NAME_MAX+1]; /* "basename" */
|
||||
mode_t st_mode; /* File mode */
|
||||
nlink_t st_nlink; /* Link count */
|
||||
ino_t st_ino; /* inode */
|
||||
mode_t stat_mode; /* File mode */
|
||||
nlink_t stat_nlink; /* Link count */
|
||||
ino_t stat_ino; /* inode */
|
||||
|
||||
uid_t st_uid; /* User ID of owner */
|
||||
gid_t st_gid; /* Group ID of owner */
|
||||
uid_t stat_uid; /* User ID of owner */
|
||||
gid_t stat_gid; /* Group ID of owner */
|
||||
|
||||
time_t st_atime; /* Time of last access */
|
||||
time_t st_mtime; /* Time of last modification */
|
||||
time_t st_ctime; /* Time of last status change */
|
||||
time_t stat_atime; /* Time of last access */
|
||||
time_t stat_mtime; /* Time of last modification */
|
||||
time_t stat_ctime; /* Time of last status change */
|
||||
IMFS_jnode_types_t type; /* Type of this entry */
|
||||
IMFS_types_union info;
|
||||
};
|
||||
@@ -168,29 +168,29 @@ struct IMFS_jnode_tt {
|
||||
do { \
|
||||
struct timeval tv; \
|
||||
gettimeofday( &tv, 0 ); \
|
||||
_jnode->st_atime = (time_t) tv.tv_sec; \
|
||||
_jnode->stat_atime = (time_t) tv.tv_sec; \
|
||||
} while (0)
|
||||
|
||||
#define IMFS_update_mtime( _jnode ) \
|
||||
do { \
|
||||
struct timeval tv; \
|
||||
gettimeofday( &tv, 0 ); \
|
||||
_jnode->st_mtime = (time_t) tv.tv_sec; \
|
||||
_jnode->stat_mtime = (time_t) tv.tv_sec; \
|
||||
} while (0)
|
||||
|
||||
#define IMFS_update_ctime( _jnode ) \
|
||||
do { \
|
||||
struct timeval tv; \
|
||||
gettimeofday( &tv, 0 ); \
|
||||
_jnode->st_ctime = (time_t) tv.tv_sec; \
|
||||
_jnode->stat_ctime = (time_t) tv.tv_sec; \
|
||||
} while (0)
|
||||
|
||||
#define IMFS_atime_mtime_update( _jnode ) \
|
||||
do { \
|
||||
struct timeval tv; \
|
||||
gettimeofday( &tv, 0 ); \
|
||||
_jnode->st_mtime = (time_t) tv.tv_sec; \
|
||||
_jnode->st_atime = (time_t) tv.tv_sec; \
|
||||
_jnode->stat_mtime = (time_t) tv.tv_sec; \
|
||||
_jnode->stat_atime = (time_t) tv.tv_sec; \
|
||||
} while (0)
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -38,12 +38,12 @@ int IMFS_chown(
|
||||
#if defined(RTEMS_POSIX_API)
|
||||
st_uid = geteuid();
|
||||
|
||||
if ( ( st_uid != jnode->st_uid ) && ( st_uid != 0 ) )
|
||||
if ( ( st_uid != jnode->stat_uid ) && ( st_uid != 0 ) )
|
||||
set_errno_and_return_minus_one( EPERM );
|
||||
#endif
|
||||
|
||||
jnode->st_uid = owner;
|
||||
jnode->st_gid = group;
|
||||
jnode->stat_uid = owner;
|
||||
jnode->stat_gid = group;
|
||||
|
||||
IMFS_update_ctime( jnode );
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ IMFS_jnode_t *IMFS_create_node(
|
||||
* Fill in the basic information
|
||||
*/
|
||||
|
||||
node->st_nlink = 1;
|
||||
node->stat_nlink = 1;
|
||||
node->type = type;
|
||||
strncpy( node->name, name, IMFS_NAME_MAX );
|
||||
|
||||
@@ -56,14 +56,14 @@ IMFS_jnode_t *IMFS_create_node(
|
||||
* Fill in the mode and permission information for the jnode structure.
|
||||
*/
|
||||
|
||||
node->st_mode = mode & ~rtems_filesystem_umask;
|
||||
node->stat_mode = mode & ~rtems_filesystem_umask;
|
||||
|
||||
#if defined(RTEMS_POSIX_API)
|
||||
node->st_uid = geteuid();
|
||||
node->st_gid = getegid();
|
||||
node->stat_uid = geteuid();
|
||||
node->stat_gid = getegid();
|
||||
#else
|
||||
node->st_uid = 0;
|
||||
node->st_gid = 0;
|
||||
node->stat_uid = 0;
|
||||
node->stat_gid = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -72,9 +72,9 @@ IMFS_jnode_t *IMFS_create_node(
|
||||
|
||||
gettimeofday( &tv, 0 );
|
||||
|
||||
node->st_atime = (time_t) tv.tv_sec;
|
||||
node->st_mtime = (time_t) tv.tv_sec;
|
||||
node->st_ctime = (time_t) tv.tv_sec;
|
||||
node->stat_atime = (time_t) tv.tv_sec;
|
||||
node->stat_mtime = (time_t) tv.tv_sec;
|
||||
node->stat_ctime = (time_t) tv.tv_sec;
|
||||
|
||||
/*
|
||||
* Set the type specific information
|
||||
@@ -121,7 +121,7 @@ IMFS_jnode_t *IMFS_create_node(
|
||||
node->Parent = parent;
|
||||
|
||||
fs_info = parent_loc->mt_entry->fs_info;
|
||||
node->st_ino = ++fs_info->ino_count;
|
||||
node->stat_ino = ++fs_info->ino_count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -240,17 +240,17 @@ int imfs_dir_fstat(
|
||||
the_jnode = (IMFS_jnode_t *) loc->node_access;
|
||||
|
||||
buf->st_dev = 0ll;
|
||||
buf->st_ino = the_jnode->st_ino;
|
||||
buf->st_mode = the_jnode->st_mode;
|
||||
buf->st_nlink = the_jnode->st_nlink;
|
||||
buf->st_uid = the_jnode->st_uid;
|
||||
buf->st_gid = the_jnode->st_gid;
|
||||
buf->st_ino = the_jnode->stat_ino;
|
||||
buf->st_mode = the_jnode->stat_mode;
|
||||
buf->st_nlink = the_jnode->stat_nlink;
|
||||
buf->st_uid = the_jnode->stat_uid;
|
||||
buf->st_gid = the_jnode->stat_gid;
|
||||
buf->st_rdev = 0ll;
|
||||
buf->st_blksize = 0;
|
||||
buf->st_blocks = 0;
|
||||
buf->st_atime = the_jnode->st_atime;
|
||||
buf->st_mtime = the_jnode->st_mtime;
|
||||
buf->st_ctime = the_jnode->st_ctime;
|
||||
buf->st_atime = the_jnode->stat_atime;
|
||||
buf->st_mtime = the_jnode->stat_mtime;
|
||||
buf->st_ctime = the_jnode->stat_ctime;
|
||||
|
||||
buf->st_size = 0;
|
||||
|
||||
@@ -317,14 +317,14 @@ int imfs_dir_rmnod(
|
||||
* Decrement the link counter and see if we can free the space.
|
||||
*/
|
||||
|
||||
the_jnode->st_nlink--;
|
||||
the_jnode->stat_nlink--;
|
||||
IMFS_update_ctime( the_jnode );
|
||||
|
||||
/*
|
||||
* The file cannot be open and the link must be less than 1 to free.
|
||||
*/
|
||||
|
||||
if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) {
|
||||
if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->stat_nlink < 1) ) {
|
||||
|
||||
/*
|
||||
* Is the rtems_filesystem_current is this node?
|
||||
|
||||
@@ -82,8 +82,8 @@ int IMFS_evaluate_permission(
|
||||
st_uid = geteuid();
|
||||
st_gid = getegid();
|
||||
#else
|
||||
st_uid = jnode->st_uid;
|
||||
st_gid = jnode->st_gid;
|
||||
st_uid = jnode->stat_uid;
|
||||
st_gid = jnode->stat_gid;
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -92,9 +92,9 @@ int IMFS_evaluate_permission(
|
||||
|
||||
flags_to_test = flags;
|
||||
|
||||
if ( st_uid == jnode->st_uid )
|
||||
if ( st_uid == jnode->stat_uid )
|
||||
flags_to_test <<= 6;
|
||||
else if ( st_gid == jnode->st_gid )
|
||||
else if ( st_gid == jnode->stat_gid )
|
||||
flags_to_test <<= 3;
|
||||
else
|
||||
/* must be other - do nothing */;
|
||||
@@ -103,7 +103,7 @@ int IMFS_evaluate_permission(
|
||||
* If all of the flags are set we have permission
|
||||
* to do this.
|
||||
*/
|
||||
if ( ( flags_to_test & jnode->st_mode) == flags_to_test )
|
||||
if ( ( flags_to_test & jnode->stat_mode) == flags_to_test )
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -34,7 +34,7 @@ int IMFS_fchmod(
|
||||
#if defined(RTEMS_POSIX_API)
|
||||
st_uid = geteuid();
|
||||
|
||||
if ( ( st_uid != jnode->st_uid ) && ( st_uid != 0 ) )
|
||||
if ( ( st_uid != jnode->stat_uid ) && ( st_uid != 0 ) )
|
||||
set_errno_and_return_minus_one( EPERM );
|
||||
#endif
|
||||
|
||||
@@ -44,8 +44,8 @@ int IMFS_fchmod(
|
||||
if ( mode & (~ (S_IRWXU | S_IRWXG | S_IRWXO ) ) )
|
||||
set_errno_and_return_minus_one( EPERM );
|
||||
|
||||
jnode->st_mode &= ~(S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
jnode->st_mode |= mode;
|
||||
jnode->stat_mode &= ~(S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
jnode->stat_mode |= mode;
|
||||
|
||||
IMFS_update_ctime( jnode );
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ int IMFS_initialize_support(
|
||||
fs_info->directory_handlers = directory_handlers;
|
||||
|
||||
jnode = temp_mt_entry->mt_fs_root.node_access;
|
||||
jnode->st_ino = fs_info->ino_count;
|
||||
jnode->stat_ino = fs_info->ino_count;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ int IMFS_link(
|
||||
*/
|
||||
|
||||
info.hard_link.link_node = to_loc->node_access;
|
||||
if ( info.hard_link.link_node->st_nlink >= LINK_MAX )
|
||||
if ( info.hard_link.link_node->stat_nlink >= LINK_MAX )
|
||||
set_errno_and_return_minus_one( EMLINK );
|
||||
|
||||
/*
|
||||
@@ -63,7 +63,7 @@ int IMFS_link(
|
||||
* Increment the link count of the node being pointed to.
|
||||
*/
|
||||
|
||||
info.hard_link.link_node->st_nlink++;
|
||||
info.hard_link.link_node->stat_nlink++;
|
||||
IMFS_update_ctime( info.hard_link.link_node );
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -45,14 +45,14 @@ int IMFS_rmnod(
|
||||
* Decrement the link counter and see if we can free the space.
|
||||
*/
|
||||
|
||||
the_jnode->st_nlink--;
|
||||
the_jnode->stat_nlink--;
|
||||
IMFS_update_ctime( the_jnode );
|
||||
|
||||
/*
|
||||
* The file cannot be open and the link must be less than 1 to free.
|
||||
*/
|
||||
|
||||
if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) {
|
||||
if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->stat_nlink < 1) ) {
|
||||
|
||||
/*
|
||||
* Is rtems_filesystem_current this node?
|
||||
|
||||
@@ -44,15 +44,15 @@ int IMFS_stat(
|
||||
break;
|
||||
}
|
||||
|
||||
buf->st_mode = the_jnode->st_mode;
|
||||
buf->st_nlink = the_jnode->st_nlink;
|
||||
buf->st_ino = the_jnode->st_ino;
|
||||
buf->st_uid = the_jnode->st_uid;
|
||||
buf->st_gid = the_jnode->st_gid;
|
||||
buf->st_mode = the_jnode->stat_mode;
|
||||
buf->st_nlink = the_jnode->stat_nlink;
|
||||
buf->st_ino = the_jnode->stat_ino;
|
||||
buf->st_uid = the_jnode->stat_uid;
|
||||
buf->st_gid = the_jnode->stat_gid;
|
||||
|
||||
buf->st_atime = the_jnode->st_atime;
|
||||
buf->st_mtime = the_jnode->st_mtime;
|
||||
buf->st_ctime = the_jnode->st_ctime;
|
||||
buf->st_atime = the_jnode->stat_atime;
|
||||
buf->st_mtime = the_jnode->stat_mtime;
|
||||
buf->st_ctime = the_jnode->stat_ctime;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -53,9 +53,9 @@ int IMFS_unlink(
|
||||
* to remove the node that is a link and the node itself.
|
||||
*/
|
||||
|
||||
node->info.hard_link.link_node->st_nlink --;
|
||||
node->info.hard_link.link_node->stat_nlink --;
|
||||
IMFS_update_ctime( node->info.hard_link.link_node );
|
||||
if ( node->info.hard_link.link_node->st_nlink < 1) {
|
||||
if ( node->info.hard_link.link_node->stat_nlink < 1) {
|
||||
result = (*the_link.handlers->rmnod)( &the_link );
|
||||
if ( result != 0 )
|
||||
return -1;
|
||||
|
||||
@@ -30,8 +30,8 @@ int IMFS_utime(
|
||||
|
||||
the_jnode = (IMFS_jnode_t *) pathloc->node_access;
|
||||
|
||||
the_jnode->st_atime = actime;
|
||||
the_jnode->st_mtime = modtime;
|
||||
the_jnode->stat_atime = actime;
|
||||
the_jnode->stat_mtime = modtime;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1064,14 +1064,14 @@ int memfile_rmnod(
|
||||
* Decrement the link counter and see if we can free the space.
|
||||
*/
|
||||
|
||||
the_jnode->st_nlink--;
|
||||
the_jnode->stat_nlink--;
|
||||
IMFS_update_ctime( the_jnode );
|
||||
|
||||
/*
|
||||
* The file cannot be open and the link must be less than 1 to free.
|
||||
*/
|
||||
|
||||
if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) {
|
||||
if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->stat_nlink < 1) ) {
|
||||
|
||||
/*
|
||||
* Is the rtems_filesystem_current is this node?
|
||||
|
||||
Reference in New Issue
Block a user