]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - include/net/genetlink.h
Merge tag 'mmc-v4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
[karo-tx-linux.git] / include / net / genetlink.h
index a34275be360001e89740fe4325a53905683e9778..68b88192b00c6200aa0b8b2628554952d0d79a1c 100644 (file)
@@ -84,6 +84,7 @@ struct nlattr **genl_family_attrbuf(const struct genl_family *family);
  * @attrs: netlink attributes
  * @_net: network namespace
  * @user_ptr: user pointers
+ * @extack: extended ACK report struct
  */
 struct genl_info {
        u32                     snd_seq;
@@ -94,6 +95,7 @@ struct genl_info {
        struct nlattr **        attrs;
        possible_net_t          _net;
        void *                  user_ptr[2];
+       struct netlink_ext_ack *extack;
 };
 
 static inline struct net *genl_info_net(struct genl_info *info)
@@ -106,6 +108,16 @@ static inline void genl_info_net_set(struct genl_info *info, struct net *net)
        write_pnet(&info->_net, net);
 }
 
+#define GENL_SET_ERR_MSG(info, msg) NL_SET_ERR_MSG((info)->extack, msg)
+
+static inline int genl_err_attr(struct genl_info *info, int err,
+                               struct nlattr *attr)
+{
+       info->extack->bad_attr = attr;
+
+       return err;
+}
+
 /**
  * struct genl_ops - generic netlink operations
  * @cmd: command identifier
@@ -162,14 +174,16 @@ genlmsg_nlhdr(void *user_hdr, const struct genl_family *family)
  * @tb: destination array with maxtype+1 elements
  * @maxtype: maximum attribute type to be expected
  * @policy: validation policy
- * */
+ * @extack: extended ACK report struct
+ */
 static inline int genlmsg_parse(const struct nlmsghdr *nlh,
                                const struct genl_family *family,
                                struct nlattr *tb[], int maxtype,
-                               const struct nla_policy *policy)
+                               const struct nla_policy *policy,
+                               struct netlink_ext_ack *extack)
 {
        return nlmsg_parse(nlh, family->hdrsize + GENL_HDRLEN, tb, maxtype,
-                          policy);
+                          policy, extack);
 }
 
 /**