@@ -44,7 +44,6 @@
*/
static int debug_level;
-static int nl_family_id;
struct nfs_version {
uint8_t major;
@@ -84,16 +83,6 @@ static const struct option help_only_options[] = {
{ },
};
-static void debug(int level, const char *fmt, ...)
-{
- va_list args;
-
- va_start(args, fmt);
- if (level <= debug_level)
- vprintf(fmt, args);
- va_end(args);
-}
-
#define NFSD4_OPS_MAX_LEN sizeof(nfsd4_ops) / sizeof(nfsd4_ops[0])
static const char *nfsd4_ops[] = {
[OP_ACCESS] = "OP_ACCESS",
@@ -317,8 +306,6 @@ static void parse_threads_get(struct genlmsghdr *gnlh)
nla_for_each_attr(attr, genlmsg_attrdata(gnlh, 0),
genlmsg_attrlen(gnlh, 0), rem) {
- struct nlattr *a;
-
switch (nla_type(attr)) {
case NFSD_A_SERVER_GRACETIME:
printf("gracetime: %u\n", nla_get_u32(attr));
@@ -327,7 +314,7 @@ static void parse_threads_get(struct genlmsghdr *gnlh)
printf("leasetime: %u\n", nla_get_u32(attr));
break;
case NFSD_A_SERVER_SCOPE:
- printf("scope: %s\n", nla_data(attr));
+ printf("scope: %s\n", (const char *)nla_data(attr));
break;
case NFSD_A_SERVER_THREADS:
pool_threads[i++] = nla_get_u32(attr);
@@ -352,7 +339,7 @@ static void parse_pool_mode_get(struct genlmsghdr *gnlh)
genlmsg_attrlen(gnlh, 0), rem) {
switch (nla_type(attr)) {
case NFSD_A_POOL_MODE_MODE:
- printf("pool-mode: %s\n", nla_data(attr));
+ printf("pool-mode: %s\n", (const char *)nla_data(attr));
break;
case NFSD_A_POOL_MODE_NPOOLS:
printf("npools: %u\n", nla_get_u32(attr));
@@ -366,7 +353,6 @@ static void parse_pool_mode_get(struct genlmsghdr *gnlh)
static int recv_handler(struct nl_msg *msg, void *arg)
{
struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
- const struct nlattr *attr = genlmsg_attrdata(gnlh, 0);
switch (gnlh->cmd) {
case NFSD_CMD_RPC_STATUS_GET:
@@ -573,7 +559,7 @@ static void threads_usage(void)
static int threads_func(struct nl_sock *sock, int argc, char **argv)
{
uint8_t cmd = NFSD_CMD_THREADS_GET;
- uint32_t *pool_threads = NULL;
+ int *pool_threads = NULL;
int opt, pools = 0;
optind = 1;
@@ -589,7 +575,7 @@ static int threads_func(struct nl_sock *sock, int argc, char **argv)
char **targv = &argv[optind];
int i;
- pools = argc - optind, i;
+ pools = argc - optind;
pool_threads = alloca(pools * sizeof(*pool_threads));
cmd = NFSD_CMD_THREADS_SET;
@@ -785,8 +771,7 @@ static void version_usage(void)
static int version_func(struct nl_sock *sock, int argc, char ** argv)
{
- char *endptr = NULL;
- int opt, ret, threads, i;
+ int ret, i;
/* help is only valid as first argument after command */
if (argc > 1 &&
@@ -940,7 +925,7 @@ static int update_listeners(const char *str)
char buf[INET6_ADDRSTRLEN + 16];
char sign = *str;
char *netid, *addr, *port, *end;
- struct addrinfo *res, *ai;
+ struct addrinfo *res;
int i, ret;
struct addrinfo hints = { .ai_flags = AI_PASSIVE,
.ai_family = AF_INET,
@@ -1156,9 +1141,7 @@ static void listener_usage(void)
static int listener_func(struct nl_sock *sock, int argc, char ** argv)
{
- char *endptr = NULL;
- int ret, opt, threads, i;
- int argidx;
+ int ret, i;
/* help is only valid as first argument after command */
if (argc > 1 &&
@@ -1255,16 +1238,14 @@ static int pool_mode_func(struct nl_sock *sock, int argc, char **argv)
if (optind < argc) {
char **targv = &argv[optind];
- int i;
cmd = NFSD_CMD_POOL_MODE_SET;
/* empty string? */
- if (targv[i][0] == '\0') {
- fprintf(stderr, "Invalid threads value %s.\n", targv[i]);
+ if (*targv[0] == '\0') {
+ fprintf(stderr, "Invalid threads value %s.\n", targv[0]);
return 1;
}
-
pool_mode = targv[0];
}
return pool_mode_doit(sock, cmd, pool_mode);
@@ -1272,18 +1253,17 @@ static int pool_mode_func(struct nl_sock *sock, int argc, char **argv)
#define MAX_LISTENER_LEN (64 * 2 + 16)
-static int
+static void
add_listener(const char *netid, const char *addr, const char *port)
{
char buf[MAX_LISTENER_LEN];
- int ret;
if (strchr(addr, ':'))
- ret = snprintf(buf, MAX_LISTENER_LEN, "+%s:[%s]:%s",
- netid, addr, port);
+ snprintf(buf, MAX_LISTENER_LEN, "+%s:[%s]:%s",
+ netid, addr, port);
else
- ret = snprintf(buf, MAX_LISTENER_LEN, "+%s:%s:%s",
- netid, addr, port);
+ snprintf(buf, MAX_LISTENER_LEN, "+%s:%s:%s",
+ netid, addr, port);
buf[MAX_LISTENER_LEN - 1] = '\0';
update_listeners(buf);
}
Fix a pile of compiler warnings. Signed-off-by: Jeff Layton <jlayton@kernel.org> --- utils/nfsdctl/nfsdctl.c | 48 ++++++++++++++---------------------------------- 1 file changed, 14 insertions(+), 34 deletions(-)