From owner-svn-src-all@FreeBSD.ORG Sat Sep 20 16:43:15 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CB9B9313; Sat, 20 Sep 2014 16:43:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AB8EBE96; Sat, 20 Sep 2014 16:43:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8KGhF5S095309; Sat, 20 Sep 2014 16:43:15 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8KGhEnt095304; Sat, 20 Sep 2014 16:43:14 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201409201643.s8KGhEnt095304@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 20 Sep 2014 16:43:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r271908 - in head/sys/netgraph/bluetooth: include socket X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Sep 2014 16:43:15 -0000 Author: jhb Date: Sat Sep 20 16:43:14 2014 New Revision: 271908 URL: http://svnweb.freebsd.org/changeset/base/271908 Log: Use callout(9) instead of timeout(9). Reviewed by: emax Modified: head/sys/netgraph/bluetooth/include/ng_btsocket_l2cap.h head/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c head/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c Modified: head/sys/netgraph/bluetooth/include/ng_btsocket_l2cap.h ============================================================================== --- head/sys/netgraph/bluetooth/include/ng_btsocket_l2cap.h Sat Sep 20 15:45:29 2014 (r271907) +++ head/sys/netgraph/bluetooth/include/ng_btsocket_l2cap.h Sat Sep 20 16:43:14 2014 (r271908) @@ -162,7 +162,7 @@ struct ng_btsocket_l2cap_pcb { u_int16_t flush_timo; /* flush timeout */ u_int16_t link_timo; /* link timeout */ - struct callout_handle timo; /* timeout */ + struct callout timo; /* timeout */ u_int32_t token; /* message token */ ng_btsocket_l2cap_rtentry_p rt; /* routing info */ Modified: head/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h ============================================================================== --- head/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h Sat Sep 20 15:45:29 2014 (r271907) +++ head/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h Sat Sep 20 16:43:14 2014 (r271908) @@ -296,7 +296,7 @@ struct ng_btsocket_rfcomm_pcb { int16_t tx_cred; /* TX credits */ struct mtx pcb_mtx; /* PCB lock */ - struct callout_handle timo; /* timeout */ + struct callout timo; /* timeout */ LIST_ENTRY(ng_btsocket_rfcomm_pcb) session_next;/* link to next */ LIST_ENTRY(ng_btsocket_rfcomm_pcb) next; /* link to next */ Modified: head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c ============================================================================== --- head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c Sat Sep 20 15:45:29 2014 (r271907) +++ head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c Sat Sep 20 16:43:14 2014 (r271908) @@ -1967,8 +1967,6 @@ ng_btsocket_l2cap_attach(struct socket * pcb->flush_timo = NG_L2CAP_FLUSH_TIMO_DEFAULT; pcb->link_timo = NG_L2CAP_LINK_TIMO_DEFAULT; - callout_handle_init(&pcb->timo); - /* * XXX Mark PCB mutex as DUPOK to prevent "duplicated lock of * the same type" message. When accepting new L2CAP connection @@ -1978,6 +1976,7 @@ ng_btsocket_l2cap_attach(struct socket * mtx_init(&pcb->pcb_mtx, "btsocks_l2cap_pcb_mtx", NULL, MTX_DEF|MTX_DUPOK); + callout_init_mtx(&pcb->timo, &pcb->pcb_mtx, 0); /* * Add the PCB to the list @@ -2664,8 +2663,8 @@ ng_btsocket_l2cap_timeout(ng_btsocket_l2 if (!(pcb->flags & NG_BTSOCKET_L2CAP_TIMO)) { pcb->flags |= NG_BTSOCKET_L2CAP_TIMO; - pcb->timo = timeout(ng_btsocket_l2cap_process_timeout, pcb, - bluetooth_l2cap_ertx_timeout()); + callout_reset(&pcb->timo, bluetooth_l2cap_ertx_timeout(), + ng_btsocket_l2cap_process_timeout, pcb); } else KASSERT(0, ("%s: Duplicated socket timeout?!\n", __func__)); @@ -2681,7 +2680,7 @@ ng_btsocket_l2cap_untimeout(ng_btsocket_ mtx_assert(&pcb->pcb_mtx, MA_OWNED); if (pcb->flags & NG_BTSOCKET_L2CAP_TIMO) { - untimeout(ng_btsocket_l2cap_process_timeout, pcb, pcb->timo); + callout_stop(&pcb->timo); pcb->flags &= ~NG_BTSOCKET_L2CAP_TIMO; } else KASSERT(0, @@ -2697,7 +2696,7 @@ ng_btsocket_l2cap_process_timeout(void * { ng_btsocket_l2cap_pcb_p pcb = (ng_btsocket_l2cap_pcb_p) xpcb; - mtx_lock(&pcb->pcb_mtx); + mtx_assert(&pcb->pcb_mtx, MA_OWNED); pcb->flags &= ~NG_BTSOCKET_L2CAP_TIMO; pcb->so->so_error = ETIMEDOUT; @@ -2731,8 +2730,6 @@ ng_btsocket_l2cap_process_timeout(void * "%s: Invalid socket state=%d\n", __func__, pcb->state); break; } - - mtx_unlock(&pcb->pcb_mtx); } /* ng_btsocket_l2cap_process_timeout */ /* Modified: head/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c ============================================================================== --- head/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c Sat Sep 20 15:45:29 2014 (r271907) +++ head/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c Sat Sep 20 16:43:14 2014 (r271908) @@ -434,7 +434,7 @@ ng_btsocket_rfcomm_attach(struct socket pcb->rx_cred = RFCOMM_DEFAULT_CREDITS; mtx_init(&pcb->pcb_mtx, "btsocks_rfcomm_pcb_mtx", NULL, MTX_DEF); - callout_handle_init(&pcb->timo); + callout_init_mtx(&pcb->timo, &pcb->pcb_mtx, 0); /* Add the PCB to the list */ mtx_lock(&ng_btsocket_rfcomm_sockets_mtx); @@ -3451,8 +3451,8 @@ ng_btsocket_rfcomm_timeout(ng_btsocket_r if (!(pcb->flags & NG_BTSOCKET_RFCOMM_DLC_TIMO)) { pcb->flags |= NG_BTSOCKET_RFCOMM_DLC_TIMO; pcb->flags &= ~NG_BTSOCKET_RFCOMM_DLC_TIMEDOUT; - pcb->timo = timeout(ng_btsocket_rfcomm_process_timeout, pcb, - ng_btsocket_rfcomm_timo * hz); + callout_reset(&pcb->timo, ng_btsocket_rfcomm_timo * hz, + ng_btsocket_rfcomm_process_timeout, pcb); } else panic("%s: Duplicated socket timeout?!\n", __func__); } /* ng_btsocket_rfcomm_timeout */ @@ -3467,7 +3467,7 @@ ng_btsocket_rfcomm_untimeout(ng_btsocket mtx_assert(&pcb->pcb_mtx, MA_OWNED); if (pcb->flags & NG_BTSOCKET_RFCOMM_DLC_TIMO) { - untimeout(ng_btsocket_rfcomm_process_timeout, pcb, pcb->timo); + callout_stop(&pcb->timo); pcb->flags &= ~NG_BTSOCKET_RFCOMM_DLC_TIMO; pcb->flags &= ~NG_BTSOCKET_RFCOMM_DLC_TIMEDOUT; } else @@ -3483,7 +3483,7 @@ ng_btsocket_rfcomm_process_timeout(void { ng_btsocket_rfcomm_pcb_p pcb = (ng_btsocket_rfcomm_pcb_p) xpcb; - mtx_lock(&pcb->pcb_mtx); + mtx_assert(&pcb->pcb_mtx, MA_OWNED); NG_BTSOCKET_RFCOMM_INFO( "%s: Timeout, so=%p, dlci=%d, state=%d, flags=%#x\n", @@ -3510,8 +3510,6 @@ ng_btsocket_rfcomm_process_timeout(void } ng_btsocket_rfcomm_task_wakeup(); - - mtx_unlock(&pcb->pcb_mtx); } /* ng_btsocket_rfcomm_process_timeout */ /*