summaryrefslogtreecommitdiffstats
path: root/include/netlink/object-api.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/netlink/object-api.h')
-rw-r--r--include/netlink/object-api.h26
1 files changed, 17 insertions, 9 deletions
diff --git a/include/netlink/object-api.h b/include/netlink/object-api.h
index 2a32f2c..b3337f0 100644
--- a/include/netlink/object-api.h
+++ b/include/netlink/object-api.h
@@ -94,7 +94,6 @@ extern "C" {
* struct nl_dump_params *params)
* {
* struct my_obj *my_obj = nl_object_priv(obj);
- * int line = 1; // We will print at least one line for sure
*
* // It is absolutely essential to use nl_dump() when printing
* // any text to make sure the dumping parameters are respected.
@@ -102,14 +101,11 @@ extern "C" {
*
* // Before we can dump the next line, make sure to prefix
* // this line correctly.
- * nl_new_line(params, line++);
+ * nl_new_line(params);
*
* // You may also split a line into multiple nl_dump() calls.
* nl_dump(params, "String: %s ", my_obj->my_string);
* nl_dump(params, "String-2: %s\n", my_obj->another_string);
- *
- * // Return the number of lines dumped
- * return line;
* }
*
* struct nl_object_ops my_ops = {
@@ -202,7 +198,18 @@ extern "C" {
*
* @return True if the attribute is available, otherwise false is returned.
*/
-#define AVAILABLE(A, B, ATTR) (((A)->ce_mask & (B)->ce_mask) & (ATTR))
+#define AVAILABLE(A, B, ATTR) (((A)->ce_mask & (B)->ce_mask) & (ATTR))
+
+/**
+ * Return true if attribute is available in only one of both objects
+ * @arg A an object
+ * @arg B another object
+ * @arg ATTR attribute bit
+ *
+ * @return True if the attribute is available in only one of both objects,
+ * otherwise false is returned.
+ */
+#define AVAILABLE_MISMATCH(A, B, ATTR) (((A)->ce_mask ^ (B)->ce_mask) & (ATTR))
/**
* Return true if attributes mismatch
@@ -219,7 +226,8 @@ extern "C" {
*
* @return True if the attribute mismatch, or false if they match.
*/
-#define ATTR_MISMATCH(A, B, ATTR, EXPR) (!AVAILABLE(A, B, ATTR) || (EXPR))
+#define ATTR_MISMATCH(A, B, ATTR, EXPR) (AVAILABLE_MISMATCH(A, B, ATTR) || \
+ (AVAILABLE(A, B, ATTR) && (EXPR)))
/**
* Return attribute bit if attribute does not match
@@ -304,8 +312,8 @@ struct nl_object_ops
*
* The functions must return the number of lines printed.
*/
- int (*oo_dump[NL_DUMP_MAX+1])(struct nl_object *,
- struct nl_dump_params *);
+ void (*oo_dump[NL_DUMP_MAX+1])(struct nl_object *,
+ struct nl_dump_params *);
/**
* Comparison function