This patch converts the blktrace facility to use the Generic Trace Setup and Control (GTSC) API. (patch to blktrace user code) Signed-off-by: Tom Zanussi Signed-off-by: David Wilder diff --git a/blktrace.c b/blktrace.c index 2ad940d..486fdc3 100644 --- a/blktrace.c +++ b/blktrace.c @@ -395,8 +395,8 @@ static int start_trace(struct device_information *dip) struct blk_user_trace_setup buts; memset(&buts, 0, sizeof(buts)); - buts.buf_size = dip->buf_size; - buts.buf_nr = dip->buf_nr; + buts.gts.buf_size = dip->buf_size; + buts.gts.buf_nr = dip->buf_nr; buts.act_mask = act_mask; if (ioctl(dip->fd, BLKTRACESETUP, &buts) < 0) { @@ -409,7 +409,7 @@ static int start_trace(struct device_information *dip) return 1; } - memcpy(dip->buts_name, buts.name, sizeof(dip->buts_name)); + memcpy(dip->buts_name, buts.gts.name, sizeof(dip->buts_name)); dip_set_tracing(dip, 1); return 0; } diff --git a/blktrace_api.h b/blktrace_api.h index 61b405a..3ff0905 100644 --- a/blktrace_api.h +++ b/blktrace_api.h @@ -107,14 +107,28 @@ struct blk_io_trace_remap { __u64 sector; }; +#define GTSC_TRACE_ROOT_NAME_SIZE 64 /* Max root dir identifier */ +#define GTSC_TRACE_NAME_SIZE 64 /* Max trace identifier */ + +/* + * User setup structure + */ +struct gtsc_trace_setup +{ + char root[GTSC_TRACE_ROOT_NAME_SIZE]; + char name[GTSC_TRACE_NAME_SIZE]; + __u32 buf_size; + __u32 buf_nr; + __u32 flags; +}; + + /* * User setup structure passed with BLKSTARTTRACE */ struct blk_user_trace_setup { - char name[32]; /* output */ + struct gtsc_trace_setup gts; /* input */ __u16 act_mask; /* input */ - __u32 buf_size; /* input */ - __u32 buf_nr; /* input */ __u64 start_lba; __u64 end_lba; __u32 pid;