From ca8c50deae081fed2b8e8a7d7ec86a974cb15cd5 Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Thu, 17 Jun 2010 22:00:47 +0000 Subject: [PATCH] 2010-06-18 Chris Johns * libfs/src/rfs/rtems-rfs-file-system.h, libfs/src/rfs/rtems-rfs-file-system.c: Move questionable macros to C functions. --- cpukit/ChangeLog | 6 ++++ cpukit/libfs/src/rfs/rtems-rfs-file-system.c | 16 ++++++++++ cpukit/libfs/src/rfs/rtems-rfs-file-system.h | 32 ++++++++++---------- 3 files changed, 38 insertions(+), 16 deletions(-) diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index cf4b881b21..cc2029c61a 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,9 @@ +2010-06-18 Chris Johns + + * libfs/src/rfs/rtems-rfs-file-system.h, + libfs/src/rfs/rtems-rfs-file-system.c: Move questionable macros to + C functions. + 2010-06-17 Joel Sherrill * sapi/include/confdefs.h: Remove ITRON configuration parameters. diff --git a/cpukit/libfs/src/rfs/rtems-rfs-file-system.c b/cpukit/libfs/src/rfs/rtems-rfs-file-system.c index 6c92a43720..c972e13247 100644 --- a/cpukit/libfs/src/rfs/rtems-rfs-file-system.c +++ b/cpukit/libfs/src/rfs/rtems-rfs-file-system.c @@ -28,6 +28,22 @@ #include #include +uint64_t +rtems_rfs_fs_size (rtems_rfs_file_system* fs) +{ + uint64_t blocks = rtems_rfs_fs_blocks (fs); + uint64_t block_size = rtems_rfs_fs_block_size (fs); + return blocks * block_size; +} + +uint64_t +rtems_rfs_fs_media_size (rtems_rfs_file_system* fs) +{ + uint64_t media_blocks = (uint64_t) rtems_rfs_fs_media_blocks (fs); + uint64_t media_block_size = (uint64_t) rtems_rfs_fs_media_block_size (fs); + return media_blocks * media_block_size; +} + static int rtems_rfs_fs_read_superblock (rtems_rfs_file_system* fs) { diff --git a/cpukit/libfs/src/rfs/rtems-rfs-file-system.h b/cpukit/libfs/src/rfs/rtems-rfs-file-system.h index e97e66a108..9ca0e4754f 100644 --- a/cpukit/libfs/src/rfs/rtems-rfs-file-system.h +++ b/cpukit/libfs/src/rfs/rtems-rfs-file-system.h @@ -303,14 +303,6 @@ struct _rtems_rfs_file_system */ #define rtems_rfs_fs_block_size(_fs) ((_fs)->block_size) -/** - * The size of the disk in bytes. - * - * @param _fs Pointer to the file system. - */ -#define rtems_rfs_fs_size(_fs) (((uint64_t) rtems_rfs_fs_blocks (_fs)) * \ - rtems_rfs_fs_block_size (_fs)) - /** * The number of inodes. * @@ -353,14 +345,6 @@ struct _rtems_rfs_file_system #define rtems_rfs_fs_media_block_size(_fs) (1) #endif -/** - * The size of the disk in bytes. - * - * @param _fs Pointer to the file system. - */ -#define rtems_rfs_fs_media_size(_fs) (((uint64_t) rtems_rfs_fs_media_blocks (_fs)) * \ - rtems_rfs_fs_media_block_size (_fs)) - /** * The maximum length of a name supported by the file system. */ @@ -378,6 +362,22 @@ struct _rtems_rfs_file_system */ #define rtems_rfs_fs_user(_fs) ((_fs)->user) +/** + * Return the size of the disk in bytes. + * + * @param fs Pointer to the file system. + * @return uint64_t The size of the disk in bytes. + */ +uint64_t rtems_rfs_fs_size(rtems_rfs_file_system* fs); + +/** + * The size of the disk in bytes calculated from the media parameters.. + * + * @param fs Pointer to the file system. + * @return uint64_t The size of the disk in bytes. + */ +uint64_t rtems_rfs_fs_media_size (rtems_rfs_file_system* fs); + /** * Open the file system given a file path. *