All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Palethorpe <rpalethorpe@suse.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3 2/7] API: Add macro for the container_of trick
Date: Mon, 26 Apr 2021 16:15:51 +0100	[thread overview]
Message-ID: <87o8e1m5zs.fsf@suse.de> (raw)
In-Reply-To: <CAEemH2ejA9kY2P4HsYEds3g9AjzFQ4mDRuWiF2176istdOMtaA@mail.gmail.com>

Hi,

Li Wang <liwang@redhat.com> writes:

> Richard Palethorpe <rpalethorpe@suse.com> wrote:
>
> Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
>>
> Reviewed-by: Li Wang <liwang@redhat.com>
>
>
>> ---
>>  include/tst_common.h | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/include/tst_common.h b/include/tst_common.h
>> index fd7a900d4..317925d1d 100644
>> --- a/include/tst_common.h
>> +++ b/include/tst_common.h
>> @@ -83,4 +83,9 @@
>>  #define TST_RES_SUPPORTS_TCONF_TFAIL_TINFO_TPASS_TWARN(condition) \
>>         TST_BUILD_BUG_ON(condition)
>>
>> +#define tst_container_of(ptr, type, member) ({              \
>> +       const typeof( ((type *)0)->member ) *__mptr = (ptr); \
>> +       (type *)( (char *)__mptr - offsetof(type,member) );  \
>> +})
>>
>
> I'd suggest defining it as uppercase 'TST_CONTAINER_OF(...)' to respect
> other macro's naming policy in tst_common.h.

I don't mind either way. I suspect it is lower case to match offsetof
and maybe it is expected to become a compiler intrinsic. Perhaps we
should remove the tst_. WDYT Cyril??

-- 
Thank you,
Richard.

  reply	other threads:[~2021-04-26 15:15 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-12 14:54 [LTP] [PATCH v3 0/7] CGroup API rewrite Richard Palethorpe
2021-04-12 14:55 ` [LTP] [PATCH v3 1/7] API: Add safe openat, printfat, readat and unlinkat Richard Palethorpe
2021-04-16  6:59   ` Li Wang
2021-04-26 15:07     ` Richard Palethorpe
2021-04-12 14:55 ` [LTP] [PATCH v3 2/7] API: Add macro for the container_of trick Richard Palethorpe
2021-04-16  7:01   ` Li Wang
2021-04-26 15:15     ` Richard Palethorpe [this message]
2021-04-27 11:03       ` Cyril Hrubis
2021-04-12 14:55 ` [LTP] [PATCH v3 3/7] Add new CGroups APIs Richard Palethorpe
2021-04-14 15:39   ` Cyril Hrubis
2021-04-15 13:10     ` Richard Palethorpe
2021-04-16  5:00       ` Li Wang
2021-04-26 16:39         ` Richard Palethorpe
2021-04-16  6:57   ` Li Wang
2021-04-26 16:01     ` Richard Palethorpe
2021-04-12 14:55 ` [LTP] [PATCH v3 4/7] Add new CGroups API library tests Richard Palethorpe
2021-04-16  7:22   ` Li Wang
2021-04-12 14:55 ` [LTP] [PATCH v3 5/7] docs: Update CGroups API Richard Palethorpe
2021-04-16  8:11   ` Li Wang
2021-04-26 16:44     ` Richard Palethorpe
2021-04-12 14:55 ` [LTP] [PATCH v3 6/7] mem: Convert tests to new " Richard Palethorpe
2021-04-12 14:55 ` [LTP] [PATCH v3 7/7] madvise06: Convert " Richard Palethorpe

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=87o8e1m5zs.fsf@suse.de \
    --to=rpalethorpe@suse.de \
    --cc=ltp@lists.linux.it \
    /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.