public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Tarun Sahu <tsahu@linux.ibm.com>
Cc: sbhat@linux.ibm.com, aneesh.kumar@linux.ibm.com,
	geetika@linux.ibm.com, vaibhav@linux.ibm.com, ltp@lists.linux.it,
	mike.kravetz@oracle.com
Subject: Re: [LTP] [PATCH v2 1/5] Hugetlb: Migrating libhugetlbfs counters
Date: Mon, 14 Nov 2022 10:49:28 +0100	[thread overview]
Message-ID: <Y3IPKK4/RYc4DqF6@yuki> (raw)
In-Reply-To: <20221113184438.tmcepansvefom5bk@tarunpc>

Hi!
> > I guess that we can also put the map() (touch()) test_counters() unamp()
> > sequence to a do_test() fuction then call it from the for() loop in
> > run_test(). That would make the code a bit cleaner.
> > 
> Instead, I am thinking of a defining a macro like this, 
> 
> #define CHECK_(fun) ({			\
> 		if (fun) {					\
> 				break;				\
> 			}						\
> 		})
> 
> inside test_counters:
> 
> do {
> 	CHECK_(map(...));
> 	CHECK_(touch(...));
> 	CHECK_(unmap(...));
> } while(0)
> 
> inside for loop of run_test:
> 
> CHECK_(map(...));
> CHECK_(test_counters(...));
> CHECK_(unmap(...));

While this is much better than longjmp() it still obscures the codeflow
a little bit.

Also I do not think that we need all the braces in the CHECK() macro, it
should be enough just to do:

#define CHECK(fun) \
	if (fun) \
		break;

or even:

#define CHECK(fun) if (fun) break;

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2022-11-14  9:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08 19:52 [LTP] [PATCH v2 0/5][PART 2] Hugetlb:Migrating the libhugetlbfs tests Tarun Sahu
2022-11-08 19:52 ` [LTP] [PATCH v2 1/5] Hugetlb: Migrating libhugetlbfs counters Tarun Sahu
2022-11-09 13:12   ` Cyril Hrubis
2022-11-09 21:26     ` Tarun Sahu
2022-11-10  8:20       ` Cyril Hrubis
2022-11-13 18:44         ` Tarun Sahu
2022-11-13 19:03           ` Tarun Sahu
2022-11-14  9:49           ` Cyril Hrubis [this message]
2022-11-14 18:51             ` Tarun Sahu
2022-11-08 19:52 ` [LTP] [PATCH v2 2/5] Hugetlb: Migrating libhugetlbfs directio Tarun Sahu
2022-11-09 13:25   ` Cyril Hrubis
2022-11-09 18:09     ` Tarun Sahu
2022-11-08 19:52 ` [LTP] [PATCH v2 3/5] Hugetlb: Migrating libhugetlbfs fadvise_reserve Tarun Sahu
2022-11-09 16:18   ` Cyril Hrubis
2022-11-09 18:40     ` Tarun Sahu
2022-11-10  7:34       ` Cyril Hrubis
2022-11-08 19:52 ` [LTP] [PATCH v2 4/5] Hugetlb: Migrating libhugetlbfs fallocate_align Tarun Sahu
2022-11-08 19:52 ` [LTP] [PATCH v2 5/5] Hugetlb: Migrating libhugetlbfs fallocate_basic Tarun Sahu

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=Y3IPKK4/RYc4DqF6@yuki \
    --to=chrubis@suse.cz \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=geetika@linux.ibm.com \
    --cc=ltp@lists.linux.it \
    --cc=mike.kravetz@oracle.com \
    --cc=sbhat@linux.ibm.com \
    --cc=tsahu@linux.ibm.com \
    --cc=vaibhav@linux.ibm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox