aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2005-06-19 01:53:48 -0400
committerDavid S. Miller <davem@davemloft.net>2005-06-19 01:53:48 -0400
commit1797754ea7ee5e0d859b0a32506ff999f8d5fb71 (patch)
treea35d05f9106d903412a6fff714be38427fc4d0fa /include/linux
parentaf0d114176720c2100dfa624ab433796d333d730 (diff)
[NETLINK]: Introduce NLMSG_NEW macro to better handle netlink flags
Introduces a new macro NLMSG_NEW which extends NLMSG_PUT but takes a flags argument. NLMSG_PUT stays there for compatibility but now calls NLMSG_NEW with flags == 0. NLMSG_PUT_ANSWER is renamed to NLMSG_NEW_ANSWER which now also takes a flags argument. Also converts the users of NLMSG_PUT_ANSWER to use NLMSG_NEW_ANSWER and fixes the two direct users of __nlmsg_put to either provide the flags or use NLMSG_NEW(_ANSWER). Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/netlink.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 8d1cb419a930..e38407a23d04 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -156,7 +156,7 @@ struct netlink_notify
156}; 156};
157 157
158static __inline__ struct nlmsghdr * 158static __inline__ struct nlmsghdr *
159__nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len) 159__nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
160{ 160{
161 struct nlmsghdr *nlh; 161 struct nlmsghdr *nlh;
162 int size = NLMSG_LENGTH(len); 162 int size = NLMSG_LENGTH(len);
@@ -164,20 +164,23 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len)
164 nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size)); 164 nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size));
165 nlh->nlmsg_type = type; 165 nlh->nlmsg_type = type;
166 nlh->nlmsg_len = size; 166 nlh->nlmsg_len = size;
167 nlh->nlmsg_flags = 0; 167 nlh->nlmsg_flags = flags;
168 nlh->nlmsg_pid = pid; 168 nlh->nlmsg_pid = pid;
169 nlh->nlmsg_seq = seq; 169 nlh->nlmsg_seq = seq;
170 return nlh; 170 return nlh;
171} 171}
172 172
173#define NLMSG_PUT(skb, pid, seq, type, len) \ 173#define NLMSG_NEW(skb, pid, seq, type, len, flags) \
174({ if (skb_tailroom(skb) < (int)NLMSG_SPACE(len)) \ 174({ if (skb_tailroom(skb) < (int)NLMSG_SPACE(len)) \
175 goto nlmsg_failure; \ 175 goto nlmsg_failure; \
176 __nlmsg_put(skb, pid, seq, type, len); }) 176 __nlmsg_put(skb, pid, seq, type, len, flags); })
177
178#define NLMSG_PUT(skb, pid, seq, type, len) \
179 NLMSG_NEW(skb, pid, seq, type, len, 0)
177 180
178#define NLMSG_PUT_ANSWER(skb, cb, type, len) \ 181#define NLMSG_NEW_ANSWER(skb, cb, type, len, flags) \
179 NLMSG_PUT(skb, NETLINK_CB((cb)->skb).pid, \ 182 NLMSG_NEW(skb, NETLINK_CB((cb)->skb).pid, \
180 (cb)->nlh->nlmsg_seq, type, len) 183 (cb)->nlh->nlmsg_seq, type, len, flags)
181 184
182#define NLMSG_END(skb, nlh) \ 185#define NLMSG_END(skb, nlh) \
183({ (nlh)->nlmsg_len = (skb)->tail - (unsigned char *) (nlh); \ 186({ (nlh)->nlmsg_len = (skb)->tail - (unsigned char *) (nlh); \