aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/ata/ata_xpt.c
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2016-07-28 22:55:14 +0000
committerWarner Losh <imp@FreeBSD.org>2016-07-28 22:55:14 +0000
commitded2b70617bc77cc5542033563c92b05414e4621 (patch)
tree31ed74ed27d45c49b9f6f266fdd40d717ff9c15e /sys/cam/ata/ata_xpt.c
parent34dc8f1bb47c76c1df69ba23da3b9700e566429b (diff)
downloadsrc-ded2b70617bc77cc5542033563c92b05414e4621.tar.gz
src-ded2b70617bc77cc5542033563c92b05414e4621.zip
Switch to linker sets to find the xport callback object. This
eliminates the need to special case everything in cam_xpt for new transports. It is now a failure to not have a transport object when registering the bus as well. You can still, however, create a transport that's unspecified (XPT_) Differential Revision: https://reviews.freebsd.org/D7289
Notes
Notes: svn path=/head/; revision=303467
Diffstat (limited to 'sys/cam/ata/ata_xpt.c')
-rw-r--r--sys/cam/ata/ata_xpt.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/sys/cam/ata/ata_xpt.c b/sys/cam/ata/ata_xpt.c
index 3dab055ced62..a51b5fa32410 100644
--- a/sys/cam/ata/ata_xpt.c
+++ b/sys/cam/ata/ata_xpt.c
@@ -195,18 +195,24 @@ static int atapi_dma = 1;
TUNABLE_INT("hw.ata.ata_dma", &ata_dma);
TUNABLE_INT("hw.ata.atapi_dma", &atapi_dma);
-static struct xpt_xport ata_xport = {
+static struct xpt_xport_ops ata_xport_ops = {
.alloc_device = ata_alloc_device,
.action = ata_action,
.async = ata_dev_async,
.announce = ata_announce_periph,
};
-
-struct xpt_xport *
-ata_get_xport(void)
-{
- return (&ata_xport);
-}
+#define ATA_XPT_XPORT(x, X) \
+static struct xpt_xport ata_xport_ ## x = { \
+ .xport = XPORT_ ## X, \
+ .name = #x, \
+ .ops = &ata_xport_ops, \
+}; \
+CAM_XPT_XPORT(ata_xport_ ## x);
+
+ATA_XPT_XPORT(ata, ATA);
+ATA_XPT_XPORT(sata, SATA);
+
+#undef ATA_XPORT_XPORT
static void
probe_periph_init()