From owner-freebsd-arch@FreeBSD.ORG Mon May 5 07:49:25 2008 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 697B01065679 for ; Mon, 5 May 2008 07:49:25 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:610:652::211]) by mx1.freebsd.org (Postfix) with ESMTP id 22AFE8FC2D for ; Mon, 5 May 2008 07:49:25 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 5DBCD1CC16; Mon, 5 May 2008 09:49:24 +0200 (CEST) Date: Mon, 5 May 2008 09:49:24 +0200 From: Ed Schouten To: Kostik Belousov Message-ID: <20080505074924.GF1181@hoeg.nl> References: <20080504171002.GN18958@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Bf1m62tZozKFsi1s" Content-Disposition: inline In-Reply-To: <20080504171002.GN18958@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: arch@freebsd.org Subject: Re: Per-open file private data for the cdevs X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 May 2008 07:49:25 -0000 --Bf1m62tZozKFsi1s Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Kostik Belousov wrote: > Since the review for the clone-at-open patch (fdclone) posted some time a= go > mostly says that it would be better to implement per-file private data > instead, I produced the patch along this line, I also thought about this. The new TTY layer I'm developing needs the following patch to implement /dev/ptmx and /dev/ptyXX compatibility: --- sys/fs/devfs/devfs_vnops.c +++ sys/fs/devfs/devfs_vnops.c @@ -800,9 +800,8 @@ if(fp =3D=3D NULL) return (error); #endif - KASSERT(fp->f_ops =3D=3D &badfileops, - ("Could not vnode bypass device on fdops %p", fp->f_ops)); - finit(fp, fp->f_flag, DTYPE_VNODE, dev, &devfs_ops_f); + if (fp->f_ops =3D=3D &badfileops) + finit(fp, fp->f_flag, DTYPE_VNODE, dev, &devfs_ops_f); return (error); } =20 This way drivers can just implement d_fdopen() and call finit() there. It's probably not as nice as having the per-fdesc stuff inside devfs itself, but I'm not sure the amount of drivers that needs this makes it worth adding it to devfs itself. --=20 Ed Schouten WWW: http://80386.nl/ --Bf1m62tZozKFsi1s Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkgevAQACgkQ52SDGA2eCwWzGwCeIFl/ThiskEJuMlsvtt5REEfs nrYAn1xlNZlcIF1ca7km6/+ye9uH8qjG =u/r8 -----END PGP SIGNATURE----- --Bf1m62tZozKFsi1s--