@@ -338,65 +338,14 @@ static int rtnl_register_internal(struct module *owner,
338338 return ret ;
339339}
340340
341- /**
342- * rtnl_register_module - Register a rtnetlink message type
343- *
344- * @owner: module registering the hook (THIS_MODULE)
345- * @protocol: Protocol family or PF_UNSPEC
346- * @msgtype: rtnetlink message type
347- * @doit: Function pointer called for each request message
348- * @dumpit: Function pointer called for each dump request (NLM_F_DUMP) message
349- * @flags: rtnl_link_flags to modify behaviour of doit/dumpit functions
350- *
351- * Like rtnl_register, but for use by removable modules.
352- */
353- int rtnl_register_module (struct module * owner ,
354- int protocol , int msgtype ,
355- rtnl_doit_func doit , rtnl_dumpit_func dumpit ,
356- unsigned int flags )
357- {
358- return rtnl_register_internal (owner , protocol , msgtype ,
359- doit , dumpit , flags );
360- }
361- EXPORT_SYMBOL_GPL (rtnl_register_module );
362-
363- /**
364- * rtnl_register - Register a rtnetlink message type
365- * @protocol: Protocol family or PF_UNSPEC
366- * @msgtype: rtnetlink message type
367- * @doit: Function pointer called for each request message
368- * @dumpit: Function pointer called for each dump request (NLM_F_DUMP) message
369- * @flags: rtnl_link_flags to modify behaviour of doit/dumpit functions
370- *
371- * Registers the specified function pointers (at least one of them has
372- * to be non-NULL) to be called whenever a request message for the
373- * specified protocol family and message type is received.
374- *
375- * The special protocol family PF_UNSPEC may be used to define fallback
376- * function pointers for the case when no entry for the specific protocol
377- * family exists.
378- */
379- void rtnl_register (int protocol , int msgtype ,
380- rtnl_doit_func doit , rtnl_dumpit_func dumpit ,
381- unsigned int flags )
382- {
383- int err ;
384-
385- err = rtnl_register_internal (NULL , protocol , msgtype , doit , dumpit ,
386- flags );
387- if (err )
388- pr_err ("Unable to register rtnetlink message handler, "
389- "protocol = %d, message type = %d\n" , protocol , msgtype );
390- }
391-
392341/**
393342 * rtnl_unregister - Unregister a rtnetlink message type
394343 * @protocol: Protocol family or PF_UNSPEC
395344 * @msgtype: rtnetlink message type
396345 *
397346 * Returns 0 on success or a negative error code.
398347 */
399- int rtnl_unregister (int protocol , int msgtype )
348+ static int rtnl_unregister (int protocol , int msgtype )
400349{
401350 struct rtnl_link __rcu * * tab ;
402351 struct rtnl_link * link ;
@@ -419,7 +368,6 @@ int rtnl_unregister(int protocol, int msgtype)
419368
420369 return 0 ;
421370}
422- EXPORT_SYMBOL_GPL (rtnl_unregister );
423371
424372/**
425373 * rtnl_unregister_all - Unregister all rtnetlink message type of a protocol
@@ -454,6 +402,26 @@ void rtnl_unregister_all(int protocol)
454402}
455403EXPORT_SYMBOL_GPL (rtnl_unregister_all );
456404
405+ /**
406+ * __rtnl_register_many - Register rtnetlink message types
407+ * @handlers: Array of struct rtnl_msg_handlers
408+ * @n: The length of @handlers
409+ *
410+ * Registers the specified function pointers (at least one of them has
411+ * to be non-NULL) to be called whenever a request message for the
412+ * specified protocol family and message type is received.
413+ *
414+ * The special protocol family PF_UNSPEC may be used to define fallback
415+ * function pointers for the case when no entry for the specific protocol
416+ * family exists.
417+ *
418+ * When one element of @handlers fails to register,
419+ * 1) built-in: panics.
420+ * 2) modules : the previous successful registrations are unwinded
421+ * and an error is returned.
422+ *
423+ * Use rtnl_register_many().
424+ */
457425int __rtnl_register_many (const struct rtnl_msg_handler * handlers , int n )
458426{
459427 const struct rtnl_msg_handler * handler ;
0 commit comments