From owner-p4-projects@FreeBSD.ORG Sun Oct 17 23:35:38 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2041A1065674; Sun, 17 Oct 2010 23:35:37 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87D3C1065672 for ; Sun, 17 Oct 2010 23:35:37 +0000 (UTC) (envelope-from afiveg@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 6B34C8FC15 for ; Sun, 17 Oct 2010 23:35:37 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id o9HNZbJd024942 for ; Sun, 17 Oct 2010 23:35:37 GMT (envelope-from afiveg@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o9HNZbRx024939 for perforce@freebsd.org; Sun, 17 Oct 2010 23:35:37 GMT (envelope-from afiveg@FreeBSD.org) Date: Sun, 17 Oct 2010 23:35:37 GMT Message-Id: <201010172335.o9HNZbRx024939@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to afiveg@FreeBSD.org using -f From: Alexandre Fiveg To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 184840 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Oct 2010 23:35:38 -0000 http://p4web.freebsd.org/@@184840?ac=10 Change 184840 by afiveg@cottonmouth on 2010/10/17 23:35:27 Small fixes: in the ringmap_detach() lock is set and extra cheking whether the list is empty. Moving locks in clear_capt_obj() Affected files ... .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#50 edit .. //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#32 edit .. //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#33 edit .. //depot/projects/soc2010/ringmap/scripts/tailf_ringmap_msgs.sh#27 edit Differences ... ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#50 (text+ko) ==== @@ -73,7 +73,7 @@ /* * The function should be called from attach function of generic network driver. * Here the ringmap structure is allocated and the character special device for - * the communication with user is created. + * the communication with user is created. Also default ringmap functions are set. */ struct ringmap * ringmap_attach(device_t dev, struct ringmap_functions *rf) @@ -125,7 +125,7 @@ /* Insert ringmap structure into the list */ SLIST_INSERT_HEAD(&ringmap_list_head, rm, entries); - /* Init the mutex to protecting our data */ + /* Init the mutex for protecting our data */ RINGMAP_LOCK_INIT(rm, device_get_nameunit(dev)); /* @@ -147,7 +147,7 @@ * ringmap */ return (rm); -} +} /* @@ -174,14 +174,21 @@ clear_capt_object((void *)co); } + RINGMAP_LOCK(rm); + /* To be sure */ + if (!SLIST_EMPTY(&rm->object_list)) { + RINGMAP_WARN(There are still active capturing objects); + } /* Destroy char device associated with ringmap */ if (rm->cdev != NULL) destroy_dev(rm->cdev); - RINGMAP_LOCK_DESTROY(rm); - /* And remove ringmap from global list */ SLIST_REMOVE(&ringmap_list_head, rm, ringmap, entries); + + RINGMAP_UNLOCK(rm); + + RINGMAP_LOCK_DESTROY(rm); FREE(rm, M_DEVBUF); @@ -192,7 +199,7 @@ /****************************************************************** - * This func will called as result of open(2). Here we allocate + * This func is called as result of open(2). Here we allocate * the memory for the new ring and capt_object structure (so called * capturing object). Capturing object represents the thread with * its ring. @@ -355,10 +362,8 @@ co = (struct capt_object *)data; + RINGMAP_LOCK(co->rm); if (co != NULL) { - - RINGMAP_LOCK(co->rm); - rm = co->rm; #if (__RINGMAP_DEB) printf("[%s] Object to delete:\n", __func__); @@ -376,12 +381,10 @@ } else { RINGMAP_WARN(Incorrect value of rm->open_cnt); } - - RINGMAP_UNLOCK(rm); - } else { RINGMAP_FUNC_DEBUG(NULL pointer to the capturing object!); } + RINGMAP_UNLOCK(rm); RINGMAP_FUNC_DEBUG(end); } ==== //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#32 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#33 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/scripts/tailf_ringmap_msgs.sh#27 (text+ko) ====