summaryrefslogtreecommitdiffstats
path: root/sys/dev/cfi/cfi_disk.c
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2013-06-12 12:51:43 +0000
committermav <mav@FreeBSD.org>2013-06-12 12:51:43 +0000
commitfe855c3b46ff660d64da383e281859d4d21bc434 (patch)
treec970f0c68e475aece32cf8fed5bfd40ed584d038 /sys/dev/cfi/cfi_disk.c
parentf1ebf2df2f13be56f0b04cf5d1daa9775d861029 (diff)
downloadFreeBSD-src-fe855c3b46ff660d64da383e281859d4d21bc434.zip
FreeBSD-src-fe855c3b46ff660d64da383e281859d4d21bc434.tar.gz
Use direct custom implementations instead of g_handleattr() for CFI and NAND
d_getattr(). Since these drivers use disk(9) KPI and not directly GEOM, use of that function means KPI layering violation, causing extra g_io_deliver() call for the request.
Diffstat (limited to 'sys/dev/cfi/cfi_disk.c')
-rw-r--r--sys/dev/cfi/cfi_disk.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/sys/dev/cfi/cfi_disk.c b/sys/dev/cfi/cfi_disk.c
index 723d1ae..f5bcb1b 100644
--- a/sys/dev/cfi/cfi_disk.c
+++ b/sys/dev/cfi/cfi_disk.c
@@ -292,14 +292,13 @@ cfi_disk_getattr(struct bio *bp)
sc = dsc->parent;
dev = sc->sc_dev;
- do {
- if (g_handleattr(bp, "CFI::device", &dev, sizeof(device_t)))
- break;
-
- return (ERESTART);
- } while(0);
-
- return (EJUSTRETURN);
+ if (strcmp(bp->bio_attribute, "CFI::device") == 0) {
+ if (bp->bio_length != sizeof(dev))
+ return (EFAULT);
+ bcopy(&dev, bp->bio_data, sizeof(dev));
+ } else
+ return (-1);
+ return (0);
}
OpenPOWER on IntegriCloud