From: Justin Mitchell <jumitche@redhat.com>
To: Steve Dickson <steved@redhat.com>
Cc: linux-nfs <linux-nfs@vger.kernel.org>,
"J. Bruce Fields" <bfields@redhat.com>
Subject: [PATCH 7/7] nfs-utils: cleanup warnings from merged libnfsidmap code
Date: Thu, 14 Sep 2017 15:07:38 +0100 [thread overview]
Message-ID: <1505398058.3665.11.camel@redhat.com> (raw)
In-Reply-To: <1505397745.3665.4.camel@redhat.com>
Clean up a bunch of warnings about unused parameters,
signedness differences, etc that we inherited from
the merged libnfsidmap code.
Signed-off-by: Justin Mitchell <jumitche@redhat.com>
---
support/nfsidmap/libnfsidmap.c | 10 ++++++----
support/nfsidmap/nfsidmap_internal.h | 7 +++++++
support/nfsidmap/nss.c | 6 +++---
support/nfsidmap/static.c | 20 +++++++++++---------
support/nfsidmap/umich_ldap.c | 11 ++++++-----
5 files changed, 33 insertions(+), 21 deletions(-)
diff --git a/support/nfsidmap/libnfsidmap.c b/support/nfsidmap/libnfsidmap.c
index aa368b7..931387a 100644
--- a/support/nfsidmap/libnfsidmap.c
+++ b/support/nfsidmap/libnfsidmap.c
@@ -103,7 +103,7 @@ nfs4_idmap_log_function_t idmap_log_func = default_logger;
static char * toupper_str(char *s)
{
- int i;
+ size_t i;
for (i=0; i < strlen(s); i++)
s[i] = toupper(s[i]);
return s;
@@ -128,7 +128,8 @@ static int id_as_chars(char *name, uid_t *id)
static int dns_txt_query(char *domain, char **nfs4domain)
{
char *txtname = NFS4DNSTXTREC;
- char *msg, *answ, *eom, *mptr;
+ unsigned char *msg, *eom, *mptr;
+ char *answ;
int len, status = -1;
HEADER *hdr;
@@ -323,7 +324,8 @@ out:
unload_plugins(plgns);
return ret;
}
-void nfs4_cleanup_name_mapping()
+
+void nfs4_cleanup_name_mapping(void)
{
if (nfs4_plugins)
unload_plugins(nfs4_plugins);
@@ -534,7 +536,7 @@ struct conf_list *get_local_realms(void)
}
int
-nfs4_get_default_domain(char *server, char *domain, size_t len)
+nfs4_get_default_domain(char *UNUSED(server), char *domain, size_t len)
{
char *d = get_default_domain();
diff --git a/support/nfsidmap/nfsidmap_internal.h b/support/nfsidmap/nfsidmap_internal.h
index 6696f50..a327862 100644
--- a/support/nfsidmap/nfsidmap_internal.h
+++ b/support/nfsidmap/nfsidmap_internal.h
@@ -70,3 +70,10 @@ extern nfs4_idmap_log_function_t idmap_log_func;
/* Level zero always prints, others print depending on verbosity level */
#define IDMAP_LOG(LVL, MSG) \
do { if (LVL <= idmap_verbosity) (*idmap_log_func)MSG; } while (0)
+
+#ifdef __GNUC__
+#define UNUSED(foo) UNUSED_ ## foo __attribute__((__unused__))
+#else
+#define UNUSED(foo) UNUSED_ ## foo
+#endif
+
diff --git a/support/nfsidmap/nss.c b/support/nfsidmap/nss.c
index 48215ff..a86d768 100644
--- a/support/nfsidmap/nss.c
+++ b/support/nfsidmap/nss.c
@@ -379,7 +379,7 @@ out:
static int nss_gss_princ_to_ids(char *secname, char *princ,
uid_t *uid, uid_t *gid,
- extra_mapping_params **ex)
+ extra_mapping_params **UNUSED(ex))
{
struct passwd *pw;
int err = 0;
@@ -429,7 +429,7 @@ out:
int nss_gss_princ_to_grouplist(char *secname, char *princ,
gid_t *groups, int *ngroups,
- extra_mapping_params **ex)
+ extra_mapping_params **UNUSED(ex))
{
struct passwd *pw;
int ret = -EINVAL;
@@ -462,7 +462,7 @@ struct trans_func nss_trans = {
.gss_princ_to_grouplist = nss_gss_princ_to_grouplist,
};
-struct trans_func *libnfsidmap_plugin_init()
+struct trans_func *libnfsidmap_plugin_init(void)
{
return (&nss_trans);
}
diff --git a/support/nfsidmap/static.c b/support/nfsidmap/static.c
index 37b293b..c82d7f3 100644
--- a/support/nfsidmap/static.c
+++ b/support/nfsidmap/static.c
@@ -92,7 +92,8 @@ static __inline__ u_int8_t gid_hash (gid_t gid)
LIST_HEAD (uid_mappings, uid_mapping) uid_mappings[256];
LIST_HEAD (gid_mappings, gid_mapping) gid_mappings[256];
-static struct passwd *static_getpwnam(const char *name, const char *domain,
+static struct passwd *static_getpwnam(const char *name,
+ const char *UNUSED(domain),
int *err_p)
{
struct passwd *pw;
@@ -142,8 +143,9 @@ err:
return NULL;
}
-static struct group *static_getgrnam(const char *name, const char *domain,
- int *err_p)
+static struct group *static_getgrnam(const char *name,
+ const char *UNUSED(domain),
+ int *err_p)
{
struct group *gr;
struct grbuf *buf;
@@ -194,7 +196,7 @@ err:
static int static_gss_princ_to_ids(char *secname, char *princ,
uid_t *uid, uid_t *gid,
- extra_mapping_params **ex)
+ extra_mapping_params **UNUSED(ex))
{
struct passwd *pw;
int err;
@@ -216,7 +218,7 @@ static int static_gss_princ_to_ids(char *secname, char *princ,
static int static_gss_princ_to_grouplist(char *secname, char *princ,
gid_t *groups, int *ngroups,
- extra_mapping_params **ex)
+ extra_mapping_params **UNUSED(ex))
{
struct passwd *pw;
int err;
@@ -266,7 +268,7 @@ static int static_name_to_gid(char *name, gid_t *gid)
return -err;
}
-static int static_uid_to_name(uid_t uid, char *domain, char *name, size_t len)
+static int static_uid_to_name(uid_t uid, char *UNUSED(domain), char *name, size_t UNUSED(len))
{
struct uid_mapping * um;
@@ -281,7 +283,7 @@ static int static_uid_to_name(uid_t uid, char *domain, char *name, size_t len)
return -ENOENT;
}
-static int static_gid_to_name(gid_t gid, char *domain, char *name, size_t len)
+static int static_gid_to_name(gid_t gid, char *UNUSED(domain), char *name, size_t UNUSED(len))
{
struct gid_mapping * gm;
@@ -301,7 +303,7 @@ static int static_gid_to_name(gid_t gid, char *domain, char *name, size_t len)
* uid_to_name functions will be fast enough.
*/
-static int static_init() {
+static int static_init(void) {
int err;
struct conf_list * princ_list = NULL;
struct conf_list_node * cln, *next;
@@ -404,7 +406,7 @@ struct trans_func static_trans = {
.gss_princ_to_grouplist = static_gss_princ_to_grouplist,
};
-struct trans_func *libnfsidmap_plugin_init()
+struct trans_func *libnfsidmap_plugin_init(void)
{
return (&static_trans);
}
diff --git a/support/nfsidmap/umich_ldap.c b/support/nfsidmap/umich_ldap.c
index 664f282..2258aa8 100644
--- a/support/nfsidmap/umich_ldap.c
+++ b/support/nfsidmap/umich_ldap.c
@@ -970,7 +970,8 @@ out:
*/
static int
umichldap_gss_princ_to_ids(char *secname, char *principal,
- uid_t *uid, gid_t *gid, extra_mapping_params **ex)
+ uid_t *uid, gid_t *gid,
+ extra_mapping_params **UNUSED(ex))
{
uid_t rtnd_uid = -1;
gid_t rtnd_gid = -1;
@@ -1012,20 +1013,20 @@ umichldap_name_to_gid(char *name, gid_t *gid)
}
static int
-umichldap_uid_to_name(uid_t uid, char *domain, char *name, size_t len)
+umichldap_uid_to_name(uid_t uid, char *UNUSED(domain), char *name, size_t len)
{
return umich_id_to_name(uid, IDTYPE_USER, &name, len, &ldap_info);
}
static int
-umichldap_gid_to_name(gid_t gid, char *domain, char *name, size_t len)
+umichldap_gid_to_name(gid_t gid, char *UNUSED(domain), char *name, size_t len)
{
return umich_id_to_name(gid, IDTYPE_GROUP, &name, len, &ldap_info);
}
static int
umichldap_gss_princ_to_grouplist(char *secname, char *principal,
- gid_t *groups, int *ngroups, extra_mapping_params **ex)
+ gid_t *groups, int *ngroups, extra_mapping_params **UNUSED(ex))
{
int err = -EINVAL;
@@ -1296,7 +1297,7 @@ struct trans_func umichldap_trans = {
.gss_princ_to_grouplist = umichldap_gss_princ_to_grouplist,
};
-struct trans_func *libnfsidmap_plugin_init()
+struct trans_func *libnfsidmap_plugin_init(void)
{
return (&umichldap_trans);
}
--
1.8.3.1
next prev parent reply other threads:[~2017-09-14 14:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-14 14:02 [PATCH 0/7] nfs-utils: Merge libnfsidmap tree with nfs-utils UPDATED Justin Mitchell
2017-09-14 14:03 ` [PATCH 1/7] nfs-utils: const-ify the config handling functions Justin Mitchell
2017-09-14 14:03 ` [PATCH 2/7] nfs-utils: Merge conf_get_str and conf_get_section Justin Mitchell
2017-09-14 14:04 ` [PATCH 3/7] nfs-utils: Add get_str with default value Justin Mitchell
2017-09-14 14:05 ` [PATCH 4/7] nfs-utils: split conffile to a separate convenience lib Justin Mitchell
2017-09-14 14:06 ` [PATCH 6/7] integrate libnfsidmap code with rest of nfs-utils Justin Mitchell
2017-09-14 14:07 ` Justin Mitchell [this message]
2017-10-02 14:03 ` [PATCH 0/7] nfs-utils: Merge libnfsidmap tree with nfs-utils UPDATED Steve Dickson
2017-10-02 16:38 ` J. Bruce Fields
2017-10-03 8:15 ` Justin Mitchell
2017-10-30 14:49 ` Steve Dickson
-- strict thread matches above, loose matches on Subject: below --
2017-09-13 13:58 [PATCH 0/7] nfs-utils: Merge libnfsidmap tree with nfs-utils Justin Mitchell
2017-09-13 14:06 ` [PATCH 7/7] nfs-utils: cleanup warnings from merged libnfsidmap code Justin Mitchell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1505398058.3665.11.camel@redhat.com \
--to=jumitche@redhat.com \
--cc=bfields@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=steved@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.