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

Function clone_name

dpdk/lib/graph/graph_private.h:149–170  ·  view source on GitHub ↗

Node and graph common functions */ * @internal * * Naming a cloned graph or node by appending a string to base name. * * @param new_name * Pointer to the name of the cloned object. * @param base_name * Pointer to the name of original object. * @param append_str * Pointer to the appended string. * * @return * 0 on success, negative errno value otherwise. */

Source from the content-addressed store, hash-verified

147 * 0 on success, negative errno value otherwise.
148 */
149static inline int clone_name(char *new_name, char *base_name, const char *append_str)
150{
151 ssize_t sz, rc;
152
153#define SZ RTE_MIN(RTE_NODE_NAMESIZE, RTE_GRAPH_NAMESIZE)
154 rc = rte_strscpy(new_name, base_name, SZ);
155 if (rc < 0)
156 goto fail;
157 sz = rc;
158 rc = rte_strscpy(new_name + sz, "-", RTE_MAX((int16_t)(SZ - sz), 0));
159 if (rc < 0)
160 goto fail;
161 sz += rc;
162 sz = rte_strscpy(new_name + sz, append_str, RTE_MAX((int16_t)(SZ - sz), 0));
163 if (sz < 0)
164 goto fail;
165
166 return 0;
167fail:
168 rte_errno = E2BIG;
169 return -rte_errno;
170}
171
172/* Node functions */
173STAILQ_HEAD(node_head, node);

Callers 2

node_cloneFunction · 0.85
graph_cloneFunction · 0.85

Calls 1

rte_strscpyFunction · 0.85

Tested by

no test coverage detected