MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rte_flow_conv_name

Function rte_flow_conv_name

dpdk/lib/ethdev/rte_flow.c:1066–1094  ·  view source on GitHub ↗

* Retrieve the name of a pattern item/action type. * * @param is_action * Nonzero when @p src represents an action type instead of a pattern item * type. * @param is_ptr * Nonzero to write string address instead of contents into @p dst. * @param[out] dst * Destination buffer. Can be NULL if @p size is zero. * @param size * Size of @p dst in bytes. * @param[in] src * Dependi

Source from the content-addressed store, hash-verified

1064 * otherwise and rte_errno is set.
1065 */
1066static int
1067rte_flow_conv_name(int is_action,
1068 int is_ptr,
1069 char *dst,
1070 const size_t size,
1071 const void *src,
1072 struct rte_flow_error *error)
1073{
1074 struct desc_info {
1075 const struct rte_flow_desc_data *data;
1076 size_t num;
1077 };
1078 static const struct desc_info info_rep[2] = {
1079 { rte_flow_desc_item, RTE_DIM(rte_flow_desc_item), },
1080 { rte_flow_desc_action, RTE_DIM(rte_flow_desc_action), },
1081 };
1082 const struct desc_info *const info = &info_rep[!!is_action];
1083 unsigned int type = (uintptr_t)src;
1084
1085 if (type >= info->num)
1086 return rte_flow_error_set
1087 (error, EINVAL, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
1088 "unknown object type to retrieve the name of");
1089 if (!is_ptr)
1090 return strlcpy(dst, info->data[type].name, size);
1091 if (size >= sizeof(const char **))
1092 *((const char **)dst) = info->data[type].name;
1093 return sizeof(const char **);
1094}
1095
1096/** Helper function to convert flow API objects. */
1097int

Callers 1

rte_flow_convFunction · 0.85

Calls 2

rte_flow_error_setFunction · 0.85
strlcpyFunction · 0.50

Tested by

no test coverage detected