X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fust-field-utils.c;h=cef0261564c9034beef23846bd9d23b1521e4144;hb=0e7b45661dabc88c533f4f322615217410ce68db;hp=954581d3ce85cf6dfdfb3c53fa06bd82f6865c20;hpb=3fd9c5c21dc94a9182065664e19fc0d4dd5ead71;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/ust-field-utils.c b/src/bin/lttng-sessiond/ust-field-utils.c index 954581d3c..cef026156 100644 --- a/src/bin/lttng-sessiond/ust-field-utils.c +++ b/src/bin/lttng-sessiond/ust-field-utils.c @@ -278,3 +278,33 @@ int match_ustctl_field(const struct ustctl_field *first, no_match: return false; } + +/* + * Compare two arrays of UST fields. + * Return true if both arrays have identical field definitions, false otherwise. + */ +bool match_lttng_ust_ctl_field_array(const struct ustctl_field *first, + size_t nr_first, + const struct ustctl_field *second, + size_t nr_second) +{ + size_t i; + const size_t nr_fields = nr_first; + + /* Compare the array lengths. */ + if (nr_first != nr_second) { + goto no_match; + } + + /* Compare each field individually. */ + for (i = 0; i < nr_fields; i++) { + if (!match_ustctl_field(&first[i], &second[i])) { + goto no_match; + } + } + + return true; + +no_match: + return false; +}