Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 May 2008 09:49:24 +0200
From:      Ed Schouten <ed@80386.nl>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        arch@freebsd.org
Subject:   Re: Per-open file private data for the cdevs
Message-ID:  <20080505074924.GF1181@hoeg.nl>
In-Reply-To: <20080504171002.GN18958@deviant.kiev.zoral.com.ua>
References:  <20080504171002.GN18958@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

--Bf1m62tZozKFsi1s
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* Kostik Belousov <kostikbel@gmail.com> 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 <ed@80386.nl>
 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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080505074924.GF1181>