On Thu, Mar 31, 2016 at 12:31:14PM +0000, Miod Vallat wrote:
>
> > Thank you all for the input. Allocatig the bitmap via malloc() really
> > seems like the way to go, so we don't waste space for non-cloning
> > devices. See updated patch below.
> >
> > Would it make sense to move the (rdev == VCHR && ...) condition to a
> > macro in <sys/specdev.h>? I figured it's only used twice, so I inlined
> > it.
> >
> > Comments/Ok?
>
> You can get rid of the `clonable VCHR device' test in vgonel() and call
> free() v_specbitmap unconditionally.
>
Unfortunately, this is not possible. v_specbitmap is a #define that
resolves to a member in a union, so it could be mangled in vnodes that
don't represent clonable VCHR devices.
The relevant parts from <sys/specdev.h>:
struct specinfo {
[...]
union {
struct vnode *ci_parent; /* pointer back to parent device */
u_int8_t *ci_bitmap; /* bitmap of devices cloned off us */
} si_ci;
};
[...]
#define v_specbitmap v_specinfo->si_ci.ci_bitmap
natano