X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fkvargs%2Frte_kvargs.h;h=359a9f5b091c6cdfe073b0fc52f49f7b978e4955;hb=6d72dce7ed683fe0f9d8670edddb381eb20184b0;hp=328f0d3cc6a31b18e5ace4b889674e7ff5629b61;hpb=b36d02ab394c4ab230af2c61ace424f6ec2ca74b;p=dpdk.git diff --git a/lib/kvargs/rte_kvargs.h b/lib/kvargs/rte_kvargs.h index 328f0d3cc6..359a9f5b09 100644 --- a/lib/kvargs/rte_kvargs.h +++ b/lib/kvargs/rte_kvargs.h @@ -116,7 +116,7 @@ void rte_kvargs_free(struct rte_kvargs *kvlist); /** * Get the value associated with a given key. * - * If multiple key matches, the value of the first one is returned. + * If multiple keys match, the value of the first one is returned. * * The memory returned is allocated as part of the rte_kvargs structure, * it must never be modified. @@ -125,13 +125,40 @@ void rte_kvargs_free(struct rte_kvargs *kvlist); * A list of rte_kvargs pair of 'key=value'. * @param key * The matching key. - + * * @return * NULL if no key matches the input, * a value associated with a matching key otherwise. */ const char *rte_kvargs_get(const struct rte_kvargs *kvlist, const char *key); +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Get the value associated with a given key and value. + * + * Find the first entry in the kvlist whose key and value match the + * ones passed as argument. + * + * The memory returned is allocated as part of the rte_kvargs structure, + * it must never be modified. + * + * @param kvlist + * A list of rte_kvargs pair of 'key=value'. + * @param key + * The matching key. If NULL, any key will match. + * @param value + * The matching value. If NULL, any value will match. + * + * @return + * NULL if no key matches the input, + * a value associated with a matching key otherwise. + */ +__rte_experimental +const char *rte_kvargs_get_with_value(const struct rte_kvargs *kvlist, + const char *key, const char *value); + /** * Call a handler function for each key/value matching the key * @@ -163,39 +190,13 @@ int rte_kvargs_process(const struct rte_kvargs *kvlist, * The rte_kvargs structure * @param key_match * The key that should match, or NULL to count all associations - + * * @return * The number of entries */ unsigned rte_kvargs_count(const struct rte_kvargs *kvlist, const char *key_match); -/** - * Generic kvarg handler for string comparison. - * - * This function can be used for a generic string comparison processing - * on a list of kvargs. - * - * @param key - * kvarg pair key. - * - * @param value - * kvarg pair value. - * - * @param opaque - * Opaque pointer to a string. - * - * @return - * 0 if the strings match. - * !0 otherwise or on error. - * - * Unlike strcmp, comparison ordering is not kept. - * In order for rte_kvargs_process to stop processing on match error, - * a negative value is returned even if strcmp had returned a positive one. - */ -__rte_experimental -int rte_kvargs_strcmp(const char *key, const char *value, void *opaque); - #ifdef __cplusplus } #endif