All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
To: strace development list
	<strace-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Cc: dm-devel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Subject: Re: [PATCH] device mapper support for strace
Date: Thu, 13 Aug 2015 03:05:02 -0400	[thread overview]
Message-ID: <20150813070502.GD25069@vapier> (raw)
In-Reply-To: <alpine.LRH.2.02.1508111310290.20408-Hpncn10jQN4oNljnaZt3ZvA+iT7yCHsGwRM8/txMwJMAicBL8TP8PQ@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 1947 bytes --]

On 11 Aug 2015 13:11, Mikulas Patocka wrote:
> --- /dev/null
> +++ strace/dm.c
> @@ -0,0 +1,354 @@
> +#include "defs.h"

all files should have a comment block at the top.  see mtd.c as an example.

> +{
> +	switch (code) {
> +		case DM_REMOVE_ALL:

case statements should be at the same indent level as the switch.  see mtd.c.

> +	size_t offset = ioc->data_start;

data_start is a __u32, so this should be uint32_t instead of size_t

> +			tprintf(", {sector_start=%llu, length=%llu",
> +				(unsigned long long)s->sector_start,
> +				(unsigned long long)s->length);

sector_start/length are uint64_t, not unsigned long long.  please use PRIu64 
defines from inttypes.h instead of random casts.  you can find plenty of 
examples in the tree already.

> +			if (!entering(tcp))
> +				tprintf(", status=%d", (int)s->status);

status is int32_t, not int, so please use PRId32 instead of int casts.

> +static void
> +dm_decode_dm_target_deps(const struct dm_ioctl *ioc, const char *extra,
> +			 size_t extra_size)
> +{
> +	size_t offset = ioc->data_start;

uint32_t, not size_t

> +	if (offset + offsetof(struct dm_target_deps, dev) >= offset &&
> +	    offset + offsetof(struct dm_target_deps, dev) <= extra_size) {
> +		uint32_t i;
> +		size_t space = (extra_size - (offset +
> +			offsetof(struct dm_target_deps, dev))) / sizeof(__u64);
> +		const struct dm_target_deps *s =
> +			(const struct dm_target_deps *)(extra + offset);
> +		if (s->count > space)
> +			goto misplaced;

count is __u32, so space should probably be uint32_t instead of size_t

> +misplaced:

it's not standard in strace, but personal preference is to put a
single space before labels to help out with diff context

> +	size_t offset = ioc->data_start;

uint32_t

> +misplaced:

add a space

looks like many of these comments apply to the rest of this file,
so i'll refrain from repeating myself
-mike

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 79 bytes --]

------------------------------------------------------------------------------

[-- Attachment #3: Type: text/plain, Size: 195 bytes --]

_______________________________________________
Strace-devel mailing list
Strace-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/strace-devel

      parent reply	other threads:[~2015-08-13  7:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-31 14:49 [PATCH] device mapper support for strace Mikulas Patocka
     [not found] ` <alpine.LRH.2.02.1507311043370.4689-Hpncn10jQN4oNljnaZt3ZvA+iT7yCHsGwRM8/txMwJMAicBL8TP8PQ@public.gmane.org>
2015-07-31 15:35   ` Dmitry V. Levin
     [not found]     ` <20150731153520.GA20404-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
2015-07-31 16:04       ` Mikulas Patocka
     [not found]         ` <alpine.LRH.2.02.1507311202320.29679-Hpncn10jQN4oNljnaZt3ZvA+iT7yCHsGwRM8/txMwJMAicBL8TP8PQ@public.gmane.org>
2015-08-01 17:54           ` Dmitry V. Levin
     [not found]             ` <20150801175400.GA3943-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
2015-08-11 17:11               ` Mikulas Patocka
     [not found]                 ` <alpine.LRH.2.02.1508111310290.20408-Hpncn10jQN4oNljnaZt3ZvA+iT7yCHsGwRM8/txMwJMAicBL8TP8PQ@public.gmane.org>
2015-08-13  7:05                   ` Mike Frysinger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150813070502.GD25069@vapier \
    --to=vapier-abrp7r+bbdudnm+yrofe0a@public.gmane.org \
    --cc=dm-devel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=strace-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.