git: 3b887005b4bb - main - rpc.lockd: Explicitly cast enum nlm_stats values to enum nlm4_stats.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Mon, 03 Oct 2022 23:11:23 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=3b887005b4bb215e0e052ae81fe31c2c0d5f4f35

commit 3b887005b4bb215e0e052ae81fe31c2c0d5f4f35
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-10-03 23:10:42 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-10-03 23:10:42 +0000

    rpc.lockd: Explicitly cast enum nlm_stats values to enum nlm4_stats.
    
    NLM 4 status values are a superset of the older NLM protocol so these
    casts are safe while pacifying -Wenum-conversion warnings from GCC.
    
    Reviewed by:    rmacklem
    Differential Revision:  https://reviews.freebsd.org/D36816
---
 usr.sbin/rpc.lockd/lock_proc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/usr.sbin/rpc.lockd/lock_proc.c b/usr.sbin/rpc.lockd/lock_proc.c
index 160e1844e5a8..395baf399832 100644
--- a/usr.sbin/rpc.lockd/lock_proc.c
+++ b/usr.sbin/rpc.lockd/lock_proc.c
@@ -999,7 +999,7 @@ nlm4_lock_4_svc(nlm4_lockargs *arg, struct svc_req *rqstp)
 	/* copy cookie from arg to result.  See comment in nlm_test_4() */
 	res.cookie = arg->cookie;
 
-	res.stat.stat = getlock(arg, rqstp, LOCK_MON | LOCK_V4);
+	res.stat.stat = (enum nlm4_stats)getlock(arg, rqstp, LOCK_MON | LOCK_V4);
 	return (&res);
 }
 
@@ -1012,7 +1012,7 @@ nlm4_lock_msg_4_svc(nlm4_lockargs *arg, struct svc_req *rqstp)
 		log_from_addr("nlm4_lock_msg", rqstp);
 
 	res.cookie = arg->cookie;
-	res.stat.stat = getlock(arg, rqstp, LOCK_MON | LOCK_ASYNC | LOCK_V4);
+	res.stat.stat = (enum nlm4_stats)getlock(arg, rqstp, LOCK_MON | LOCK_ASYNC | LOCK_V4);
 	transmit4_result(NLM4_LOCK_RES, &res, getrpcaddr(rqstp));
 
 	return (NULL);
@@ -1039,7 +1039,7 @@ nlm4_cancel_4_svc(nlm4_cancargs *arg, struct svc_req *rqstp)
 	 * Since at present we never return 'nlm_blocked', there can never be
 	 * a lock to cancel, so this call always fails.
 	 */
-	res.stat.stat = unlock(&arg->alock, LOCK_CANCEL);
+	res.stat.stat = (enum nlm4_stats)unlock(&arg->alock, LOCK_CANCEL);
 	return (&res);
 }
 
@@ -1056,7 +1056,7 @@ nlm4_cancel_msg_4_svc(nlm4_cancargs *arg, struct svc_req *rqstp)
 	 * Since at present we never return 'nlm_blocked', there can never be
 	 * a lock to cancel, so this call always fails.
 	 */
-	res.stat.stat = unlock(&arg->alock, LOCK_CANCEL | LOCK_V4);
+	res.stat.stat = (enum nlm4_stats)unlock(&arg->alock, LOCK_CANCEL | LOCK_V4);
 	transmit4_result(NLM4_CANCEL_RES, &res, getrpcaddr(rqstp));
 	return (NULL);
 }
@@ -1077,7 +1077,7 @@ nlm4_unlock_4_svc(nlm4_unlockargs *arg, struct svc_req *rqstp)
 	if (debug_level)
 		log_from_addr("nlm4_unlock", rqstp);
 
-	res.stat.stat = unlock(&arg->alock, LOCK_V4);
+	res.stat.stat = (enum nlm4_stats)unlock(&arg->alock, LOCK_V4);
 	res.cookie = arg->cookie;
 
 	return (&res);
@@ -1091,7 +1091,7 @@ nlm4_unlock_msg_4_svc(nlm4_unlockargs *arg, struct svc_req *rqstp)
 	if (debug_level)
 		log_from_addr("nlm4_unlock_msg", rqstp);
 
-	res.stat.stat = unlock(&arg->alock, LOCK_V4);
+	res.stat.stat = (enum nlm4_stats)unlock(&arg->alock, LOCK_V4);
 	res.cookie = arg->cookie;
 
 	transmit4_result(NLM4_UNLOCK_RES, &res, getrpcaddr(rqstp));