genetlink.h (c25141062a82ae8bddced1b3ce2b57a1c0efabe0) genetlink.h (0a833c29d89656025443cb9f0ebff7052dd95ce0)
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __NET_GENERIC_NETLINK_H
3#define __NET_GENERIC_NETLINK_H
4
5#include <linux/genetlink.h>
6#include <net/netlink.h>
7#include <net/net_namespace.h>
8

--- 140 unchanged lines hidden (view full) ---

149 struct genl_info *info, u32 group, gfp_t flags);
150
151void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
152 const struct genl_family *family, int flags, u8 cmd);
153
154/**
155 * genlmsg_nlhdr - Obtain netlink header from user specified header
156 * @user_hdr: user header as returned from genlmsg_put()
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __NET_GENERIC_NETLINK_H
3#define __NET_GENERIC_NETLINK_H
4
5#include <linux/genetlink.h>
6#include <net/netlink.h>
7#include <net/net_namespace.h>
8

--- 140 unchanged lines hidden (view full) ---

149 struct genl_info *info, u32 group, gfp_t flags);
150
151void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
152 const struct genl_family *family, int flags, u8 cmd);
153
154/**
155 * genlmsg_nlhdr - Obtain netlink header from user specified header
156 * @user_hdr: user header as returned from genlmsg_put()
157 * @family: generic netlink family
158 *
159 * Returns pointer to netlink header.
160 */
157 *
158 * Returns pointer to netlink header.
159 */
161static inline struct nlmsghdr *
162genlmsg_nlhdr(void *user_hdr, const struct genl_family *family)
160static inline struct nlmsghdr *genlmsg_nlhdr(void *user_hdr)
163{
164 return (struct nlmsghdr *)((char *)user_hdr -
161{
162 return (struct nlmsghdr *)((char *)user_hdr -
165 family->hdrsize -
166 GENL_HDRLEN -
167 NLMSG_HDRLEN);
168}
169
170/**
171 * genlmsg_parse - parse attributes of a genetlink message
172 * @nlh: netlink message header
173 * @family: genetlink message family

--- 11 unchanged lines hidden (view full) ---

185 return nlmsg_parse(nlh, family->hdrsize + GENL_HDRLEN, tb, maxtype,
186 policy, extack);
187}
188
189/**
190 * genl_dump_check_consistent - check if sequence is consistent and advertise if not
191 * @cb: netlink callback structure that stores the sequence number
192 * @user_hdr: user header as returned from genlmsg_put()
163 GENL_HDRLEN -
164 NLMSG_HDRLEN);
165}
166
167/**
168 * genlmsg_parse - parse attributes of a genetlink message
169 * @nlh: netlink message header
170 * @family: genetlink message family

--- 11 unchanged lines hidden (view full) ---

182 return nlmsg_parse(nlh, family->hdrsize + GENL_HDRLEN, tb, maxtype,
183 policy, extack);
184}
185
186/**
187 * genl_dump_check_consistent - check if sequence is consistent and advertise if not
188 * @cb: netlink callback structure that stores the sequence number
189 * @user_hdr: user header as returned from genlmsg_put()
193 * @family: generic netlink family
194 *
195 * Cf. nl_dump_check_consistent(), this just provides a wrapper to make it
196 * simpler to use with generic netlink.
197 */
198static inline void genl_dump_check_consistent(struct netlink_callback *cb,
190 *
191 * Cf. nl_dump_check_consistent(), this just provides a wrapper to make it
192 * simpler to use with generic netlink.
193 */
194static inline void genl_dump_check_consistent(struct netlink_callback *cb,
199 void *user_hdr,
200 const struct genl_family *family)
195 void *user_hdr)
201{
196{
202 nl_dump_check_consistent(cb, genlmsg_nlhdr(user_hdr, family));
197 nl_dump_check_consistent(cb, genlmsg_nlhdr(user_hdr));
203}
204
205/**
206 * genlmsg_put_reply - Add generic netlink header to a reply message
207 * @skb: socket buffer holding the message
208 * @info: receiver info
209 * @family: generic netlink family
210 * @flags: netlink message flags

--- 182 unchanged lines hidden ---
198}
199
200/**
201 * genlmsg_put_reply - Add generic netlink header to a reply message
202 * @skb: socket buffer holding the message
203 * @info: receiver info
204 * @family: generic netlink family
205 * @flags: netlink message flags

--- 182 unchanged lines hidden ---