[PATCH] strace: Add support for block ioctls

Dmitry V. Levin ldv at altlinux.org
Mon Nov 30 21:32:37 UTC 2009


On Mon, Nov 30, 2009 at 03:50:19PM -0500, Jeff Mahoney wrote:
> This patch adds support for blkdev_ioctl()-handled ioctls.

I have a couple of questions about your patch.

> [...]
> --- /dev/null
> +++ b/block.c
> @@ -0,0 +1,221 @@
> +#include "defs.h"
> +#ifdef LINUX
> +#include <stdint.h>
> +#include <linux/blkpg.h>
> +#include <linux/fs.h>
> +#include <linux/hdreg.h>
> +#include <linux/blktrace_api.h>

Are you sure that every linux system provides these header files?

> [...]
> +static void
> +print_blkpg_req(struct tcb *tcp, struct blkpg_ioctl_arg *blkpg)
> +{
> +	struct blkpg_partition p;
> +	if (!(blkpg->op == BLKPG_ADD_PARTITION ||
> +	      blkpg->op == BLKPG_DEL_PARTITION)) {
> +		tprintf("{%d, <invalid>", blkpg->op);
> +		return;
> +	}
> +
> +	tprintf("{%s, ", blkpg->op == BLKPG_ADD_PARTITION ?
> +		"BLKPG_ADD_PARTITION" : "BLKPG_DEL_PARTITION");
> +	tprintf("flags=%d, datalen=%d, ", blkpg->flags, blkpg->datalen);

Please define an xlat structure and use xlookup() instead of these
comparisons.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20091201/85bf0a3d/attachment.bin>


More information about the Strace-devel mailing list