@@ -2156,6 +2156,63 @@ int nfsd_nl_listener_get_doit(struct sk_buff *skb, struct genl_info *info)
21562156 return err ;
21572157}
21582158
2159+ /**
2160+ * nfsd_nl_pool_mode_set_doit - set the number of running threads
2161+ * @skb: reply buffer
2162+ * @info: netlink metadata and command arguments
2163+ *
2164+ * Return 0 on success or a negative errno.
2165+ */
2166+ int nfsd_nl_pool_mode_set_doit (struct sk_buff * skb , struct genl_info * info )
2167+ {
2168+ const struct nlattr * attr ;
2169+
2170+ if (GENL_REQ_ATTR_CHECK (info , NFSD_A_POOL_MODE_MODE ))
2171+ return - EINVAL ;
2172+
2173+ attr = info -> attrs [NFSD_A_POOL_MODE_MODE ];
2174+ return sunrpc_set_pool_mode (nla_data (attr ));
2175+ }
2176+
2177+ /**
2178+ * nfsd_nl_pool_mode_get_doit - get info about pool_mode
2179+ * @skb: reply buffer
2180+ * @info: netlink metadata and command arguments
2181+ *
2182+ * Return 0 on success or a negative errno.
2183+ */
2184+ int nfsd_nl_pool_mode_get_doit (struct sk_buff * skb , struct genl_info * info )
2185+ {
2186+ struct net * net = genl_info_net (info );
2187+ char buf [16 ];
2188+ void * hdr ;
2189+ int err ;
2190+
2191+ if (sunrpc_get_pool_mode (buf , ARRAY_SIZE (buf )) >= ARRAY_SIZE (buf ))
2192+ return - ERANGE ;
2193+
2194+ skb = genlmsg_new (GENLMSG_DEFAULT_SIZE , GFP_KERNEL );
2195+ if (!skb )
2196+ return - ENOMEM ;
2197+
2198+ err = - EMSGSIZE ;
2199+ hdr = genlmsg_iput (skb , info );
2200+ if (!hdr )
2201+ goto err_free_msg ;
2202+
2203+ err = nla_put_string (skb , NFSD_A_POOL_MODE_MODE , buf ) |
2204+ nla_put_u32 (skb , NFSD_A_POOL_MODE_NPOOLS , nfsd_nrpools (net ));
2205+ if (err )
2206+ goto err_free_msg ;
2207+
2208+ genlmsg_end (skb , hdr );
2209+ return genlmsg_reply (skb , info );
2210+
2211+ err_free_msg :
2212+ nlmsg_free (skb );
2213+ return err ;
2214+ }
2215+
21592216/**
21602217 * nfsd_net_init - Prepare the nfsd_net portion of a new net namespace
21612218 * @net: a freshly-created network namespace
0 commit comments