summaryrefslogtreecommitdiffstats
path: root/cpukit/libfs
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2010-06-17 22:10:20 +0000
committerChris Johns <chrisj@rtems.org>2010-06-17 22:10:20 +0000
commit3142a5c8c47c6204fc23dc67cfd795483d17101e (patch)
tree30bed843f10b40de8fc34e37bd897b85b14707f7 /cpukit/libfs
parent2010-06-17 Joel Sherrill <joel.sherrilL@OARcorp.com> (diff)
downloadrtems-3142a5c8c47c6204fc23dc67cfd795483d17101e.tar.bz2
2010-06-18 Chris Johns <chrisj@rtems.org>
* libfs/src/rfs/rtems-rfs-file-block.c: Clean up uint64_t maths. * libfs/src/rfs/rtems-rfs-file-system.h, libfs/src/rfs/rtems-rfs-file-system.c: Move questionable macros to C functions.
Diffstat (limited to 'cpukit/libfs')
-rw-r--r--cpukit/libfs/src/rfs/rtems-rfs-block.c4
-rw-r--r--cpukit/libfs/src/rfs/rtems-rfs-file-system.c16
-rw-r--r--cpukit/libfs/src/rfs/rtems-rfs-file-system.h32
3 files changed, 35 insertions, 17 deletions
diff --git a/cpukit/libfs/src/rfs/rtems-rfs-block.c b/cpukit/libfs/src/rfs/rtems-rfs-block.c
index 49d24d1a87..5ffadcc284 100644
--- a/cpukit/libfs/src/rfs/rtems-rfs-block.c
+++ b/cpukit/libfs/src/rfs/rtems-rfs-block.c
@@ -88,13 +88,15 @@ rtems_rfs_block_get_size (rtems_rfs_file_system* fs,
rtems_rfs_block_size* size)
{
uint32_t offset;
+ uint64_t block_size;
if (size->count == 0)
return 0;
if (size->offset == 0)
offset = rtems_rfs_fs_block_size (fs);
else
offset = size->offset;
- return (((uint64_t) (size->count - 1)) * rtems_rfs_fs_block_size (fs)) + offset;
+ block_size = rtems_rfs_fs_block_size (fs);
+ return (((uint64_t) (size->count - 1)) * block_size) + offset;
}
int
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 <rtems/rfs/rtems-rfs-inode.h>
#include <rtems/rfs/rtems-rfs-trace.h>
+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
@@ -304,14 +304,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.
*
* @param _fs Pointer to the file system.
@@ -354,14 +346,6 @@ struct _rtems_rfs_file_system
#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.
*/
#define rtems_rfs_fs_max_name(_fs) ((_fs)->max_name_length)
@@ -379,6 +363,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.
*
* @param name The device to open.