From: Chuck Lever Date: Fri, 11 Dec 2009 15:41:45 +0000 (-0500) Subject: mount.nfs: make nfs_lookup() global X-Git-Tag: nfs-utils-1-2-2-rc2~6 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=9889b48572e672f4535ca9dafd98d81146b7b834;p=nfs-utils.git mount.nfs: make nfs_lookup() global Expose a DNS query API that allows callers to request DNS results from a specific address family. Signed-off-by: Chuck Lever Signed-off-by: Steve Dickson --- diff --git a/utils/mount/network.c b/utils/mount/network.c index ecb5acc..7d9accd 100644 --- a/utils/mount/network.c +++ b/utils/mount/network.c @@ -193,8 +193,18 @@ static const unsigned int *nfs_default_proto() } #endif /* MOUNT_CONFIG */ -static int nfs_lookup(const char *hostname, const sa_family_t family, - struct sockaddr *sap, socklen_t *salen) +/** + * nfs_lookup - resolve hostname to an IPv4 or IPv6 socket address + * @hostname: pointer to C string containing DNS hostname to resolve + * @family: address family hint + * @sap: pointer to buffer to fill with socket address + * @len: IN: size of buffer to fill; OUT: size of socket address + * + * Returns 1 and places a socket address at @sap if successful; + * otherwise zero. + */ +int nfs_lookup(const char *hostname, const sa_family_t family, + struct sockaddr *sap, socklen_t *salen) { struct addrinfo *gai_results; struct addrinfo gai_hint = { diff --git a/utils/mount/network.h b/utils/mount/network.h index 7eb89b0..2cdf02e 100644 --- a/utils/mount/network.h +++ b/utils/mount/network.h @@ -45,6 +45,8 @@ int nfs_probe_bothports(const struct sockaddr *, const socklen_t, const socklen_t, struct pmap *); int nfs_gethostbyname(const char *, struct sockaddr_in *); int nfs_name_to_address(const char *, struct sockaddr *, socklen_t *); +int nfs_lookup(const char *hostname, const sa_family_t family, + struct sockaddr *sap, socklen_t *salen); int nfs_string_to_sockaddr(const char *, struct sockaddr *, socklen_t *); int nfs_present_sockaddr(const struct sockaddr *, const socklen_t, char *, const size_t);