1 // SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 2 /* Do not edit directly, auto-generated from: */ 3 /* Documentation/netlink/specs/sunrpc_cache.yaml */ 4 /* YNL-GEN kernel source */ 5 /* To regenerate run: tools/net/ynl/ynl-regen.sh */ 6 7 #include <net/netlink.h> 8 #include <net/genetlink.h> 9 10 #include "netlink.h" 11 12 #include <uapi/linux/sunrpc_netlink.h> 13 14 /* Common nested types */ 15 const struct nla_policy sunrpc_ip_map_nl_policy[SUNRPC_A_IP_MAP_EXPIRY + 1] = { 16 [SUNRPC_A_IP_MAP_SEQNO] = { .type = NLA_U64, }, 17 [SUNRPC_A_IP_MAP_CLASS] = { .type = NLA_NUL_STRING, }, 18 [SUNRPC_A_IP_MAP_ADDR] = { .type = NLA_NUL_STRING, }, 19 [SUNRPC_A_IP_MAP_DOMAIN] = { .type = NLA_NUL_STRING, }, 20 [SUNRPC_A_IP_MAP_NEGATIVE] = { .type = NLA_FLAG, }, 21 [SUNRPC_A_IP_MAP_EXPIRY] = { .type = NLA_U64, }, 22 }; 23 24 const struct nla_policy sunrpc_unix_gid_nl_policy[SUNRPC_A_UNIX_GID_EXPIRY + 1] = { 25 [SUNRPC_A_UNIX_GID_SEQNO] = { .type = NLA_U64, }, 26 [SUNRPC_A_UNIX_GID_UID] = { .type = NLA_U32, }, 27 [SUNRPC_A_UNIX_GID_GIDS] = { .type = NLA_U32, }, 28 [SUNRPC_A_UNIX_GID_NEGATIVE] = { .type = NLA_FLAG, }, 29 [SUNRPC_A_UNIX_GID_EXPIRY] = { .type = NLA_U64, }, 30 }; 31 32 /* SUNRPC_CMD_IP_MAP_GET_REQS - dump */ 33 static const struct nla_policy sunrpc_ip_map_get_reqs_nl_policy[SUNRPC_A_IP_MAP_REQS_REQUESTS + 1] = { 34 [SUNRPC_A_IP_MAP_REQS_REQUESTS] = NLA_POLICY_NESTED(sunrpc_ip_map_nl_policy), 35 }; 36 37 /* SUNRPC_CMD_IP_MAP_SET_REQS - do */ 38 static const struct nla_policy sunrpc_ip_map_set_reqs_nl_policy[SUNRPC_A_IP_MAP_REQS_REQUESTS + 1] = { 39 [SUNRPC_A_IP_MAP_REQS_REQUESTS] = NLA_POLICY_NESTED(sunrpc_ip_map_nl_policy), 40 }; 41 42 /* SUNRPC_CMD_UNIX_GID_GET_REQS - dump */ 43 static const struct nla_policy sunrpc_unix_gid_get_reqs_nl_policy[SUNRPC_A_UNIX_GID_REQS_REQUESTS + 1] = { 44 [SUNRPC_A_UNIX_GID_REQS_REQUESTS] = NLA_POLICY_NESTED(sunrpc_unix_gid_nl_policy), 45 }; 46 47 /* SUNRPC_CMD_UNIX_GID_SET_REQS - do */ 48 static const struct nla_policy sunrpc_unix_gid_set_reqs_nl_policy[SUNRPC_A_UNIX_GID_REQS_REQUESTS + 1] = { 49 [SUNRPC_A_UNIX_GID_REQS_REQUESTS] = NLA_POLICY_NESTED(sunrpc_unix_gid_nl_policy), 50 }; 51 52 /* SUNRPC_CMD_CACHE_FLUSH - do */ 53 static const struct nla_policy sunrpc_cache_flush_nl_policy[SUNRPC_A_CACHE_FLUSH_MASK + 1] = { 54 [SUNRPC_A_CACHE_FLUSH_MASK] = NLA_POLICY_MASK(NLA_U32, 0x3), 55 }; 56 57 /* Ops table for sunrpc */ 58 static const struct genl_split_ops sunrpc_nl_ops[] = { 59 { 60 .cmd = SUNRPC_CMD_IP_MAP_GET_REQS, 61 .dumpit = sunrpc_nl_ip_map_get_reqs_dumpit, 62 .policy = sunrpc_ip_map_get_reqs_nl_policy, 63 .maxattr = SUNRPC_A_IP_MAP_REQS_REQUESTS, 64 .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP, 65 }, 66 { 67 .cmd = SUNRPC_CMD_IP_MAP_SET_REQS, 68 .doit = sunrpc_nl_ip_map_set_reqs_doit, 69 .policy = sunrpc_ip_map_set_reqs_nl_policy, 70 .maxattr = SUNRPC_A_IP_MAP_REQS_REQUESTS, 71 .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO, 72 }, 73 { 74 .cmd = SUNRPC_CMD_UNIX_GID_GET_REQS, 75 .dumpit = sunrpc_nl_unix_gid_get_reqs_dumpit, 76 .policy = sunrpc_unix_gid_get_reqs_nl_policy, 77 .maxattr = SUNRPC_A_UNIX_GID_REQS_REQUESTS, 78 .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP, 79 }, 80 { 81 .cmd = SUNRPC_CMD_UNIX_GID_SET_REQS, 82 .doit = sunrpc_nl_unix_gid_set_reqs_doit, 83 .policy = sunrpc_unix_gid_set_reqs_nl_policy, 84 .maxattr = SUNRPC_A_UNIX_GID_REQS_REQUESTS, 85 .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO, 86 }, 87 { 88 .cmd = SUNRPC_CMD_CACHE_FLUSH, 89 .doit = sunrpc_nl_cache_flush_doit, 90 .policy = sunrpc_cache_flush_nl_policy, 91 .maxattr = SUNRPC_A_CACHE_FLUSH_MASK, 92 .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO, 93 }, 94 }; 95 96 static const struct genl_multicast_group sunrpc_nl_mcgrps[] = { 97 [SUNRPC_NLGRP_NONE] = { "none", }, 98 [SUNRPC_NLGRP_EXPORTD] = { "exportd", }, 99 }; 100 101 struct genl_family sunrpc_nl_family __ro_after_init = { 102 .name = SUNRPC_FAMILY_NAME, 103 .version = SUNRPC_FAMILY_VERSION, 104 .netnsok = true, 105 .parallel_ops = true, 106 .module = THIS_MODULE, 107 .split_ops = sunrpc_nl_ops, 108 .n_split_ops = ARRAY_SIZE(sunrpc_nl_ops), 109 .mcgrps = sunrpc_nl_mcgrps, 110 .n_mcgrps = ARRAY_SIZE(sunrpc_nl_mcgrps), 111 }; 112