linux/include/rdma/uverbs_std_types.h

/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
/*
 * Copyright (c) 2017, Mellanox Technologies inc.  All rights reserved.
 */

#ifndef _UVERBS_STD_TYPES__
#define _UVERBS_STD_TYPES__

#include <rdma/uverbs_types.h>
#include <rdma/uverbs_ioctl.h>
#include <rdma/ib_user_ioctl_verbs.h>

/* Returns _id, or causes a compile error if _id is not a u32.
 *
 * The uobj APIs should only be used with the write based uAPI to access
 * object IDs. The write API must use a u32 for the object handle, which is
 * checked by this macro.
 */
#define _uobj_check_id(_id)

#define uobj_get_type(_attrs, _object)

#define uobj_get_read(_type, _id, _attrs)

#define ufd_get_read(_type, _fdnum, _attrs)

static inline void *_uobj_get_obj_read(struct ib_uobject *uobj)
{}
#define uobj_get_obj_read(_object, _type, _id, _attrs)

#define uobj_get_write(_type, _id, _attrs)

int __uobj_perform_destroy(const struct uverbs_api_object *obj, u32 id,
			   struct uverbs_attr_bundle *attrs);
#define uobj_perform_destroy(_type, _id, _attrs)

struct ib_uobject *__uobj_get_destroy(const struct uverbs_api_object *obj,
				      u32 id, struct uverbs_attr_bundle *attrs);

#define uobj_get_destroy(_type, _id, _attrs)

static inline void uobj_put_destroy(struct ib_uobject *uobj)
{}

static inline void uobj_put_read(struct ib_uobject *uobj)
{}

#define uobj_put_obj_read(_obj)

static inline void uobj_put_write(struct ib_uobject *uobj)
{}

static inline void uobj_alloc_abort(struct ib_uobject *uobj,
				    struct uverbs_attr_bundle *attrs)
{}

static inline void uobj_finalize_uobj_create(struct ib_uobject *uobj,
					     struct uverbs_attr_bundle *attrs)
{}

static inline struct ib_uobject *
__uobj_alloc(const struct uverbs_api_object *obj,
	     struct uverbs_attr_bundle *attrs, struct ib_device **ib_dev)
{}

#define uobj_alloc(_type, _attrs, _ib_dev)

static inline void uverbs_flow_action_fill_action(struct ib_flow_action *action,
						  struct ib_uobject *uobj,
						  struct ib_device *ib_dev,
						  enum ib_flow_action_type type)
{}

struct ib_uflow_resources {};

struct ib_uflow_object {};

struct ib_uflow_resources *flow_resources_alloc(size_t num_specs);
void flow_resources_add(struct ib_uflow_resources *uflow_res,
			enum ib_flow_spec_type type,
			void *ibobj);
void ib_uverbs_flow_resources_free(struct ib_uflow_resources *uflow_res);

static inline void ib_set_flow(struct ib_uobject *uobj, struct ib_flow *ibflow,
			       struct ib_qp *qp, struct ib_device *device,
			       struct ib_uflow_resources *uflow_res)
{}

struct uverbs_api_object {};

static inline u32 uobj_get_object_id(struct ib_uobject *uobj)
{}

#endif