diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/net/genetlink.h | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/include/net/genetlink.h b/include/net/genetlink.h index 797c18b5041f..7fd131c9a8cc 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h | |||
@@ -79,34 +79,51 @@ extern struct sock *genl_sock; | |||
79 | * @skb: socket buffer holding the message | 79 | * @skb: socket buffer holding the message |
80 | * @pid: netlink pid the message is addressed to | 80 | * @pid: netlink pid the message is addressed to |
81 | * @seq: sequence number (usually the one of the sender) | 81 | * @seq: sequence number (usually the one of the sender) |
82 | * @type: netlink message type | 82 | * @family: generic netlink family |
83 | * @hdrlen: length of the user specific header | ||
84 | * @flags netlink message flags | 83 | * @flags netlink message flags |
85 | * @cmd: generic netlink command | 84 | * @cmd: generic netlink command |
86 | * @version: version | ||
87 | * | 85 | * |
88 | * Returns pointer to user specific header | 86 | * Returns pointer to user specific header |
89 | */ | 87 | */ |
90 | static inline void *genlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, | 88 | static inline void *genlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, |
91 | int type, int hdrlen, int flags, | 89 | struct genl_family *family, int flags, u8 cmd) |
92 | u8 cmd, u8 version) | ||
93 | { | 90 | { |
94 | struct nlmsghdr *nlh; | 91 | struct nlmsghdr *nlh; |
95 | struct genlmsghdr *hdr; | 92 | struct genlmsghdr *hdr; |
96 | 93 | ||
97 | nlh = nlmsg_put(skb, pid, seq, type, GENL_HDRLEN + hdrlen, flags); | 94 | nlh = nlmsg_put(skb, pid, seq, family->id, GENL_HDRLEN + |
95 | family->hdrsize, flags); | ||
98 | if (nlh == NULL) | 96 | if (nlh == NULL) |
99 | return NULL; | 97 | return NULL; |
100 | 98 | ||
101 | hdr = nlmsg_data(nlh); | 99 | hdr = nlmsg_data(nlh); |
102 | hdr->cmd = cmd; | 100 | hdr->cmd = cmd; |
103 | hdr->version = version; | 101 | hdr->version = family->version; |
104 | hdr->reserved = 0; | 102 | hdr->reserved = 0; |
105 | 103 | ||
106 | return (char *) hdr + GENL_HDRLEN; | 104 | return (char *) hdr + GENL_HDRLEN; |
107 | } | 105 | } |
108 | 106 | ||
109 | /** | 107 | /** |
108 | * genlmsg_put_reply - Add generic netlink header to a reply message | ||
109 | * @skb: socket buffer holding the message | ||
110 | * @info: receiver info | ||
111 | * @family: generic netlink family | ||
112 | * @flags: netlink message flags | ||
113 | * @cmd: generic netlink command | ||
114 | * | ||
115 | * Returns pointer to user specific header | ||
116 | */ | ||
117 | static inline void *genlmsg_put_reply(struct sk_buff *skb, | ||
118 | struct genl_info *info, | ||
119 | struct genl_family *family, | ||
120 | int flags, u8 cmd) | ||
121 | { | ||
122 | return genlmsg_put(skb, info->snd_pid, info->snd_seq, family, | ||
123 | flags, cmd); | ||
124 | } | ||
125 | |||
126 | /** | ||
110 | * genlmsg_end - Finalize a generic netlink message | 127 | * genlmsg_end - Finalize a generic netlink message |
111 | * @skb: socket buffer the message is stored in | 128 | * @skb: socket buffer the message is stored in |
112 | * @hdr: user specific header | 129 | * @hdr: user specific header |