From owner-p4-projects@FreeBSD.ORG Sun Sep 21 14:48:29 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 388FE1065672; Sun, 21 Sep 2008 14:48:29 +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 F15A6106564A for ; Sun, 21 Sep 2008 14:48:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id E06F98FC28 for ; Sun, 21 Sep 2008 14:48:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id m8LEmSRJ082882 for ; Sun, 21 Sep 2008 14:48:28 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m8LEmSHf082876 for perforce@freebsd.org; Sun, 21 Sep 2008 14:48:28 GMT (envelope-from hselasky@FreeBSD.org) Date: Sun, 21 Sep 2008 14:48:28 GMT Message-Id: <200809211448.m8LEmSHf082876@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 150211 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Sep 2008 14:48:29 -0000 http://perforce.freebsd.org/chv.cgi?CH=150211 Change 150211 by hselasky@hselasky_laptop001 on 2008/09/21 14:48:19 We need to call "vnops.fo_close()" at close, because the file-ops were already equal to the bad file ops at open. Affected files ... .. //depot/projects/usb/src/sys/dev/usb2/core/usb2_core.h#21 edit .. //depot/projects/usb/src/sys/dev/usb2/core/usb2_dev.c#35 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_core.h#21 (text+ko) ==== @@ -50,6 +50,14 @@ #define USB_PROC_GET_GID(td) (td)->p_pgid #endif +#ifndef USB_VNOPS_FO_CLOSE +#define USB_VNOPS_FO_CLOSE(fp, td, perr) do { \ + (td)->td_fpop = (fp); \ + *(perr) = vnops.fo_close(fp, td); \ + (td)->td_fpop = NULL; \ +} while (0) +#endif + #ifndef USB_VNOPS_FO_STAT #define USB_VNOPS_FO_STAT(fp, sb, cred, td) \ vnops.fo_stat(fp, sb, cred, td) ==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_dev.c#35 (text+ko) ==== @@ -1234,11 +1234,11 @@ } } /* - * Magic: Take over the file so that we get all the callbacks + * Take over the file so that we get all the callbacks * directly and don't have to create another device: */ - fp->f_ops = &usb2_ops_f; - fp->f_data = ((uint8_t *)0) + devloc; + finit(fp, fp->f_flag, DTYPE_VNODE, + ((uint8_t *)0) + devloc, &usb2_ops_f); usb2_unref_device(&loc); @@ -1253,6 +1253,7 @@ static int usb2_close(struct cdev *dev, int flag, int mode, struct thread *p) { + DPRINTF("\n"); return (0); /* nothing to do */ } @@ -1461,7 +1462,9 @@ done: /* call old close method */ - return (fp->f_ops->fo_close) (fp, td); + USB_VNOPS_FO_CLOSE(fp, td, &err); + + return (err); } static int