From owner-cvs-src@FreeBSD.ORG Wed May 21 09:31:45 2008 Return-Path: Delivered-To: cvs-src@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 456391065678; Wed, 21 May 2008 09:31:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 2B8008FC17; Wed, 21 May 2008 09:31:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m4L9VjUg049514; Wed, 21 May 2008 09:31:45 GMT (envelope-from kib@repoman.freebsd.org) Received: (from kib@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m4L9VjWe049513; Wed, 21 May 2008 09:31:45 GMT (envelope-from kib) Message-Id: <200805210931.m4L9VjWe049513@repoman.freebsd.org> From: Konstantin Belousov Date: Wed, 21 May 2008 09:31:44 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/sys/fs/devfs devfs_int.h devfs_vnops.c src/sys/kern kern_conf.c kern_descrip.c src/sys/sys conf.h file.h proc.h X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 May 2008 09:31:45 -0000 kib 2008-05-21 09:31:44 UTC FreeBSD src repository Modified files: sys/fs/devfs devfs_int.h devfs_vnops.c sys/kern kern_conf.c kern_descrip.c sys/sys conf.h file.h proc.h Log: Implement the per-open file data for the cdev. The patch does not change the cdevsw KBI. Management of the data is provided by the functions int devfs_set_cdevpriv(void *priv, cdevpriv_dtr_t dtr); int devfs_get_cdevpriv(void **datap); void devfs_clear_cdevpriv(void); All of the functions are supposed to be called from the cdevsw method contexts. - devfs_set_cdevpriv assigns the priv as private data for the file descriptor which is used to initiate currently performed driver operation. dtr is the function that will be called when either the last refernce to the file goes away, the device is destroyed or devfs_clear_cdevpriv is called. - devfs_get_cdevpriv is the obvious accessor. - devfs_clear_cdevpriv allows to clear the private data for the still open file. Implementation keeps the driver-supplied pointers in the struct cdev_privdata, that is referenced both from the struct file and struct cdev, and cannot outlive any of the referee. Man pages will be provided after the KPI stabilizes. Reviewed by: jhb Useful suggestions from: jeff, antoine Debugging help and tested by: pho MFC after: 1 month Revision Changes Path 1.5 +11 -0 src/sys/fs/devfs/devfs_int.h 1.158 +109 -1 src/sys/fs/devfs/devfs_vnops.c 1.213 +9 -2 src/sys/kern/kern_conf.c 1.332 +6 -0 src/sys/kern/kern_descrip.c 1.237 +6 -0 src/sys/sys/conf.h 1.77 +2 -0 src/sys/sys/file.h 1.515 +1 -0 src/sys/sys/proc.h