RDMA/uverbs: Add UVERBS_ATTR_CONST_IN to the specs language
authorMark Bloch <markb@mellanox.com>
Tue, 28 Aug 2018 11:18:50 +0000 (14:18 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Wed, 5 Sep 2018 21:14:58 +0000 (15:14 -0600)
commit0953fffec9ba022f63bfe01e86427530d8320d5c
tree18aa2c84c4673ee52bdd619292e48692109da844
parent50acec06f3928fc29647aecf1270e54cae583afb
RDMA/uverbs: Add UVERBS_ATTR_CONST_IN to the specs language

This makes it clear and safe to access constants passed in from user
space. We define a consistent ABI of u64 for all constants, and verify
that the data passed in can be represented by the type the user supplies.

The expectation is this will always be used with an enum declaring the
constant values, and the user will use the enum type as input to the
accessor.

To retrieve the attribute value we introduce two helper calls - one
standard which may fail if attribute is not valid and one where caller can
provide a default value which will be used in case the attribute is not
valid (useful when attribute is optional).

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Ariel Levkovich <lariel@mellanox.com>
Signed-off-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
drivers/infiniband/core/uverbs_ioctl.c
include/rdma/uverbs_ioctl.h