From owner-svn-src-head@FreeBSD.ORG Wed Nov 14 17:36:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4334D5F4; Wed, 14 Nov 2012 17:36:07 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 27B948FC12; Wed, 14 Nov 2012 17:36:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAEHa7o1018139; Wed, 14 Nov 2012 17:36:07 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAEHa7FG018138; Wed, 14 Nov 2012 17:36:07 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201211141736.qAEHa7FG018138@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 14 Nov 2012 17:36:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243031 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Nov 2012 17:36:07 -0000 Author: ae Date: Wed Nov 14 17:36:06 2012 New Revision: 243031 URL: http://svnweb.freebsd.org/changeset/base/243031 Log: if_afdata lock was converted from mutex to rwlock a long ago, so we can replace IF_AFDATA_LOCK() macro depending to the access type. Sponsored by: Yandex LLC MFC after: 1 week Modified: head/sys/netinet6/scope6.c Modified: head/sys/netinet6/scope6.c ============================================================================== --- head/sys/netinet6/scope6.c Wed Nov 14 17:33:00 2012 (r243030) +++ head/sys/netinet6/scope6.c Wed Nov 14 17:36:06 2012 (r243031) @@ -121,11 +121,11 @@ scope6_set(struct ifnet *ifp, struct sco int error = 0; struct scope6_id *sid = NULL; - IF_AFDATA_LOCK(ifp); + IF_AFDATA_WLOCK(ifp); sid = SID(ifp); if (!sid) { /* paranoid? */ - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_WUNLOCK(ifp); return (EINVAL); } @@ -148,7 +148,7 @@ scope6_set(struct ifnet *ifp, struct sco */ if (i == IPV6_ADDR_SCOPE_INTFACELOCAL && idlist->s6id_list[i] != ifp->if_index) { - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_WUNLOCK(ifp); return (EINVAL); } @@ -160,7 +160,7 @@ scope6_set(struct ifnet *ifp, struct sco * IDs, but we check the consistency for * safety in later use. */ - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_WUNLOCK(ifp); return (EINVAL); } @@ -172,7 +172,7 @@ scope6_set(struct ifnet *ifp, struct sco sid->s6id_list[i] = idlist->s6id_list[i]; } } - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_WUNLOCK(ifp); return (error); } @@ -180,18 +180,19 @@ scope6_set(struct ifnet *ifp, struct sco int scope6_get(struct ifnet *ifp, struct scope6_id *idlist) { - /* We only need to lock the interface's afdata for SID() to work. */ - IF_AFDATA_LOCK(ifp); - struct scope6_id *sid = SID(ifp); + struct scope6_id *sid; + /* We only need to lock the interface's afdata for SID() to work. */ + IF_AFDATA_RLOCK(ifp); + sid = SID(ifp); if (sid == NULL) { /* paranoid? */ - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); return (EINVAL); } *idlist = *sid; - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); return (0); } @@ -408,7 +409,7 @@ in6_setscope(struct in6_addr *in6, struc u_int32_t zoneid = 0; struct scope6_id *sid; - IF_AFDATA_LOCK(ifp); + IF_AFDATA_RLOCK(ifp); sid = SID(ifp); @@ -425,12 +426,12 @@ in6_setscope(struct in6_addr *in6, struc */ if (IN6_IS_ADDR_LOOPBACK(in6)) { if (!(ifp->if_flags & IFF_LOOPBACK)) { - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); return (EINVAL); } else { if (ret_id != NULL) *ret_id = 0; /* there's no ambiguity */ - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); return (0); } } @@ -457,7 +458,7 @@ in6_setscope(struct in6_addr *in6, struc zoneid = 0; /* XXX: treat as global. */ break; } - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); if (ret_id != NULL) *ret_id = zoneid;