From eecc60305f3565e1e1bb12659d2fec4ea09ebbf1 Mon Sep 17 00:00:00 2001 From: kib Date: Mon, 16 Jun 2008 17:34:59 +0000 Subject: Struct cdev is always the member of the struct cdev_priv. When devfs needed to promote cdev to cdev_priv, the si_priv pointer was followed. Use member2struct() to calculate address of the wrapping cdev_priv. Rename si_priv to __si_reserved. Tested by: pho Reviewed by: ed MFC after: 2 weeks --- usr.bin/fstat/fstat.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'usr.bin/fstat') diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c index 90ffba8..886c3bb 100644 --- a/usr.bin/fstat/fstat.c +++ b/usr.bin/fstat/fstat.c @@ -97,6 +97,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -895,10 +896,8 @@ dev_t dev2udev(struct cdev *dev) { struct cdev_priv priv; - struct cdev si; - if (KVM_READ(dev, &si, sizeof si) && - KVM_READ(si.si_priv, &priv, sizeof priv)) { + if (KVM_READ(cdev2priv(dev), &priv, sizeof priv)) { return ((dev_t)priv.cdp_inode); } else { dprintf(stderr, "can't convert cdev *%p to a dev_t\n", dev); -- cgit v1.1