This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
disk usage cyg_fs_getinfo()
- From: Nathan Heijermans <nheijermans at gmail dot com>
- To: ecos-patches at ecos dot sourceware dot org
- Date: Tue, 27 Jan 2009 17:02:26 -0500
- Subject: disk usage cyg_fs_getinfo()
Hi all,
There is a naming mismatch in the block usage code and cdl configuration
that prevents it from being usable as it exists in the CVS repository.
The CDL and fileio.h define keys and data structures named *_disk_usage,
whereas the filesytem implementations of cyg_fs_getinfo() use keys/data
structures named *_block_usage. Attached is a patch that resolves the
naming mismatch.
Changes:
fileio.cdl:
- Renamed CYGSEM_FILEIO_INFO_DISK_USAGE to CYGSEM_FILEIO_BLOCK_USAGE.
The latter seems more appropriate, given that the context in which it is
used is a filesystem, not a disk device. Furthermore,
CYGSEM_FILEIO_BLOCK_USAGE is already used in all the filesystems (except
for jffs2), so this change impacts less code.
fileio.h:
- Renamed FS_INFO_DISK_USAGE to FS_INFO_BLOCK_USAGE to match existing
code. Also removed the #ifdef surrounding the key's #define; it doesn't
seem as though the existence of the key should ever disappear from the
header file.
- Renamed `struct cyg_fs_disk_usage` to `struct cyg_fs_block_usage`.
Made formatting uniform with code in the rest of the file.
Thanks,
Nathan Heijermans
diff --git a/packages/io/fileio/current/cdl/fileio.cdl b/packages/io/fileio/current/cdl/fileio.cdl
index cd454aa..a000411 100644
--- a/packages/io/fileio/current/cdl/fileio.cdl
+++ b/packages/io/fileio/current/cdl/fileio.cdl
@@ -224,8 +224,8 @@ cdl_package CYGPKG_IO_FILEIO {
}
- cdl_option CYGSEM_FILEIO_INFO_DISK_USAGE {
- display "cyg_fs_getinfo call for disk usage"
+ cdl_option CYGSEM_FILEIO_BLOCK_USAGE {
+ display "Enable FS block usage queries via cyg_fs_getinfo"
flavor bool
default_value 0
description "
diff --git a/packages/io/fileio/current/include/fileio.h b/packages/io/fileio/current/include/fileio.h
index fca6868..3084863 100644
--- a/packages/io/fileio/current/include/fileio.h
+++ b/packages/io/fileio/current/include/fileio.h
@@ -159,9 +159,7 @@ struct cyg_fstab_entry
#define FS_INFO_GETCWD 3 /* getcwd() */
#define FS_INFO_SYNC 4 /* cyg_fs_fssync() */
#define FS_INFO_ATTRIB 5 /* cyg_fs_(get|set)_attrib() */
-#ifdef CYGSEM_FILEIO_INFO_DISK_USAGE
-#define FS_INFO_DISK_USAGE 6 /* get_disk_usage() */
-#endif
+#define FS_INFO_BLOCK_USAGE 6 /* get_block_usage() */
//-----------------------------------------------------------------------------
// Types for link()
@@ -177,10 +175,11 @@ struct cyg_getcwd_info
size_t size; /* size of buffer */
};
-struct cyg_fs_disk_usage{
- cyg_uint64 total_blocks;
- cyg_uint64 free_blocks;
- cyg_uint32 block_size;
+struct cyg_fs_block_usage
+{
+ cyg_uint64 total_blocks; /* total number of blocks available */
+ cyg_uint64 free_blocks; /* number of free blocks in the filesystem */
+ cyg_uint32 block_size; /* number of bytes in one block */
};
typedef cyg_uint32 cyg_fs_attrib_t;