[PATCH 2/3] backports: add backport for genl_family_attrbuf() function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The function genl_family_attrbuf() was added to the kernel. This
backport caries the warning for parallel ops, but it does not
assert the genl_mutex as it does not have access to it.

Signed-off-by: Arend van Spriel <arend.vanspriel@xxxxxxxxxxxx>
---
 backport/backport-include/net/genetlink.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/backport/backport-include/net/genetlink.h b/backport/backport-include/net/genetlink.h
index cf3e67c..f81b825 100644
--- a/backport/backport-include/net/genetlink.h
+++ b/backport/backport-include/net/genetlink.h
@@ -158,4 +158,24 @@ backport_genlmsg_multicast_allns(struct genl_family *family,
 #define GENL_UNS_ADMIN_PERM	GENL_ADMIN_PERM
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)
+/**
+ * genl_family_attrbuf - return family's attrbuf
+ * @family: the family
+ *
+ * Return the family's attrbuf, while validating that it's
+ * actually valid to access it.
+ *
+ * You cannot use this function with a family that has parallel_ops
+ * and you can only use it within (pre/post) doit/dumpit callbacks.
+ */
+#define genl_family_attrbuf LINUX_BACKPORT(genl_family_attrbuf)
+static inline struct nlattr **genl_family_attrbuf(struct genl_family *family)
+{
+	WARN_ON(family->parallel_ops);
+
+	return family->attrbuf;
+}
+#endif
+
 #endif /* __BACKPORT_NET_GENETLINK_H */
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux