diff options
author | Johannes Berg <johannes.berg@intel.com> | 2013-11-15 08:19:08 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-11-15 20:50:23 -0500 |
commit | 568508aa0724cc39bcf7d3d8001bd27a45609800 (patch) | |
tree | 11e9648ccbd27021e18307f5639684b5c563c19c /include/net | |
parent | 052e31281575b2894aad09672bd9ac435488ff04 (diff) |
genetlink: unify registration functions
Now that the ops assignment is just two variables rather than a
long list iteration etc., there's no reason to separately export
__genl_register_family() and __genl_register_family_with_ops().
Unify the two functions into __genl_register_family() and make
genl_register_family_with_ops() call it after assigning the ops.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/genetlink.h | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/include/net/genetlink.h b/include/net/genetlink.h index 0b6a144468c6..e96385d46b48 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h | |||
@@ -131,14 +131,34 @@ static inline int genl_register_family(struct genl_family *family) | |||
131 | return __genl_register_family(family); | 131 | return __genl_register_family(family); |
132 | } | 132 | } |
133 | 133 | ||
134 | int __genl_register_family_with_ops(struct genl_family *family, | 134 | /** |
135 | const struct genl_ops *ops, size_t n_ops); | 135 | * genl_register_family_with_ops - register a generic netlink family with ops |
136 | 136 | * @family: generic netlink family | |
137 | * @ops: operations to be registered | ||
138 | * @n_ops: number of elements to register | ||
139 | * | ||
140 | * Registers the specified family and operations from the specified table. | ||
141 | * Only one family may be registered with the same family name or identifier. | ||
142 | * | ||
143 | * The family id may equal GENL_ID_GENERATE causing an unique id to | ||
144 | * be automatically generated and assigned. | ||
145 | * | ||
146 | * Either a doit or dumpit callback must be specified for every registered | ||
147 | * operation or the function will fail. Only one operation structure per | ||
148 | * command identifier may be registered. | ||
149 | * | ||
150 | * See include/net/genetlink.h for more documenation on the operations | ||
151 | * structure. | ||
152 | * | ||
153 | * Return 0 on success or a negative error code. | ||
154 | */ | ||
137 | static inline int genl_register_family_with_ops(struct genl_family *family, | 155 | static inline int genl_register_family_with_ops(struct genl_family *family, |
138 | const struct genl_ops *ops, size_t n_ops) | 156 | const struct genl_ops *ops, size_t n_ops) |
139 | { | 157 | { |
140 | family->module = THIS_MODULE; | 158 | family->module = THIS_MODULE; |
141 | return __genl_register_family_with_ops(family, ops, n_ops); | 159 | family->ops = ops; |
160 | family->n_ops = n_ops; | ||
161 | return __genl_register_family(family); | ||
142 | } | 162 | } |
143 | 163 | ||
144 | int genl_unregister_family(struct genl_family *family); | 164 | int genl_unregister_family(struct genl_family *family); |