From owner-freebsd-hackers Sun Dec 16 11:17:13 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from hunkular.glarp.com (hunkular.glarp.com [199.117.25.251]) by hub.freebsd.org (Postfix) with ESMTP id E0E7C37B419 for ; Sun, 16 Dec 2001 11:17:09 -0800 (PST) Received: from hunkular.glarp.com (localhost [127.0.0.1]) by hunkular.glarp.com (8.11.6/8.11.6) with ESMTP id fBGJH5u00621; Sun, 16 Dec 2001 12:17:06 -0700 (MST) (envelope-from huntting@hunkular.glarp.com) Message-Id: <200112161917.fBGJH5u00621@hunkular.glarp.com> To: Bruce M Simpson Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: closeing files in detach() In-Reply-To: Your message of "Thu, 13 Dec 2001 23:24:46 GMT." <20011213232446.D17058@spc.org> Date: Sun, 16 Dec 2001 12:17:05 -0700 From: Brad Huntting Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG >> There's a mention in the FBSD hacking guide that a detach() routine >> for a device driver can forcably close all open descriptors for >> its device before it unloads. >> >> How does one do this? > Check this out (from one of my USB device drivers I haven't yet > forced upon the world): > > /* nuke the vnodes for any processes attached to us. */ > vp = SLIST_FIRST(&sc->dev->si_hlist); > if (vp) > VOP_REVOKE(vp, REVOKEALL); > destroy_dev(sc->dev); > > This will cause all open fds for that device to be revoked. Er... Something is wrong here. destroy_dev() supposedly takes a dev_t which is typedef u_int32_t in . Are we using the same OS? I'm working with 4.4-RELEASE. brad To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message