_object_id)[] = { __VA_ARGS__ }; \
const struct uverbs_object_def UVERBS_OBJECT(_object_id) = { \
.id = _object_id, \
- .type_attrs = _type_attrs, \
+ .type_attrs = &_type_attrs, \
.num_methods = ARRAY_SIZE(UVERBS_OBJECT_METHODS(_object_id)), \
.methods = &UVERBS_OBJECT_METHODS(_object_id) \
}
-#define DECLARE_UVERBS_GLOBAL_METHODS(_name, ...) \
- DECLARE_UVERBS_NAMED_OBJECT(_name, NULL, ##__VA_ARGS__)
+/*
+ * Declare global methods. These still have a unique object_id because we
+ * identify all uapi methods with a (object,method) tuple. However, they have
+ * no type pointer.
+ */
+#define DECLARE_UVERBS_GLOBAL_METHODS(_object_id, ...) \
+ static const struct uverbs_method_def *const UVERBS_OBJECT_METHODS( \
+ _object_id)[] = { __VA_ARGS__ }; \
+ const struct uverbs_object_def UVERBS_OBJECT(_object_id) = { \
+ .id = _object_id, \
+ .num_methods = ARRAY_SIZE(UVERBS_OBJECT_METHODS(_object_id)), \
+ .methods = &UVERBS_OBJECT_METHODS(_object_id) \
+ }
-/* Used by drivers to declare a complete parsing tree for a single method that
- * differs only in having additional driver specific attributes.
+/* Used by drivers to declare a complete parsing tree for new methods
*/
-#define ADD_UVERBS_ATTRIBUTES_SIMPLE(_name, _object_id, _method_id, ...) \
- static const struct uverbs_attr_def *const UVERBS_METHOD_ATTRS( \
- _method_id)[] = { __VA_ARGS__ }; \
- static const struct uverbs_method_def UVERBS_METHOD(_method_id) = { \
- .id = _method_id, \
- .num_attrs = ARRAY_SIZE(UVERBS_METHOD_ATTRS(_method_id)), \
- .attrs = &UVERBS_METHOD_ATTRS(_method_id), \
- }; \
+#define ADD_UVERBS_METHODS(_name, _object_id, ...) \
static const struct uverbs_method_def *const UVERBS_OBJECT_METHODS( \
- _object_id)[] = { &UVERBS_METHOD(_method_id) }; \
+ _object_id)[] = { __VA_ARGS__ }; \
static const struct uverbs_object_def _name##_struct = { \
.id = _object_id, \
- .num_methods = 1, \
+ .num_methods = ARRAY_SIZE(UVERBS_OBJECT_METHODS(_object_id)), \
.methods = &UVERBS_OBJECT_METHODS(_object_id) \
}; \
static const struct uverbs_object_def *const _name##_ptrs[] = { \
.objects = &_name##_ptrs, \
}
+/* Used by drivers to declare a complete parsing tree for a single method that
+ * differs only in having additional driver specific attributes.
+ */
+#define ADD_UVERBS_ATTRIBUTES_SIMPLE(_name, _object_id, _method_id, ...) \
+ static const struct uverbs_attr_def *const UVERBS_METHOD_ATTRS( \
+ _method_id)[] = { __VA_ARGS__ }; \
+ static const struct uverbs_method_def UVERBS_METHOD(_method_id) = { \
+ .id = _method_id, \
+ .num_attrs = ARRAY_SIZE(UVERBS_METHOD_ATTRS(_method_id)), \
+ .attrs = &UVERBS_METHOD_ATTRS(_method_id), \
+ }; \
+ ADD_UVERBS_METHODS(_name, _object_id, &UVERBS_METHOD(_method_id))
+
#endif