summaryrefslogtreecommitdiff
path: root/btt/rstats.c
diff options
context:
space:
mode:
Diffstat (limited to 'btt/rstats.c')
-rw-r--r--btt/rstats.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/btt/rstats.c b/btt/rstats.c
index c0d2904..71f010b 100644
--- a/btt/rstats.c
+++ b/btt/rstats.c
@@ -51,11 +51,13 @@ static int do_open(struct files *fip, char *bn, char *pn)
return -1;
}
-static int init_rsip(struct rstat *rsip, char *bn)
+static int init_rsip(struct rstat *rsip, struct d_info *dip)
{
+ char *nm = dip ? dip->dip_name : "sys";
+
rsip->ios = rsip->nblks = 0;
- if (do_open(&rsip->files[0], bn, "iops_fp") ||
- do_open(&rsip->files[1], bn, "mbps_fp"))
+ if (do_open(&rsip->files[0], nm, "iops_fp") ||
+ do_open(&rsip->files[1], nm, "mbps_fp"))
return -1;
list_add_tail(&rsip->head, &rstats);
@@ -92,11 +94,11 @@ static void __add(struct rstat *rsip, double cur, unsigned long long nblks)
rsip->nblks += nblks;
}
-void *rstat_alloc(char *bn)
+void *rstat_alloc(struct d_info *dip)
{
struct rstat *rsip = malloc(sizeof(*rsip));
- if (!init_rsip(rsip, bn))
+ if (!init_rsip(rsip, dip))
return rsip;
free(rsip);
@@ -121,7 +123,7 @@ void rstat_add(void *ptr, double cur, unsigned long long nblks)
int rstat_init(void)
{
- sys_info = rstat_alloc("sys");
+ sys_info = rstat_alloc(NULL);
return sys_info != NULL;
}