Lines Matching refs:attr
296 struct uverbs_attr_spec attr; member
493 .attr = { .type = UVERBS_ATTR_TYPE_IDRS_ARRAY, \
509 .attr = { .type = UVERBS_ATTR_TYPE_IDR, \
519 .attr = { .type = UVERBS_ATTR_TYPE_FD, \
527 .attr = { .type = UVERBS_ATTR_TYPE_PTR_IN, \
534 .attr = { .type = UVERBS_ATTR_TYPE_PTR_OUT, \
542 .attr = { .type = UVERBS_ATTR_TYPE_ENUM_IN, \
671 const struct uverbs_attr *attr = uverbs_attr_get(attrs_bundle, idx); in uverbs_attr_get_enum_id() local
673 if (IS_ERR(attr)) in uverbs_attr_get_enum_id()
674 return PTR_ERR(attr); in uverbs_attr_get_enum_id()
676 return attr->ptr_attr.enum_id; in uverbs_attr_get_enum_id()
682 const struct uverbs_attr *attr; in uverbs_attr_get_obj() local
684 attr = uverbs_attr_get(attrs_bundle, idx); in uverbs_attr_get_obj()
685 if (IS_ERR(attr)) in uverbs_attr_get_obj()
686 return ERR_CAST(attr); in uverbs_attr_get_obj()
688 return attr->obj_attr.uobject->object; in uverbs_attr_get_obj()
694 const struct uverbs_attr *attr = uverbs_attr_get(attrs_bundle, idx); in uverbs_attr_get_uobject() local
696 if (IS_ERR(attr)) in uverbs_attr_get_uobject()
697 return ERR_CAST(attr); in uverbs_attr_get_uobject()
699 return attr->obj_attr.uobject; in uverbs_attr_get_uobject()
705 const struct uverbs_attr *attr = uverbs_attr_get(attrs_bundle, idx); in uverbs_attr_get_len() local
707 if (IS_ERR(attr)) in uverbs_attr_get_len()
708 return PTR_ERR(attr); in uverbs_attr_get_len()
710 return attr->ptr_attr.len; in uverbs_attr_get_len()
750 const struct uverbs_attr *attr = in uverbs_attr_get_uobjs_arr() local
753 if (IS_ERR(attr)) { in uverbs_attr_get_uobjs_arr()
758 *arr = attr->objs_arr_attr.uobjects; in uverbs_attr_get_uobjs_arr()
760 return attr->objs_arr_attr.len; in uverbs_attr_get_uobjs_arr()
763 static inline bool uverbs_attr_ptr_is_inline(const struct uverbs_attr *attr) in uverbs_attr_ptr_is_inline() argument
765 return attr->ptr_attr.len <= sizeof(attr->ptr_attr.data); in uverbs_attr_ptr_is_inline()
771 const struct uverbs_attr *attr = uverbs_attr_get(attrs_bundle, idx); in uverbs_attr_get_alloced_ptr() local
773 if (IS_ERR(attr)) in uverbs_attr_get_alloced_ptr()
774 return (void *)attr; in uverbs_attr_get_alloced_ptr()
776 return uverbs_attr_ptr_is_inline(attr) ? (void *)&attr->ptr_attr.data : in uverbs_attr_get_alloced_ptr()
777 attr->ptr_attr.ptr; in uverbs_attr_get_alloced_ptr()
785 const struct uverbs_attr *attr = uverbs_attr_get(attrs_bundle, idx); in _uverbs_copy_from() local
787 if (IS_ERR(attr)) in _uverbs_copy_from()
788 return PTR_ERR(attr); in _uverbs_copy_from()
795 if (unlikely(size < attr->ptr_attr.len)) in _uverbs_copy_from()
798 if (uverbs_attr_ptr_is_inline(attr)) in _uverbs_copy_from()
799 memcpy(to, &attr->ptr_attr.data, attr->ptr_attr.len); in _uverbs_copy_from()
800 else if (copy_from_user(to, u64_to_user_ptr(attr->ptr_attr.data), in _uverbs_copy_from()
801 attr->ptr_attr.len)) in _uverbs_copy_from()
812 const struct uverbs_attr *attr = uverbs_attr_get(attrs_bundle, idx); in _uverbs_copy_from_or_zero() local
815 if (IS_ERR(attr)) in _uverbs_copy_from_or_zero()
816 return PTR_ERR(attr); in _uverbs_copy_from_or_zero()
818 min_size = min_t(size_t, size, attr->ptr_attr.len); in _uverbs_copy_from_or_zero()
820 if (uverbs_attr_ptr_is_inline(attr)) in _uverbs_copy_from_or_zero()
821 memcpy(to, &attr->ptr_attr.data, min_size); in _uverbs_copy_from_or_zero()
822 else if (copy_from_user(to, u64_to_user_ptr(attr->ptr_attr.data), in _uverbs_copy_from_or_zero()