Re: [PATCH 21/24] Removed warnings from network.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/20/10 07:37 PM, Steve Dickson wrote:
network.c: In function 'nfs_verify_family':
network.c:1366: warning: unused parameter 'family'

I thought that the preferred coding style is to keep "#ifdef" out of mainline code by having alternate definitions of functions, as was done here.

A cleaner solution would be to leave the alternate definition of nfs_verify_family() and use

  __attribute__((unused))

for the unused parameter.

Signed-off-by: Steve Dickson<steved@xxxxxxxxxx>
---
  utils/mount/network.c |   19 +++++++++----------
  1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/utils/mount/network.c b/utils/mount/network.c
index ffb18ab..8d48ce0 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -1362,11 +1362,6 @@ nfs_nfs_port(struct mount_options *options, unsigned long *port)
  #ifdef IPV6_SUPPORTED
  sa_family_t	config_default_family = AF_UNSPEC;

-static int
-nfs_verify_family(sa_family_t family)
-{
-	return 1;
-}
  #else /* IPV6_SUPPORTED */
  sa_family_t	config_default_family = AF_INET;

@@ -1410,13 +1405,15 @@ int nfs_nfs_proto_family(struct mount_options *options,
  		}
  	}

-	if (!nfs_verify_family(tmp_family))
-		goto out_err;
+#ifndef IPV6_SUPPORTED
+	if (!nfs_verify_family(tmp_family)) {
+		errno = EAFNOSUPPORT;
+		return 0;
+	}
+#endif
+
  	*family = tmp_family;
  	return 1;
-out_err:
-	errno = EAFNOSUPPORT;
-	return 0;
  }

  /*
@@ -1566,8 +1563,10 @@ int nfs_mount_proto_family(struct mount_options *options,
  			errno = EPROTONOSUPPORT;
  			goto out_err;
  		}
+#ifndef IPV6_SUPPORTED
  		if (!nfs_verify_family(tmp_family))
  			goto out_err;
+#endif
  		*family = tmp_family;
  		return 1;
  	}

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux