diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-06-12 09:46:09 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-06-12 10:12:40 +0200 |
commit | 9f527308d7248d1ec1d63f0911757bb5faa7ea10 (patch) | |
tree | 27943302132f4b86a1ea3c6089407b45d23c66cb /cpukit/libblock/include/rtems/blkdev.h | |
parent | libblock: Remove const qualifier (diff) | |
download | rtems-9f527308d7248d1ec1d63f0911757bb5faa7ea10.tar.bz2 |
libblock: Add block device statistics
Diffstat (limited to 'cpukit/libblock/include/rtems/blkdev.h')
-rw-r--r-- | cpukit/libblock/include/rtems/blkdev.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/cpukit/libblock/include/rtems/blkdev.h b/cpukit/libblock/include/rtems/blkdev.h index 7c2787204a..ccc8981c35 100644 --- a/cpukit/libblock/include/rtems/blkdev.h +++ b/cpukit/libblock/include/rtems/blkdev.h @@ -16,7 +16,9 @@ #include <rtems.h> #include <rtems/diskdevs.h> +#include <rtems/bspIo.h> #include <sys/ioctl.h> +#include <stdio.h> #ifdef __cplusplus extern "C" { @@ -161,6 +163,8 @@ typedef struct rtems_blkdev_request { #define RTEMS_BLKIO_CAPABILITIES _IO('B', 8) #define RTEMS_BLKIO_GETDISKDEV _IOR('B', 9, rtems_disk_device *) #define RTEMS_BLKIO_PURGEDEV _IO('B', 10) +#define RTEMS_BLKIO_GETDEVSTATS _IOR('B', 11, rtems_blkdev_stats *) +#define RTEMS_BLKIO_RESETDEVSTATS _IO('B', 12) /** @} */ @@ -208,6 +212,19 @@ static inline int rtems_disk_fd_purge(int fd) return ioctl(fd, RTEMS_BLKIO_PURGEDEV); } +static inline int rtems_disk_fd_get_device_stats( + int fd, + rtems_blkdev_stats *stats +) +{ + return ioctl(fd, RTEMS_BLKIO_GETDEVSTATS, stats); +} + +static inline int rtems_disk_fd_reset_device_stats(int fd) +{ + return ioctl(fd, RTEMS_BLKIO_RESETDEVSTATS); +} + /** * Only consecutive multi-sector buffer requests are supported. * @@ -361,6 +378,24 @@ rtems_status_code rtems_blkdev_create_partition( rtems_blkdev_bnum block_count ); +/** + * @brief Prints the block device statistics. + */ +void rtems_blkdev_print_stats( + const rtems_blkdev_stats *stats, + rtems_printk_plugin_t print, + void *print_arg +); + +/** + * @brief Block device statistics command. + */ +void rtems_blkstats( + FILE *output, + const char *device, + bool reset +); + /** @} */ #ifdef __cplusplus |