From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 13 18:14:40 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A982F16A41C; Mon, 13 Jun 2005 18:14:40 +0000 (GMT) (envelope-from SRS0+0b851353296582aa3a45+659+infradead.org+hch@pentafluge.srs.infradead.org) Received: from pentafluge.infradead.org (pentafluge.infradead.org [213.146.154.40]) by mx1.FreeBSD.org (Postfix) with ESMTP id F22A243D1D; Mon, 13 Jun 2005 18:14:39 +0000 (GMT) (envelope-from SRS0+0b851353296582aa3a45+659+infradead.org+hch@pentafluge.srs.infradead.org) Received: from hch by pentafluge.infradead.org with local (Exim 4.43 #1 (Red Hat Linux)) id 1DhtSF-0000pU-HI; Mon, 13 Jun 2005 19:14:35 +0100 Date: Mon, 13 Jun 2005 19:14:35 +0100 From: Christoph Hellwig To: Julian Elischer Message-ID: <20050613181435.GA3096@infradead.org> References: <42ADC762.6010801@elischer.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42ADC762.6010801@elischer.org> User-Agent: Mutt/1.4.1i X-SRS-Rewrite: SMTP reverse-path rewritten from by pentafluge.infradead.org See http://www.infradead.org/rpr.html Cc: Daniel Eischen , freebsd-hackers@freebsd.org, Apache Xie Subject: Re: contigmalloc() and mmap() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jun 2005 18:14:40 -0000 On Mon, Jun 13, 2005 at 10:50:26AM -0700, Julian Elischer wrote: > > Several times in the past we've seen people complainign that Linux > allows a device driver to know > who called it and somehow it seems to store somewhere some information > about who > openned the device.. thos somehow allows linux to store an arbitrary > structure > for each openning process. I thin from the sond of it that he wants to > do something > similar. From the sond of it he wants to have a different buffer be used > depending on > who is calling. This would partly work but would not work when processes > fork etc. > > I think Linux must do some extra housekeeping in this case. What Linux does is pretty simple. The driver has access to the file structure, and this structure has a field for driver private data. It can store private data in open and free it again in the release callback.