Date: Wed, 19 Oct 2016 06:15:27 +0000 (UTC) From: Sepherosa Ziehau <sephe@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307606 - in stable/11/sys: cam/ata sys Message-ID: <201610190615.u9J6FRCs092791@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sephe Date: Wed Oct 19 06:15:27 2016 New Revision: 307606 URL: https://svnweb.freebsd.org/changeset/base/307606 Log: MFC 306396 cam/ata: Allow drivers to veto ATA disk attachment. This eventhandler is mainly used by VMs, e.g. Hyper-V, whose disk controllers share the disks with the simulated ATA controllers. Submitted by: Hongjiang Zhang <honzhan microsoft com> Discussed with: mav Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7693 Modified: stable/11/sys/cam/ata/ata_xpt.c stable/11/sys/sys/eventhandler.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/11/sys/cam/ata/ata_xpt.c Wed Oct 19 05:53:43 2016 (r307605) +++ stable/11/sys/cam/ata/ata_xpt.c Wed Oct 19 06:15:27 2016 (r307606) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include <sys/interrupt.h> #include <sys/sbuf.h> +#include <sys/eventhandler.h> #include <sys/lock.h> #include <sys/mutex.h> #include <sys/sysctl.h> @@ -824,12 +825,24 @@ noerror: { struct ccb_pathinq cpi; int16_t *ptr; + int veto = 0; ident_buf = &softc->ident_data; for (ptr = (int16_t *)ident_buf; ptr < (int16_t *)ident_buf + sizeof(struct ata_params)/2; ptr++) { *ptr = le16toh(*ptr); } + + /* + * Allow others to veto this ATA disk attachment. This + * is mainly used by VMs, whose disk controllers may + * share the disks with the simulated ATA controllers. + */ + EVENTHANDLER_INVOKE(ada_probe_veto, path, ident_buf, &veto); + if (veto) { + goto device_fail; + } + if (strncmp(ident_buf->model, "FX", 2) && strncmp(ident_buf->model, "NEC", 3) && strncmp(ident_buf->model, "Pioneer", 7) && Modified: stable/11/sys/sys/eventhandler.h ============================================================================== --- stable/11/sys/sys/eventhandler.h Wed Oct 19 05:53:43 2016 (r307605) +++ stable/11/sys/sys/eventhandler.h Wed Oct 19 06:15:27 2016 (r307606) @@ -270,4 +270,11 @@ typedef void (*unregister_framebuffer_fn EVENTHANDLER_DECLARE(register_framebuffer, register_framebuffer_fn); EVENTHANDLER_DECLARE(unregister_framebuffer, unregister_framebuffer_fn); +/* Veto ada attachment */ +struct cam_path; +struct ata_params; +typedef void (*ada_probe_veto_fn)(void *, struct cam_path *, + struct ata_params *, int *); +EVENTHANDLER_DECLARE(ada_probe_veto, ada_probe_veto_fn); + #endif /* _SYS_EVENTHANDLER_H_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610190615.u9J6FRCs092791>