container_of: add container_off_var macro
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 12 Dec 2011 03:20:05 +0000 (13:50 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 12 Dec 2011 03:20:05 +0000 (13:50 +1030)
commit87f505a56eae7ef2a03a76b5b412d6bc46c58aae
treee5ddbcaf064fd242b700d0e47f6120035f730974
parent56023cca5f66a40646a1e807c3d10af6e5913623
container_of: add container_off_var macro

Based on patch by Andrey Smirnov <andrew.smirnov@gmail.com>:

    There is are certain use-cases when it is necessary to know the offset
    of the member in a structure's memory layout. One such use-case can be
    seen in `ccan/list/list.h' in macros `list_for_each' and
    `list_for_each_safe'. This commit implements said functionality with
    `container_of_var_off' macro.

Renamed container_of_var_off -> container_off_var now we have container_off.
ccan/container_of/container_of.h
ccan/container_of/test/run.c