Changeset 924cbd4f in rtems


Ignore:
Timestamp:
Jan 31, 2015, 8:27:01 PM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
cf4dfc1
Parents:
95308caf
git-author:
Sebastian Huber <sebastian.huber@…> (01/31/15 20:27:01)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/04/15 18:31:55)
Message:

IMFS: Simplify ino generation

The type of ino_t is unsigned long, so it can store a pointer. Avoid a
potential integer overflow.

Location:
cpukit/libfs/src/imfs
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libfs/src/imfs/imfs.h

    r95308caf r924cbd4f  
    245245  unsigned short      reference_count;
    246246  nlink_t             st_nlink;              /* Link count */
    247   ino_t               st_ino;                /* inode */
    248247
    249248  uid_t               st_uid;                /* User ID of owner */
     
    373372
    374373typedef struct {
    375   ino_t ino_count;
    376374  const IMFS_node_control *node_controls [IMFS_TYPE_COUNT];
    377375} IMFS_fs_info_t;
     
    961959}
    962960
     961static inline ino_t IMFS_node_to_ino( const IMFS_jnode_t *node )
     962{
     963  return (ino_t) node;
     964}
     965
    963966/** @} */
    964967
  • cpukit/libfs/src/imfs/imfs_creat.c

    r95308caf r924cbd4f  
    7777  node->stat_mtime  = (time_t) tv.tv_sec;
    7878  node->stat_ctime  = (time_t) tv.tv_sec;
    79   node->st_ino = ++fs_info->ino_count;
    8079
    8180  initialized_node = (*node->control->node_initialize)( node, arg );
  • cpukit/libfs/src/imfs/imfs_directory.c

    r95308caf r924cbd4f  
    7474         dir_ent->d_off = current_entry;
    7575         dir_ent->d_reclen = sizeof( *dir_ent );
    76          dir_ent->d_ino = imfs_node->st_ino;
     76         dir_ent->d_ino = IMFS_node_to_ino( imfs_node );
    7777         dir_ent->d_namlen = strlen( imfs_node->name );
    7878         memcpy( dir_ent->d_name, imfs_node->name, dir_ent->d_namlen + 1 );
  • cpukit/libfs/src/imfs/imfs_stat.c

    r95308caf r924cbd4f  
    3535  buf->st_mode  = the_jnode->st_mode;
    3636  buf->st_nlink = the_jnode->st_nlink;
    37   buf->st_ino   = the_jnode->st_ino;
     37  buf->st_ino   = IMFS_node_to_ino( the_jnode );
    3838  buf->st_uid   = the_jnode->st_uid;
    3939  buf->st_gid   = the_jnode->st_gid;
Note: See TracChangeset for help on using the changeset viewer.