Skip to content

Commit

Permalink
RDMA/uverbs: Replace ib_uverbs_file with uverbs_attr_bundle for write
Browse files Browse the repository at this point in the history
Now that we can add meta-data to the description of write() methods we
need to pass the uverbs_attr_bundle into all write based handlers so
future patches can use it as a container for any new data transferred out
of the core.

This is the first step to bringing the write() and ioctl() methods to a
common interface signature.

This is a simple search/replace, and we push the attr down into the uobj
and other APIs to keep changes minimal.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
  • Loading branch information
Jason Gunthorpe committed Nov 26, 2018
1 parent 1b09577 commit 8313c10
Show file tree
Hide file tree
Showing 9 changed files with 208 additions and 192 deletions.
13 changes: 8 additions & 5 deletions drivers/infiniband/core/rdma_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,14 @@ int uobj_destroy(struct ib_uobject *uobj)
* uverbs_put_destroy.
*/
struct ib_uobject *__uobj_get_destroy(const struct uverbs_api_object *obj,
u32 id, struct ib_uverbs_file *ufile)
u32 id,
const struct uverbs_attr_bundle *attrs)
{
struct ib_uobject *uobj;
int ret;

uobj = rdma_lookup_get_uobject(obj, ufile, id, UVERBS_LOOKUP_DESTROY);
uobj = rdma_lookup_get_uobject(obj, attrs->ufile, id,
UVERBS_LOOKUP_DESTROY);
if (IS_ERR(uobj))
return uobj;

Expand All @@ -248,11 +250,12 @@ struct ib_uobject *__uobj_get_destroy(const struct uverbs_api_object *obj,
* the uobj.
*/
int __uobj_perform_destroy(const struct uverbs_api_object *obj, u32 id,
struct ib_uverbs_file *ufile, int success_res)
const struct uverbs_attr_bundle *attrs,
int success_res)
{
struct ib_uobject *uobj;

uobj = __uobj_get_destroy(obj, id, ufile);
uobj = __uobj_get_destroy(obj, id, attrs);
if (IS_ERR(uobj))
return PTR_ERR(uobj);

Expand All @@ -267,7 +270,7 @@ static struct ib_uobject *alloc_uobj(struct ib_uverbs_file *ufile,
struct ib_uobject *uobj;
struct ib_ucontext *ucontext;

ucontext = ib_uverbs_get_ucontext(ufile);
ucontext = ib_uverbs_get_ucontext_file(ufile);
if (IS_ERR(ucontext))
return ERR_CAST(ucontext);

Expand Down
8 changes: 4 additions & 4 deletions drivers/infiniband/core/rdma_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ struct uverbs_api_ioctl_method {
};

struct uverbs_api_write_method {
ssize_t (*handler)(struct ib_uverbs_file *file, const char __user *buf,
int in_len, int out_len);
int (*handler_ex)(struct ib_uverbs_file *file, struct ib_udata *ucore,
struct ib_udata *uhw);
ssize_t (*handler)(struct uverbs_attr_bundle *attrs,
const char __user *buf, int in_len, int out_len);
int (*handler_ex)(struct uverbs_attr_bundle *attrs,
struct ib_udata *ucore, struct ib_udata *uhw);
u8 disabled:1;
u8 is_ex:1;
};
Expand Down
Loading

0 comments on commit 8313c10

Please sign in to comment.