{
int err;
if (ops->co_protocol != NETLINK_GENERIC) {
err = nl_error(EINVAL, "cache operations not for protocol " \
"NETLINK_GENERIC (protocol=%s)",
ops->co_protocol);
goto errout;
}
if (ops->co_hdrsize < GENL_HDRSIZE(0)) {
err = nl_error(EINVAL, "co_hdrsize too short, probably " \
"not including genlmsghdr, minsize=%d",
GENL_HDRSIZE(0));
goto errout;
}
if (ops->co_genl == NULL) {
err = nl_error(EINVAL, "co_genl is NULL, must provide " \
"valid genl operations");
goto errout;
}
ops->co_genl->o_cache_ops = ops;
ops->co_genl->o_name = ops->co_msgtypes[0].
mt_name;
ops->co_genl->o_family = ops->co_msgtypes[0].
mt_id;
nl_list_add_tail(&ops->co_genl->o_list, &genl_ops_list);
errout:
return err;
}