summaryrefslogtreecommitdiff
path: root/btt/bno_dump.c
diff options
context:
space:
mode:
Diffstat (limited to 'btt/bno_dump.c')
-rw-r--r--btt/bno_dump.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/btt/bno_dump.c b/btt/bno_dump.c
index 7365300..02f3811 100644
--- a/btt/bno_dump.c
+++ b/btt/bno_dump.c
@@ -24,17 +24,13 @@ struct bno_dump {
FILE *rfp, *wfp, *cfp;
};
-static FILE *bno_dump_open(__u32 device, char rwc)
+static FILE *bno_dump_open(struct d_info *dip, char rwc)
{
FILE *fp;
char *oname;
- int mjr, mnr;
- mjr = device >> MINORBITS;
- mnr = device & ((1 << MINORBITS) - 1);
-
- oname = malloc(strlen(bno_dump_name) + 32);
- sprintf(oname, "%s_%03d,%03d_%c.dat", bno_dump_name, mjr, mnr, rwc);
+ oname = malloc(strlen(bno_dump_name) + strlen(dip->dip_name) + 32);
+ sprintf(oname, "%s_%s_%c.dat", bno_dump_name, dip->dip_name, rwc);
if ((fp = my_fopen(oname, "w")) == NULL)
perror(oname);
else
@@ -48,16 +44,16 @@ static inline void bno_dump_write(FILE *fp, struct io *iop)
(long long)BIT_START(iop), (long long)BIT_END(iop));
}
-void *bno_dump_alloc(__u32 device)
+void *bno_dump_alloc(struct d_info *dip)
{
struct bno_dump *bdp;
if (bno_dump_name == NULL) return NULL;
bdp = malloc(sizeof(*bdp));
- bdp->rfp = bno_dump_open(device, 'r');
- bdp->wfp = bno_dump_open(device, 'w');
- bdp->cfp = bno_dump_open(device, 'c');
+ bdp->rfp = bno_dump_open(dip, 'r');
+ bdp->wfp = bno_dump_open(dip, 'w');
+ bdp->cfp = bno_dump_open(dip, 'c');
return bdp;
}