Date: Tue, 6 May 2008 08:12:15 +0200 From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: Kostik Belousov <kostikbel@gmail.com> Cc: arch@freebsd.org Subject: Re: Per-open file private data for the cdevs Message-ID: <20080506061215.GB2508@garage.freebsd.pl> In-Reply-To: <20080505145631.GT18958@deviant.kiev.zoral.com.ua> References: <20080504171002.GN18958@deviant.kiev.zoral.com.ua> <20080505081355.GB1628@garage.freebsd.pl> <20080505145631.GT18958@deviant.kiev.zoral.com.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
--V88s5gaDVPzZ0KCq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 05, 2008 at 05:56:31PM +0300, Kostik Belousov wrote: > On Mon, May 05, 2008 at 10:13:55AM +0200, Pawel Jakub Dawidek wrote: > > Can you see if my OSD (Object-Specific-Data) KPI can be useful here? > > I've it only in perforce for now, but I think it's what you are looking > > for. I use it for jails and threads currently, but it is trivial to use > > it for other objects. Take a look: > >=20 > > http://perforce.freebsd.org/fileViewer.cgi?FSPC=3D//depot/user/pjd/zfs= /sys/sys/osd.h&REV=3D3 > >=20 > > When your code is loaded/initialized you call: > >=20 > > static int slot; > >=20 > > slot =3D osd_file_register(mod_destroy); > >=20 > > Where mod_destroy is a function which knows how to free your private > > data. On unload: > >=20 > > osd_file_deregister(slot); > >=20 > > Now, when you want to attach private data: > >=20 > > error =3D osd_file_set(fp, slot, ptr_to_your_data); > >=20 > > You can get it with: > >=20 > > ptr =3D osd_file_get(fp, slot); > This is a nice feature, but I think that privdata is a fundamental > internal operation of the kernel, and it would be wrong to use > the OSD. [...] OSD is there to be used mostly by optional modules. For example if ZFS is not loaded there is no need to keep a pointer to its private data in struct prison and struct thread. > [...] In fact, the object we shall attach OSD to is the struct > file, and we would need to export the struct file to the cdevsw operation= s. > Since it both breaks current ABI and complicates the future changes to > the struct file, I would much prefer to not engage this route. Ok. --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --V88s5gaDVPzZ0KCq Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFIH/a/ForvXbEpPzQRAmQ5AJ4/4aNF7nbZSXibdtD76uUZVNR71wCfUAo5 dZ5C7dh9TDj5ey1w3cjad4M= =BKfz -----END PGP SIGNATURE----- --V88s5gaDVPzZ0KCq--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080506061215.GB2508>