Merge tag 'perf-core-2023-04-27' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-block.git] / include / linux / netlink.h
index c43ac7690eca1bc8f945d39d4c5de806856b0bc2..19c0791ed9d56f1b6ffe5d1bde79b3332de77f51 100644 (file)
@@ -50,7 +50,6 @@ struct netlink_kernel_cfg {
        struct mutex    *cb_mutex;
        int             (*bind)(struct net *net, int group);
        void            (*unbind)(struct net *net, int group);
-       bool            (*compare)(struct net *net, struct sock *sk);
 };
 
 struct sock *__netlink_kernel_create(struct net *net, int unit,
@@ -162,9 +161,31 @@ struct netlink_ext_ack {
        }                                                       \
 } while (0)
 
+#define NL_SET_ERR_MSG_ATTR_POL_FMT(extack, attr, pol, fmt, args...) do {      \
+       struct netlink_ext_ack *__extack = (extack);                            \
+                                                                               \
+       if (!__extack)                                                          \
+               break;                                                          \
+                                                                               \
+       if (snprintf(__extack->_msg_buf, NETLINK_MAX_FMTMSG_LEN,                \
+                    "%s" fmt "%s", "", ##args, "") >=                          \
+           NETLINK_MAX_FMTMSG_LEN)                                             \
+               net_warn_ratelimited("%s" fmt "%s", "truncated extack: ",       \
+                                    ##args, "\n");                             \
+                                                                               \
+       do_trace_netlink_extack(__extack->_msg_buf);                            \
+                                                                               \
+       __extack->_msg = __extack->_msg_buf;                                    \
+       __extack->bad_attr = (attr);                                            \
+       __extack->policy = (pol);                                               \
+} while (0)
+
 #define NL_SET_ERR_MSG_ATTR(extack, attr, msg)         \
        NL_SET_ERR_MSG_ATTR_POL(extack, attr, NULL, msg)
 
+#define NL_SET_ERR_MSG_ATTR_FMT(extack, attr, msg, args...) \
+       NL_SET_ERR_MSG_ATTR_POL_FMT(extack, attr, NULL, msg, ##args)
+
 #define NL_SET_ERR_ATTR_MISS(extack, nest, type)  do { \
        struct netlink_ext_ack *__extack = (extack);    \
                                                        \