[LTP] [PATCH v2 1/5] Hugetlb: Migrating libhugetlbfs counters

Tarun Sahu tsahu@linux.ibm.com
Sun Nov 13 20:03:32 CET 2022


On Nov 14 2022, Tarun Sahu wrote:
> > 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(...));
> 
Code will be as clean as the previous, if we can just add
CHECK_ in map, unmap, touch macro definition. like..

#define map(a,b,c,d) CHECK_(map_(a, b, c, d))
> > -- 
> > Cyril Hrubis
> > chrubis@suse.cz
> > 
> > -- 
> > Mailing list info: https://lists.linux.it/listinfo/ltp
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp


More information about the ltp mailing list