summaryrefslogtreecommitdiffstats
path: root/usr.bin/fstat
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2008-06-16 17:34:59 +0000
committerkib <kib@FreeBSD.org>2008-06-16 17:34:59 +0000
commiteecc60305f3565e1e1bb12659d2fec4ea09ebbf1 (patch)
tree8e320b542868d0439ab549cd9da52c45bb24aabf /usr.bin/fstat
parent4c48f0aa48a663c0fbd8b13ab1334deff50098f0 (diff)
downloadFreeBSD-src-eecc60305f3565e1e1bb12659d2fec4ea09ebbf1.zip
FreeBSD-src-eecc60305f3565e1e1bb12659d2fec4ea09ebbf1.tar.gz
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
Diffstat (limited to 'usr.bin/fstat')
-rw-r--r--usr.bin/fstat/fstat.c5
1 files changed, 2 insertions, 3 deletions
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 <pwd.h>
#include <stdio.h>
#include <stdlib.h>
+#include <stddef.h>
#include <string.h>
#include <unistd.h>
#include <netdb.h>
@@ -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);
OpenPOWER on IntegriCloud