History

genetlink: use idr to track families

Since generic netlink family IDs are small integers, allocated densely, IDR is an ideal match for lookups. Replace the existing hand-written hash-table with IDR for allocation and lookup. This lets the families only be written to once, during register, since the list_head can be removed and removal of a family won't cause any writes. It also slightly reduces the code size (by about 1.3k on x86-64).

Johannes Berg committed 10 years ago

Commit 2ae0f171 parent 489111e3 files · +123 −181Browse files

Unified · Split

3 files
  1. include/net/genetlink.h +15 −16
  2. include/uapi/linux/genetlink.h +2 −0
  3. net/netlink/genetlink.c +106 −165
include/net/genetlink.h+15−16
@@ -40,7 +40,6 @@ struct genl_info; · 39 unmodified lines
4040 * generic netlink family is removed while there are still open
4141 * sockets.
4242 * @attrbuf: buffer to store parsed attributes (private)
43− * @family_list: family list (private)
4443 * @mcgrps: multicast groups used by this family
4544 * @n_mcgrps: number of multicast groups
4645 * @mcgrp_offset: starting number of multicast group IDs in this family
@@ -70,11 +69,10 @@ struct genl_family { · 23 unmodified lines
7069 unsigned int n_ops;
7170 unsigned int n_mcgrps;
7271 unsigned int mcgrp_offset; /* private */
73− struct list_head family_list; /* private */
7472 struct module *module;
7573 };
7674
77−struct nlattr **genl_family_attrbuf(struct genl_family *family);
75+struct nlattr **genl_family_attrbuf(const struct genl_family *family);
7876
7977 /**
8078 * struct genl_info - receiving information
@@ -134,12 +132,12 @@ struct genl_ops { · 53 unmodified lines
134132 };
135133
136134 int genl_register_family(struct genl_family *family);
137−int genl_unregister_family(struct genl_family *family);
138−void genl_notify(struct genl_family *family, struct sk_buff *skb,
135+int genl_unregister_family(const struct genl_family *family);
136+void genl_notify(const struct genl_family *family, struct sk_buff *skb,
139137 struct genl_info *info, u32 group, gfp_t flags);
140138
141139 void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
142− struct genl_family *family, int flags, u8 cmd);
140+ const struct genl_family *family, int flags, u8 cmd);
143141
144142 /**
145143 * genlmsg_nlhdr - Obtain netlink header from user specified header
@@ -148,8 +146,8 @@ void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, · 2 unmodified lines
148146 *
149147 * Returns pointer to netlink header.
150148 */
151−static inline struct nlmsghdr *genlmsg_nlhdr(void *user_hdr,
152− struct genl_family *family)
149+static inline struct nlmsghdr *
150+genlmsg_nlhdr(void *user_hdr, const struct genl_family *family)
153151 {
154152 return (struct nlmsghdr *)((char *)user_hdr -
155153 family->hdrsize -
@@ -185,7 +183,7 @@ static inline int genlmsg_parse(const struct nlmsghdr *nlh, · 29 unmodified lines
185183 */
186184 static inline void genl_dump_check_consistent(struct netlink_callback *cb,
187185 void *user_hdr,
188− struct genl_family *family)
186+ const struct genl_family *family)
189187 {
190188 nl_dump_check_consistent(cb, genlmsg_nlhdr(user_hdr, family));
191189 }
@@ -202,7 +200,7 @@ static inline void genl_dump_check_consistent(struct netlink_callback *cb, · 10 unmodified lines
202200 */
203201 static inline void *genlmsg_put_reply(struct sk_buff *skb,
204202 struct genl_info *info,
205− struct genl_family *family,
203+ const struct genl_family *family,
206204 int flags, u8 cmd)
207205 {
208206 return genlmsg_put(skb, info->snd_portid, info->snd_seq, family,
@@ -239,7 +237,7 @@ static inline void genlmsg_cancel(struct sk_buff *skb, void *hdr) · 30 unmodified lines
239237 * @group: offset of multicast group in groups array
240238 * @flags: allocation flags
241239 */
242−static inline int genlmsg_multicast_netns(struct genl_family *family,
240+static inline int genlmsg_multicast_netns(const struct genl_family *family,
243241 struct net *net, struct sk_buff *skb,
244242 u32 portid, unsigned int group, gfp_t flags)
245243 {
@@ -257,7 +255,7 @@ static inline int genlmsg_multicast_netns(struct genl_family *family, · 11 unmodified lines
257255 * @group: offset of multicast group in groups array
258256 * @flags: allocation flags
259257 */
260−static inline int genlmsg_multicast(struct genl_family *family,
258+static inline int genlmsg_multicast(const struct genl_family *family,
261259 struct sk_buff *skb, u32 portid,
262260 unsigned int group, gfp_t flags)
263261 {
@@ -275,7 +273,7 @@ static inline int genlmsg_multicast(struct genl_family *family, · 11 unmodified lines
275273 *
276274 * This function must hold the RTNL or rcu_read_lock().
277275 */
278−int genlmsg_multicast_allns(struct genl_family *family,
276+int genlmsg_multicast_allns(const struct genl_family *family,
279277 struct sk_buff *skb, u32 portid,
280278 unsigned int group, gfp_t flags);
281279
@@ -359,8 +357,9 @@ static inline struct sk_buff *genlmsg_new(size_t payload, gfp_t flags) · 77 unmodified lines
359357 * This function returns the number of broadcast listeners that have set the
360358 * NETLINK_RECV_NO_ENOBUFS socket option.
361359 */
362−static inline int genl_set_err(struct genl_family *family, struct net *net,
363− u32 portid, u32 group, int code)
360+static inline int genl_set_err(const struct genl_family *family,
361+ struct net *net, u32 portid,
362+ u32 group, int code)
364363 {
365364 if (WARN_ON_ONCE(group >= family->n_mcgrps))
366365 return -EINVAL;
@@ -368,7 +367,7 @@ static inline int genl_set_err(struct genl_family *family, struct net *net, · 1 unmodified line
368367 return netlink_set_err(net->genl_sock, portid, group, code);
369368 }
370369
371−static inline int genl_has_listeners(struct genl_family *family,
370+static inline int genl_has_listeners(const struct genl_family *family,
372371 struct net *net, unsigned int group)
373372 {
374373 if (WARN_ON_ONCE(group >= family->n_mcgrps))
include/uapi/linux/genetlink.h+2−0
@@ -29,6 +29,8 @@ struct genlmsghdr { · 28 unmodified lines
2929 #define GENL_ID_CTRL NLMSG_MIN_TYPE
3030 #define GENL_ID_VFS_DQUOT (NLMSG_MIN_TYPE + 1)
3131 #define GENL_ID_PMCRAID (NLMSG_MIN_TYPE + 2)
32+/* must be last reserved + 1 */
33+#define GENL_START_ALLOC (NLMSG_MIN_TYPE + 3)
3234
3335 /**************************************************************************
3436 * Controller
net/netlink/genetlink.c+106−165
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <linux/mutex.h>
1818 #include <linux/bitmap.h>
1919 #include <linux/rwsem.h>
20+#include <linux/idr.h>
2021 #include <net/sock.h>
2122 #include <net/genetlink.h>
2223
@@ -58,10 +59,8 @@ static void genl_unlock_all(void) · 35 unmodified lines
5859 up_write(&cb_lock);
5960 }
6061
61−#define GENL_FAM_TAB_SIZE 16
62−#define GENL_FAM_TAB_MASK (GENL_FAM_TAB_SIZE - 1)
62+static DEFINE_IDR(genl_fam_idr);
6363
64−static struct list_head family_ht[GENL_FAM_TAB_SIZE];
6564 /*
6665 * Bitmap of multicast groups that are currently in use.
6766 *
@@ -86,45 +85,29 @@ static unsigned long mc_group_start = 0x3 | BIT(GENL_ID_CTRL) | · 18 unmodified lines
8685 static unsigned long *mc_groups = &mc_group_start;
8786 static unsigned long mc_groups_longs = 1;
8887
89−static int genl_ctrl_event(int event, struct genl_family *family,
88+static int genl_ctrl_event(int event, const struct genl_family *family,
9089 const struct genl_multicast_group *grp,
9190 int grp_id);
9291
93−static inline unsigned int genl_family_hash(unsigned int id)
92+static const struct genl_family *genl_family_find_byid(unsigned int id)
9493 {
95− return id & GENL_FAM_TAB_MASK;
94+ return idr_find(&genl_fam_idr, id);
9695 }
9796
98−static inline struct list_head *genl_family_chain(unsigned int id)
97+static const struct genl_family *genl_family_find_byname(char *name)
9998 {
100− return &family_ht[genl_family_hash(id)];
101−}
102−
103−static struct genl_family *genl_family_find_byid(unsigned int id)
104−{
105− struct genl_family *f;
99+ const struct genl_family *family;
100+ unsigned int id;
106101
107− list_for_each_entry(f, genl_family_chain(id), family_list)
108− if (f->id == id)
109− return f;
102+ idr_for_each_entry(&genl_fam_idr, family, id)
103+ if (strcmp(family->name, name) == 0)
104+ return family;
110105
111106 return NULL;
112107 }
113108
114−static struct genl_family *genl_family_find_byname(char *name)
115−{
116− struct genl_family *f;
117− int i;
118−
119− for (i = 0; i < GENL_FAM_TAB_SIZE; i++)
120− list_for_each_entry(f, genl_family_chain(i), family_list)
121− if (strcmp(f->name, name) == 0)
122− return f;
123−
124− return NULL;
125−}
126−
127−static const struct genl_ops *genl_get_cmd(u8 cmd, struct genl_family *family)
109+static const struct genl_ops *genl_get_cmd(u8 cmd,
110+ const struct genl_family *family)
128111 {
129112 int i;
130113
@@ -135,26 +118,6 @@ static const struct genl_ops *genl_get_cmd(u8 cmd, struct genl_family *family) · 4 unmodified lines
135118 return NULL;
136119 }
137120
138−/* Of course we are going to have problems once we hit
139− * 2^16 alive types, but that can only happen by year 2K
140−*/
141−static u16 genl_generate_id(void)
142−{
143− static u16 id_gen_idx = GENL_MIN_ID;
144− int i;
145−
146− for (i = 0; i <= GENL_MAX_ID - GENL_MIN_ID; i++) {
147− if (id_gen_idx != GENL_ID_VFS_DQUOT &&
148− id_gen_idx != GENL_ID_PMCRAID &&
149− !genl_family_find_byid(id_gen_idx))
150− return id_gen_idx;
151− if (++id_gen_idx > GENL_MAX_ID)
152− id_gen_idx = GENL_MIN_ID;
153− }
154−
155− return 0;
156−}
157−
158121 static int genl_allocate_reserve_groups(int n_groups, int *first_id)
159122 {
160123 unsigned long *new_groups;
@@ -295,7 +258,7 @@ static int genl_validate_assign_mc_groups(struct genl_family *family) · 134 unmodified lines
295258 return err;
296259 }
297260
298−static void genl_unregister_mc_groups(struct genl_family *family)
261+static void genl_unregister_mc_groups(const struct genl_family *family)
299262 {
300263 struct net *net;
301264 int i;
@@ -358,6 +321,7 @@ static int genl_validate_ops(const struct genl_family *family) · 56 unmodified lines
358321 int genl_register_family(struct genl_family *family)
359322 {
360323 int err, i;
324+ int start = GENL_START_ALLOC, end = GENL_MAX_ID;
361325
362326 err = genl_validate_ops(family);
363327 if (err)
@@ -370,34 +334,20 @@ int genl_register_family(struct genl_family *family) · 6 unmodified lines
370334 goto errout_locked;
371335 }
372336
337+ /*
338+ * Sadly, a few cases need to be special-cased
339+ * due to them having previously abused the API
340+ * and having used their family ID also as their
341+ * multicast group ID, so we use reserved IDs
342+ * for both to be sure we can do that mapping.
343+ */
373344 if (family == &genl_ctrl) {
374− family->id = GENL_ID_CTRL;
375− } else {
376− u16 newid;
377−
378− /* this should be left zero in the struct */
379− WARN_ON(family->id);
380−
381− /*
382− * Sadly, a few cases need to be special-cased
383− * due to them having previously abused the API
384− * and having used their family ID also as their
385− * multicast group ID, so we use reserved IDs
386− * for both to be sure we can do that mapping.
387− */
388− if (strcmp(family->name, "pmcraid") == 0)
389− newid = GENL_ID_PMCRAID;
390− else if (strcmp(family->name, "VFS_DQUOT") == 0)
391− newid = GENL_ID_VFS_DQUOT;
392− else
393− newid = genl_generate_id();
394−
395− if (!newid) {
396− err = -ENOMEM;
397− goto errout_locked;
398− }
399−
400− family->id = newid;
345+ /* and this needs to be special for initial family lookups */
346+ start = end = GENL_ID_CTRL;
347+ } else if (strcmp(family->name, "pmcraid") == 0) {
348+ start = end = GENL_ID_PMCRAID;
349+ } else if (strcmp(family->name, "VFS_DQUOT") == 0) {
350+ start = end = GENL_ID_VFS_DQUOT;
401351 }
402352
403353 if (family->maxattr && !family->parallel_ops) {
@@ -410,11 +360,15 @@ int genl_register_family(struct genl_family *family) · 6 unmodified lines
410360 } else
411361 family->attrbuf = NULL;
412362
363+ family->id = idr_alloc(&genl_fam_idr, family,
364+ start, end + 1, GFP_KERNEL);
365+ if (!family->id)
366+ goto errout_locked;
367+
413368 err = genl_validate_assign_mc_groups(family);
414369 if (err)
415− goto errout_locked;
370+ goto errout_remove;
416371
417− list_add_tail(&family->family_list, genl_family_chain(family->id));
418372 genl_unlock_all();
419373
420374 /* send all events */
@@ -425,6 +379,8 @@ int genl_register_family(struct genl_family *family) · 4 unmodified lines
425379
426380 return 0;
427381
382+errout_remove:
383+ idr_remove(&genl_fam_idr, family->id);
428384 errout_locked:
429385 genl_unlock_all();
430386 return err;
@@ -439,32 +395,29 @@ EXPORT_SYMBOL(genl_register_family); · 8 unmodified lines
439395 *
440396 * Returns 0 on success or a negative error code.
441397 */
442−int genl_unregister_family(struct genl_family *family)
398+int genl_unregister_family(const struct genl_family *family)
443399 {
444− struct genl_family *rc;
445−
446400 genl_lock_all();
447401
448− list_for_each_entry(rc, genl_family_chain(family->id), family_list) {
449− if (family->id != rc->id || strcmp(rc->name, family->name))
450− continue;
402+ if (genl_family_find_byid(family->id)) {
403+ genl_unlock_all();
404+ return -ENOENT;
405+ }
451406
452− genl_unregister_mc_groups(family);
407+ genl_unregister_mc_groups(family);
453408
454− list_del(&rc->family_list);
455− up_write(&cb_lock);
456− wait_event(genl_sk_destructing_waitq,
457− atomic_read(&genl_sk_destructing_cnt) == 0);
458− genl_unlock();
409+ idr_remove(&genl_fam_idr, family->id);
459410
460− kfree(family->attrbuf);
461− genl_ctrl_event(CTRL_CMD_DELFAMILY, family, NULL, 0);
462− return 0;
463− }
411+ up_write(&cb_lock);
412+ wait_event(genl_sk_destructing_waitq,
413+ atomic_read(&genl_sk_destructing_cnt) == 0);
414+ genl_unlock();
464415
465− genl_unlock_all();
416+ kfree(family->attrbuf);
466417
467− return -ENOENT;
418+ genl_ctrl_event(CTRL_CMD_DELFAMILY, family, NULL, 0);
419+
420+ return 0;
468421 }
469422 EXPORT_SYMBOL(genl_unregister_family);
470423
@@ -480,7 +433,7 @@ EXPORT_SYMBOL(genl_unregister_family); · 9 unmodified lines
480433 * Returns pointer to user specific header
481434 */
482435 void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
483− struct genl_family *family, int flags, u8 cmd)
436+ const struct genl_family *family, int flags, u8 cmd)
484437 {
485438 struct nlmsghdr *nlh;
486439 struct genlmsghdr *hdr;
@@ -539,7 +492,7 @@ static int genl_lock_done(struct netlink_callback *cb) · 52 unmodified lines
539492 return rc;
540493 }
541494
542−static int genl_family_rcv_msg(struct genl_family *family,
495+static int genl_family_rcv_msg(const struct genl_family *family,
543496 struct sk_buff *skb,
544497 struct nlmsghdr *nlh)
545498 {
@@ -651,7 +604,7 @@ out: · 105 unmodified lines
651604
652605 static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
653606 {
654− struct genl_family *family;
607+ const struct genl_family *family;
655608 int err;
656609
657610 family = genl_family_find_byid(nlh->nlmsg_type);
@@ -682,7 +635,7 @@ static void genl_rcv(struct sk_buff *skb) · 24 unmodified lines
682635
683636 static struct genl_family genl_ctrl;
684637
685−static int ctrl_fill_info(struct genl_family *family, u32 portid, u32 seq,
638+static int ctrl_fill_info(const struct genl_family *family, u32 portid, u32 seq,
686639 u32 flags, struct sk_buff *skb, u8 cmd)
687640 {
688641 void *hdr;
@@ -769,7 +722,7 @@ nla_put_failure: · 80 unmodified lines
769722 return -EMSGSIZE;
770723 }
771724
772−static int ctrl_fill_mcgrp_info(struct genl_family *family,
725+static int ctrl_fill_mcgrp_info(const struct genl_family *family,
773726 const struct genl_multicast_group *grp,
774727 int grp_id, u32 portid, u32 seq, u32 flags,
775728 struct sk_buff *skb, u8 cmd)
@@ -812,37 +765,30 @@ nla_put_failure: · 36 unmodified lines
812765
813766 static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb)
814767 {
815−
816− int i, n = 0;
768+ int n = 0;
817769 struct genl_family *rt;
818770 struct net *net = sock_net(skb->sk);
819− int chains_to_skip = cb->args[0];
820− int fams_to_skip = cb->args[1];
821−
822− for (i = chains_to_skip; i < GENL_FAM_TAB_SIZE; i++) {
823− n = 0;
824− list_for_each_entry(rt, genl_family_chain(i), family_list) {
825− if (!rt->netnsok && !net_eq(net, &init_net))
826− continue;
827− if (++n < fams_to_skip)
828− continue;
829− if (ctrl_fill_info(rt, NETLINK_CB(cb->skb).portid,
830− cb->nlh->nlmsg_seq, NLM_F_MULTI,
831− skb, CTRL_CMD_NEWFAMILY) < 0)
832− goto errout;
833− }
771+ int fams_to_skip = cb->args[0];
772+ unsigned int id;
834773
835− fams_to_skip = 0;
836− }
774+ idr_for_each_entry(&genl_fam_idr, rt, id) {
775+ if (!rt->netnsok && !net_eq(net, &init_net))
776+ continue;
777+
778+ if (n++ < fams_to_skip)
779+ continue;
837780
838−errout:
839− cb->args[0] = i;
840− cb->args[1] = n;
781+ if (ctrl_fill_info(rt, NETLINK_CB(cb->skb).portid,
782+ cb->nlh->nlmsg_seq, NLM_F_MULTI,
783+ skb, CTRL_CMD_NEWFAMILY) < 0)
784+ break;
785+ }
841786
787+ cb->args[0] = n;
842788 return skb->len;
843789 }
844790
845−static struct sk_buff *ctrl_build_family_msg(struct genl_family *family,
791+static struct sk_buff *ctrl_build_family_msg(const struct genl_family *family,
846792 u32 portid, int seq, u8 cmd)
847793 {
848794 struct sk_buff *skb;
@@ -862,7 +808,7 @@ static struct sk_buff *ctrl_build_family_msg(struct genl_family *family, · 13 unmodified lines
862808 }
863809
864810 static struct sk_buff *
865−ctrl_build_mcgrp_msg(struct genl_family *family,
811+ctrl_build_mcgrp_msg(const struct genl_family *family,
866812 const struct genl_multicast_group *grp,
867813 int grp_id, u32 portid, int seq, u8 cmd)
868814 {
@@ -892,7 +838,7 @@ static const struct nla_policy ctrl_policy[CTRL_ATTR_MAX+1] = { · 23 unmodified lines
892838 static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info)
893839 {
894840 struct sk_buff *msg;
895− struct genl_family *res = NULL;
841+ const struct genl_family *res = NULL;
896842 int err = -EINVAL;
897843
898844 if (info->attrs[CTRL_ATTR_FAMILY_ID]) {
@@ -936,7 +882,7 @@ static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info) · 37 unmodified lines
936882 return genlmsg_reply(msg, info);
937883 }
938884
939−static int genl_ctrl_event(int event, struct genl_family *family,
885+static int genl_ctrl_event(int event, const struct genl_family *family,
940886 const struct genl_multicast_group *grp,
941887 int grp_id)
942888 {
@@ -1005,25 +951,24 @@ static struct genl_family genl_ctrl = { · 62 unmodified lines
1005951
1006952 static int genl_bind(struct net *net, int group)
1007953 {
1008− int i, err = -ENOENT;
954+ struct genl_family *f;
955+ int err = -ENOENT;
956+ unsigned int id;
1009957
1010958 down_read(&cb_lock);
1011− for (i = 0; i < GENL_FAM_TAB_SIZE; i++) {
1012− struct genl_family *f;
1013−
1014− list_for_each_entry(f, genl_family_chain(i), family_list) {
1015− if (group >= f->mcgrp_offset &&
1016− group < f->mcgrp_offset + f->n_mcgrps) {
1017− int fam_grp = group - f->mcgrp_offset;
1018−
1019− if (!f->netnsok && net != &init_net)
1020− err = -ENOENT;
1021− else if (f->mcast_bind)
1022− err = f->mcast_bind(net, fam_grp);
1023− else
1024− err = 0;
1025− break;
1026− }
959+
960+ idr_for_each_entry(&genl_fam_idr, f, id) {
961+ if (group >= f->mcgrp_offset &&
962+ group < f->mcgrp_offset + f->n_mcgrps) {
963+ int fam_grp = group - f->mcgrp_offset;
964+
965+ if (!f->netnsok && net != &init_net)
966+ err = -ENOENT;
967+ else if (f->mcast_bind)
968+ err = f->mcast_bind(net, fam_grp);
969+ else
970+ err = 0;
971+ break;
1027972 }
1028973 }
1029974 up_read(&cb_lock);
@@ -1033,21 +978,19 @@ static int genl_bind(struct net *net, int group) · 3 unmodified lines
1033978
1034979 static void genl_unbind(struct net *net, int group)
1035980 {
1036− int i;
981+ struct genl_family *f;
982+ unsigned int id;
1037983
1038984 down_read(&cb_lock);
1039− for (i = 0; i < GENL_FAM_TAB_SIZE; i++) {
1040− struct genl_family *f;
1041985
1042− list_for_each_entry(f, genl_family_chain(i), family_list) {
1043− if (group >= f->mcgrp_offset &&
1044− group < f->mcgrp_offset + f->n_mcgrps) {
1045− int fam_grp = group - f->mcgrp_offset;
986+ idr_for_each_entry(&genl_fam_idr, f, id) {
987+ if (group >= f->mcgrp_offset &&
988+ group < f->mcgrp_offset + f->n_mcgrps) {
989+ int fam_grp = group - f->mcgrp_offset;
1046990
1047− if (f->mcast_unbind)
1048− f->mcast_unbind(net, fam_grp);
1049− break;
1050− }
991+ if (f->mcast_unbind)
992+ f->mcast_unbind(net, fam_grp);
993+ break;
1051994 }
1052995 }
1053996 up_read(&cb_lock);
@@ -1087,10 +1030,7 @@ static struct pernet_operations genl_pernet_ops = { · 33 unmodified lines
10871030
10881031 static int __init genl_init(void)
10891032 {
1090− int i, err;
1091−
1092− for (i = 0; i < GENL_FAM_TAB_SIZE; i++)
1093− INIT_LIST_HEAD(&family_ht[i]);
1033+ int err;
10941034
10951035 err = genl_register_family(&genl_ctrl);
10961036 if (err < 0)
@@ -1118,7 +1058,7 @@ subsys_initcall(genl_init); · 21 unmodified lines
11181058 * You cannot use this function with a family that has parallel_ops
11191059 * and you can only use it within (pre/post) doit/dumpit callbacks.
11201060 */
1121−struct nlattr **genl_family_attrbuf(struct genl_family *family)
1061+struct nlattr **genl_family_attrbuf(const struct genl_family *family)
11221062 {
11231063 if (!WARN_ON(family->parallel_ops))
11241064 lockdep_assert_held(&genl_mutex);
@@ -1156,8 +1096,9 @@ static int genlmsg_mcast(struct sk_buff *skb, u32 portid, unsigned long group, · 31 unmodified lines
11561096 return err;
11571097 }
11581098
1159−int genlmsg_multicast_allns(struct genl_family *family, struct sk_buff *skb,
1160− u32 portid, unsigned int group, gfp_t flags)
1099+int genlmsg_multicast_allns(const struct genl_family *family,
1100+ struct sk_buff *skb, u32 portid,
1101+ unsigned int group, gfp_t flags)
11611102 {
11621103 if (WARN_ON_ONCE(group >= family->n_mcgrps))
11631104 return -EINVAL;
@@ -1166,7 +1107,7 @@ int genlmsg_multicast_allns(struct genl_family *family, struct sk_buff *skb, · 2 unmodified lines
11661107 }
11671108 EXPORT_SYMBOL(genlmsg_multicast_allns);
11681109
1169−void genl_notify(struct genl_family *family, struct sk_buff *skb,
1110+void genl_notify(const struct genl_family *family, struct sk_buff *skb,
11701111 struct genl_info *info, u32 group, gfp_t flags)
11711112 {
11721113 struct net *net = genl_info_net(info);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t