From f82851c5f75eeb7605002e6c10f5fe403386adee Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 13 Sep 2013 15:17:35 +0200 Subject: IMFS: Use inline functions instead of macros --- cpukit/libfs/src/imfs/imfs.h | 64 +++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 28 deletions(-) (limited to 'cpukit/libfs') diff --git a/cpukit/libfs/src/imfs/imfs.h b/cpukit/libfs/src/imfs/imfs.h index 6874523154..f6ddc7dccf 100644 --- a/cpukit/libfs/src/imfs/imfs.h +++ b/cpukit/libfs/src/imfs/imfs.h @@ -326,34 +326,42 @@ struct IMFS_jnode_tt { IMFS_types_union info; }; -#define IMFS_update_atime( _jnode ) \ - do { \ - struct timeval tv; \ - gettimeofday( &tv, 0 ); \ - _jnode->stat_atime = (time_t) tv.tv_sec; \ - } while (0) - -#define IMFS_update_mtime( _jnode ) \ - do { \ - struct timeval tv; \ - gettimeofday( &tv, 0 ); \ - _jnode->stat_mtime = (time_t) tv.tv_sec; \ - } while (0) - -#define IMFS_update_ctime( _jnode ) \ - do { \ - struct timeval tv; \ - gettimeofday( &tv, 0 ); \ - _jnode->stat_ctime = (time_t) tv.tv_sec; \ - } while (0) - -#define IMFS_mtime_ctime_update( _jnode ) \ - do { \ - struct timeval tv; \ - gettimeofday( &tv, 0 ); \ - _jnode->stat_mtime = (time_t) tv.tv_sec; \ - _jnode->stat_ctime = (time_t) tv.tv_sec; \ - } while (0) +static inline void IMFS_update_atime( IMFS_jnode_t *jnode ) +{ + struct timeval now; + + gettimeofday( &now, 0 ); + + jnode->stat_atime = now.tv_sec; +} + +static inline void IMFS_update_mtime( IMFS_jnode_t *jnode ) +{ + struct timeval now; + + gettimeofday( &now, 0 ); + + jnode->stat_mtime = now.tv_sec; +} + +static inline void IMFS_update_ctime( IMFS_jnode_t *jnode ) +{ + struct timeval now; + + gettimeofday( &now, 0 ); + + jnode->stat_ctime = now.tv_sec; +} + +static inline void IMFS_mtime_ctime_update( IMFS_jnode_t *jnode ) +{ + struct timeval now; + + gettimeofday( &now, 0 ); + + jnode->stat_mtime = now.tv_sec; + jnode->stat_ctime = now.tv_sec; +} typedef struct { int instance; -- cgit v1.2.3