Making Linux stat() less evil
Alexander Leidinger
Alexander at Leidinger.net
Fri Feb 20 04:40:21 PST 2009
Quoting Ed Schouten <ed at 80386.nl> (from Thu, 19 Feb 2009 22:27:49 +0100):
> Roman,
>
> After some discussion with kib@ on IRC, I changed the patch a little: I
> added a new function called kern_statat_vnhook(). This function allows
> the Linuxolator to use a hook to modify struct stat, to reduce some
> redundant code:
>
> http://80386.nl/pub/linux-stat.diff
>
> Shall I commit this patch to SVN?
From your patch:
---snip---
@@ -2359,6 +2366,8 @@
vfslocked = NDHASGIANT(&nd);
error = vn_stat(nd.ni_vp, &sb, td->td_ucred, NOCRED, td);
if (!error) {
+ if (hook != NULL)
+ hook(nd.ni_vp, &sb);
SDT_PROBE(vfs, , stat, mode, path, sb.st_mode, 0, 0, 0);
if (S_ISREG(sb.st_mode))
SDT_PROBE(vfs, , stat, reg, path, pathseg, 0, 0, 0);
---snip---
I think you should call the hook after SDT_PROBE, not before. This way
it doesn't matter what the hook does to sb, the dtrace probe will get
what it expects (the FreeBSD style sb). I don't think we need to add
another dtrace probe here after the probe, as I think this should be
handled somewhere near the code of the hook (in this case in the
linuxulator... which means I will take care about this in my
linuxulator-dtrace branch).
Bye,
Alexander.
--
You are a bundle of energy, always on the go.
http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137
More information about the freebsd-emulation
mailing list