summaryrefslogtreecommitdiff
path: root/btt/unplug_hist.c
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2010-04-19 19:15:27 +0200
committerJens Axboe <jens.axboe@oracle.com>2010-04-19 19:15:27 +0200
commit014b0ea19762341e217d463308710c3662d50e9c (patch)
treead4cf6beb6c3dfe3f5b0a0b207747646cf9fa835 /btt/unplug_hist.c
parenta2b1f3550a0bd4ab9e351bd2881fab1f1340bf1e (diff)
parent6abaea7a340536c6afa5944e3fa63831729dfed3 (diff)
downloadblktrace-014b0ea19762341e217d463308710c3662d50e9c.tar.gz
blktrace-014b0ea19762341e217d463308710c3662d50e9c.tar.bz2
Merge branch 'master' of ssh://router.home.kernel.dk/data/git/blktrace
Diffstat (limited to 'btt/unplug_hist.c')
-rw-r--r--btt/unplug_hist.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/btt/unplug_hist.c b/btt/unplug_hist.c
index 8fd4285..89995de 100644
--- a/btt/unplug_hist.c
+++ b/btt/unplug_hist.c
@@ -26,18 +26,18 @@
#define NBKTS (EXCESS_BKT + 1)
struct hist_bkt {
- __u32 dev;
+ struct d_info *dip;
int hist[NBKTS * sizeof(int)];
};
-void *unplug_hist_alloc(__u32 device)
+void *unplug_hist_alloc(struct d_info *dip)
{
struct hist_bkt *hbp;
if (unplug_hist_name == NULL) return NULL;
hbp = malloc(sizeof(*hbp));
- hbp->dev = device;
+ hbp->dip = dip;
memset(hbp->hist, 0, NBKTS * sizeof(int));
return hbp;
@@ -66,11 +66,12 @@ void unplug_hist_free(void *arg)
if (arg) {
FILE *fp;
struct hist_bkt *hbp = arg;
- int mjr = hbp->dev >> MINORBITS;
- int mnr = hbp->dev & ((1 << MINORBITS) - 1);
- char *oname = malloc(strlen(unplug_hist_name) + 32);
+ size_t tlen = strlen(unplug_hist_name)
+ + strlen(hbp->dip->dip_name) + 32;
+ char *oname = malloc(tlen);
- sprintf(oname, "%s_%03d,%03d.dat", unplug_hist_name, mjr, mnr);
+ sprintf(oname, "%s_%s.dat", unplug_hist_name,
+ hbp->dip->dip_name);
if ((fp = my_fopen(oname, "w")) != NULL) {
int i;