• J
    RDMA/cm: Use IBA functions for complex structure members · 4ca662a3
    Jason Gunthorpe 提交于
    Use a Coccinelle spatch to replace CM structure members used as
    structures, arrays, or pointers with IBA_GET/SET versions. Applied with
    
    $ spatch --sp-file edits.sp --in-place drivers/infiniband/core/cm.c
    
    The spatch file was generated using the template pattern:
    
    @@
    expression src;
    expression len;
    {struct} *msg;
    @@
    - memcpy(msg->{old_name}, src, len)
    + IBA_SET_MEM({new_name}, msg, src, len)
    @@
    {struct} *msg;
    identifier x;
    @@
    - msg->{old_name}.x
    + IBA_GET_MEM_PTR({new_name}, msg)->x
    @@
    {struct} *msg;
    @@
    - &msg->{old_name}
    + IBA_GET_MEM_PTR({new_name}, msg)
    
    For GIDs:
    @@
    {struct} *msg;
    @@
    - msg->{old_name}
    + *IBA_GET_MEM_PTR({new_name}, msg)
    
    For non-GIDs:
    @@
    {struct} *msg;
    @@
    - msg->{old_name}
    + IBA_GET_MEM_PTR({new_name}, msg)
    
    Iterated for every remaining IBA_CHECK_OFF()/IBA_CHECK_GET()
    pairing. Touched up with clang-format after.
    
    Link: https://lore.kernel.org/r/20200116170037.30109-7-jgg@ziepe.caTested-by: NLeon Romanovsky <leonro@mellanox.com>
    Reviewed-by: NLeon Romanovsky <leonro@mellanox.com>
    Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
    4ca662a3
cm.c 130.4 KB